{"action":"created","issue":{"url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/159","repository_url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi","labels_url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/159/comments","events_url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/159/events","html_url":"https://github.com/GrahamDumpleton/mod_wsgi/issues/159","id":181548849,"number":159,"title":"previous DYLD_LIBRARY_PATH environment value (possibly all other variables as well) is empty when modified in generated apachectl script.","user":{"login":"coderatchet","id":1973422,"avatar_url":"https://avatars.githubusercontent.com/u/1973422?v=3","gravatar_id":"","url":"https://api.github.com/users/coderatchet","html_url":"https://github.com/coderatchet","followers_url":"https://api.github.com/users/coderatchet/followers","following_url":"https://api.github.com/users/coderatchet/following{/other_user}","gists_url":"https://api.github.com/users/coderatchet/gists{/gist_id}","starred_url":"https://api.github.com/users/coderatchet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderatchet/subscriptions","organizations_url":"https://api.github.com/users/coderatchet/orgs","repos_url":"https://api.github.com/users/coderatchet/repos","events_url":"https://api.github.com/users/coderatchet/events{/privacy}","received_events_url":"https://api.github.com/users/coderatchet/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-10-06T23:18:07Z","updated_at":"2016-10-06T23:54:16Z","closed_at":null,"body":"I am deploying a cx_Oracle dependant WSGI app so need to have my DYLD_LIBRARY_PATH set to the correct instantclient location (containing the needed dlls). I generate the apache server configuration files using mostly default settings `mod_wsgi-express setup-server ...`.\r\n\r\nWhen I set my environment variables and call the script, the DYLD_LIBRARY_PATH disappears and gets replaced with the `../site-packages/mod_wsgi_packages/httpd/lib:` path. The intention of appending the previous value doesn't work and I believe this is due to the shebang env line ([6th paragraph in this answer][1])\r\n\r\n```bash\r\n# ./server script\r\nset -x\r\nexport DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH\r\nset +x\r\ngenerated-apache-server-home/apachectl $@\r\n```\r\n\r\n```bash\r\n# generated apachectl, I've placed set -x in there for debugging purposes\r\n#!/usr/bin/env bash\r\n...\r\nSHLIBPATH=\"/path/to/venv/lib/python2.7/site-packages/mod_wsgi_packages/httpd/lib\"\r\n\r\nif [ \"x$SHLIBPATH\" != \"x\" ]; then\r\n    set -x\r\n    DYLD_LIBRARY_PATH=\"$SHLIBPATH:$DYLD_LIBRARY_PATH\"\r\n    set +x\r\n    export DYLD_LIBRARY_PATH\r\nfi\r\n```\r\n\r\nDYLD_LIBRARY_PATH is not set:\r\n```bash\r\n$ ./server start\r\n++ export DYLD_LIBRARY_PATH=/path/to/instantclient_11_2\r\n++ DYLD_LIBRARY_PATH=/path/to/instantclient_11_2\r\n++ set +x\r\n+ DYLD_LIBRARY_PATH=/path/to/venv/lib/python2.7/site-packages/mod_wsgi_packages/httpd/lib:\r\n+ set +x\r\n```\r\n\r\nI am in a virtualenv and can `echo $DYLD_LIBRARY_PATH` the correct value.\r\n\r\n## UPDATE:\r\n\r\nAlso worth noting that using the `mod_wsgi-express setup-server --setenv` option has no effect:\r\n\r\n```bash\r\n# generated httpd.conf\r\n...\r\nSetEnv 'DYLD_LIBRARY_PATH' '/path/to/instantclient_11_2'\r\n...\r\n```\r\n\r\n```python\r\n# a python file I know is in the server\r\nimport os\r\nprint(\"DYLD_LIBRARY_PATH={}\".format(\"\" if \"DYLD_LIBRARY_PATH\" not in os.environ else os.environ[\"DYLD_LIBRARY_PATH\"]))\r\n``` \r\n\r\n```\r\n#output\r\n[Fri Oct 07 09:59:25.304172 2016...] DYLD_LIBRARY_PATH=/path/to/venv/lib/python2.7/site-packages/mod_wsgi_packages/httpd/lib:\r\n```\r\n\r\n[1]: http://unix.stackexchange.com/a/29620/63678"},"comment":{"url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/comments/252120239","html_url":"https://github.com/GrahamDumpleton/mod_wsgi/issues/159#issuecomment-252120239","issue_url":"https://api.github.com/repos/GrahamDumpleton/mod_wsgi/issues/159","id":252120239,"user":{"login":"coderatchet","id":1973422,"avatar_url":"https://avatars.githubusercontent.com/u/1973422?v=3","gravatar_id":"","url":"https://api.github.com/users/coderatchet","html_url":"https://github.com/coderatchet","followers_url":"https://api.github.com/users/coderatchet/followers","following_url":"https://api.github.com/users/coderatchet/following{/other_user}","gists_url":"https://api.github.com/users/coderatchet/gists{/gist_id}","starred_url":"https://api.github.com/users/coderatchet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coderatchet/subscriptions","organizations_url":"https://api.github.com/users/coderatchet/orgs","repos_url":"https://api.github.com/users/coderatchet/repos","events_url":"https://api.github.com/users/coderatchet/events{/privacy}","received_events_url":"https://api.github.com/users/coderatchet/received_events","type":"User","site_admin":false},"created_at":"2016-10-06T23:54:16Z","updated_at":"2016-10-06T23:54:16Z","body":"which upon speaking that out makes me realise it would be better simply obtaining the same production version and running with it."}}
{"actor":{"display_login":"coderatchet"}}