{"id":124,"date":"2013-02-03T23:42:39","date_gmt":"2013-02-03T23:42:39","guid":{"rendered":"http:\/\/blopig.com\/blog\/?p=124"},"modified":"2013-02-03T23:42:39","modified_gmt":"2013-02-03T23:42:39","slug":"how-to-make-environment-variables-persist-in-your-web-app-apache2","status":"publish","type":"post","link":"https:\/\/www.blopig.com\/blog\/2013\/02\/how-to-make-environment-variables-persist-in-your-web-app-apache2\/","title":{"rendered":"How to make environment variables persist in your web app (Apache2)"},"content":{"rendered":"<p>Last Sunday, with the <a title=\"memoir\" href=\"http:\/\/opig.stats.ox.ac.uk\/webapps\/memoir\/php\/index.php\" target=\"_blank\">Memoir<\/a> gang, we were talking about using this blog as a technical notebook. This post is in that spirit.<\/p>\n<p>We have moved most of the validation of Memoir before submitting the job to the queue. \u00a0This has the advantage that the user knows immediately the submission has failed (instead of waiting for the job to be processed in the queue). \u00a0The only issue with this is that the apache user (on most systems <code>www-data<\/code>) is going to run the validation pipeline. \u00a0Memoir requires a ton of PATH variables addition.<\/p>\n<p>In most cases you cannot add variables in <code>.bashrc<\/code>\u00a0as the apache user does not have a home directory. \u00a0The easiest way how to add environment variables for the apache user is:<\/p>\n<pre class=\"lang:default decode:true\">sudo vim \/etc\/apache2\/envvars<\/pre>\n<p>And add the following line at the bottom\u00a0(these have to be customized according to the server):<\/p>\n<pre class=\"lang:default decode:true\">export PATH=$PATH:\/opt\/tmalign:\/opt\/muscle:\/opt\/joy-5.10:\/opt\/joy-5.10\/psa:\/opt\/joy_related-1.06:\/opt\/joy_related-1.06\/sstruc:\/opt\/joy_related-1.06\/hbond:\/opt\/medeller-dev\/bin:\/opt\/usearch6.0.307:\/opt\/ncbi-blast-2.2.27+:\/opt\/MPT\/bin<\/pre>\n<p>After this restart apache &#8211; and you should be laughing. Or, as is often the case, apache will be laughing at you.<\/p>\n<pre class=\"lang:default decode:true\">sudo service apache2 restart<\/pre>\n<p>The apache user should now &#8220;see&#8221; the amended path variable.<\/p>\n<p>Here it is this technical note &#8211; so in a few weeks time when I forget all of the above I can just copy and paste it &#8230;<\/p>\n<p>(This post is short, also because there is the superbowl!!)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last Sunday, with the Memoir gang, we were talking about using this blog as a technical notebook. This post is in that spirit. We have moved most of the validation of Memoir before submitting the job to the queue. \u00a0This has the advantage that the user knows immediately the submission has failed (instead of waiting [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","wikipediapreview_detectlinks":true,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"ngg_post_thumbnail":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[14,15],"tags":[],"ppma_author":[483],"class_list":["post-124","post","type-post","status-publish","format-standard","hentry","category-howto","category-technical"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"authors":[{"term_id":483,"user_id":6,"is_guest":0,"slug":"jp","display_name":"JP Ebejer","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/0c2ee7f7a071e0ff6aebc09ddb6c7bdd90146efeb8dfac34f7724f0b04ceafe8?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/comments?post=124"}],"version-history":[{"count":1,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":125,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/posts\/124\/revisions\/125"}],"wp:attachment":[{"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/media?parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/categories?post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/tags?post=124"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.blopig.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}