View Full Version : suPHP won't honor php_value in vhost
palantir
12-09-2008, 06:43 AM
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??
smtalk
12-09-2008, 07:05 AM
http://www.php.net/ChangeLog-5.php#5.2.7: Added "PHP_INI_SCAN_DIR" environment variable which can be used to either disable or change the compile time ini scan directory (FR Fixed bug #45114 (http://bugs.php.net/45114)). (Jani)
palantir
12-09-2008, 08:11 AM
That's what's called "just in time" ;-) I'll try this tomorrow and I'll report back to the forum... Thanks
palantir
12-10-2008, 05:01 AM
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:
SetEnv PHP_INI_SCAN_DIR /home/theuser/domains/thedomain/etc/
4. Log-in via ssh as root or as user and:
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:
|*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.
Powered by vBulletin™ Version 4.0.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.