Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to add a path to $PATH environment variable for PHP scripts on CentOS linux server with cPanel Pro 1.0 and Apache 2.2.27.

For Ubuntu or SuSE it just means adding the row export PATH=$PATH:/path to /etc/sysconfig/apache2, but this file is missing in sysconfig on CentOS with cPanel (and, of course, script /etc/init.d/httpd is not looking for it). Is it anywhere else (as that would be the solution)?

The answer published here uses PHP itself to change PATH variable, but I'd like to use more robust solution on the Apache level... Any help will be highly appreciated!

share|improve this question

closed as off-topic by Hyppy, Jenny D, mdpc, HBruijn, MadHatter May 4 '15 at 7:53

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

It is important to mention how are you running PHP, is it suPHP, or mod_php? – Florin Asăvoaie Apr 10 '14 at 20:59
The default installation, suPHP – Michal Gow Apr 11 '14 at 9:34

Edit /opt/suphp/etc/suphp.conf and set env_path to the path string that you want.

share|improve this answer
Invalid command 'env_path'... – Michal Gow Apr 11 '14 at 14:20
What if I change Apache to mod_php? Would that help? It is VPS with only one website, so it is actually even logical choice... – Michal Gow Apr 11 '14 at 14:21
It is not. suPHP has many advantages over mod_php. Maybe update the suPHP version? It should definitely support that command, see here. – Florin Asăvoaie Apr 11 '14 at 20:51
Thank you, will give it a shot! – Michal Gow Apr 12 '14 at 9:10
up vote 2 down vote accepted

It actually was combination of 3 things:

  1. Installation must be mod_php
  2. Then the config file on CentOS with cPanel is /usr/local/apache/bin/envvars; and usual export PATH=$PATH:/path works just fine here
  3. You need to stop/start httpd service, simple restart will not change the environmental variables

Thanks for help!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.