0

I just found out that overriding php.ini settings in the vhost configuration does not work on Apache with suPHP.

The system is Ubuntu Server Edition 14.04 LTS and I installed Apache + PHP like this:

apt-get install apache2 apache2-mpm-prefork apache2-utils php5

Without changing any settings, the following vhost works out-of-the-box:

<VirtualHost *:80>
    ServerName example.com
    ServerAlias www.example.com

    DocumentRoot /var/www/html/public
    php_admin_value open_basedir /var/www/html
</VirtualHost>

One can verify that the "open_basedir" setting is honored with phpinfo().

However, after installing suPHP and suExec:

apt-get install libapache2-mod-suphp apache2-suexec
a2enmod suexec

phpinfo() shows that the values are still those set in "/etc/php5/cgi/php.ini". This is true not only for open_basedir, but for any setting I try to override with either php_admin_value or php_value.

Is there any way to make the above setup work?

0

The documentation at http://www.suphp.org/FAQ.html says suPHP doesn't support the php_admin_value directive. You might be able to accomplish something similar using a custom php.ini file and the suPHP_ConfigPath directive though (see http://www.suphp.org/DocumentationView.html?file=apache/CONFIG).

  • Will the php.ini specified with suPHP_ConfigPath merge with /etc/php5/cgi/php.ini. or completely override it? That is, will values unset in suPHP_ConfigPath fall back to defaults or to the values set in /etc/php5/cgi/php.ini? – matpen Jun 15 '15 at 22:50
  • @matpen I'm not sure off the top of my head, but since you're already running it, just capture the output of <?php phpinfo(); ?> before and after using that directive, and paste the output into WinMerge to easily see what's changed. – sa289 Jun 15 '15 at 23:19
  • @matpen Were you able to get this resolved? If so, was this answer helpful? Thanks – sa289 Jul 13 '15 at 20:43
  • After researching and testing, I have concluded that the method you suggest is the only viable one. Unfortunately, the main configuration file /etc/php5/cgi/php.ini is ignored if the suPHP_ConfigPath is specified. – matpen Aug 23 '15 at 15:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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