suPHP won't honor php_value in vhost

palantir

Verified User
Joined
Nov 13, 2008
Messages
18
Location
Trento, Italy
suPHP won't honor php_value in vhost (with solution)

I have just discovered that suPHP will not allow to override php.ini parameters from the vhost nor from .htaccess (using php_value or php_admin_value). It will allow to create a php.ini file in the customer's directories (each directory, as it will not scan directories recursively), but then, it will not merge it with the main php.ini.

Am I right? I really can't undestand their approach. I have a bunch of sites I need to migrate to the DA panel with suPHP, and they all need auto_prepend and auto_append directives. So I'd need to duplicate the main php.ini file to EACH directory of those sites?!

Anyone has a workaround for this? (I have root on the DA server). Is returning to php_mod the only alternative??
 
Last edited:
This is great, I think it'll solve all the php_value headache. I have used it like this:

1. Go to the domain you wish to override php.ini settings (as reseller)
2. Click on Custom httpd settings
3. Add this:
Code:
SetEnv PHP_INI_SCAN_DIR /home/theuser/domains/thedomain/etc/
4. Log-in via ssh as root or as user and:
Code:
cd /home/theuser/domains/thedomain
mkdir etc
nano etc/php.ini
# put something here, for example: register_globals=on and save

If you log in as root, and the umask is correct, the permissions will not allow the user to add files to the etc directory, nor to edit the php.ini file itself, so you'll have full control on those settings.

The good news is that settings done in this way will cumulate with the existing php.ini, so you do not have to provide a complete php.ini file, you just need to put the things you want to override.

To make this change permanent and have it applied for each user, you can add this to the custom template, after the ErrorLog line:

Code:
|*if SUPHP="1"|
        SetEnv PHP_INI_SCAN_DIR /home/|USER|/domains/|DOMAIN|/etc/
|*endif|

regenerate the configurations, and possibly create the etc directory everywhere as described above. I have added a custom script to create those directories upon domain creation, with the right settings.
 
Back
Top