Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
    
It is important to mention how are you running PHP, is it suPHP, or mod_php? –  Florin Asavoaie Apr 10 at 20:59
    
The default installation, suPHP –  Michal Gow Apr 11 at 9:34

2 Answers 2

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 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 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 Asavoaie Apr 11 at 20:51
    
Thank you, will give it a shot! –  Michal Gow Apr 12 at 9:10

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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