1

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!

Michal Gow
  • 197
  • 1
  • 9

2 Answers2

3

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

Florin Asăvoaie
  • 7,057
  • 23
  • 35
  • 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](http://www.suphp.org/DocumentationView.html?file=suphp.conf-example). – Florin Asăvoaie Apr 11 '14 at 20:51
2

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!

Michal Gow
  • 197
  • 1
  • 9