Assign PHP.ini

Just a quick question, how do I assign different PHP.ini files to individual Virtual servers.

The reason I ask is that I migrated one of my customers virtual servers from an older CENTOS 5 install to a new ubuntu 10.04LTS build and for some reason it is using the global PHP.ini file for the Drupal website PHP defaults. Prior to that it was using it's own.

Thanks in advance

Status: 
Closed (fixed)

Comments

When you switch a virtual server to fcgid or cgi mode for running PHP scripts (at Server Configuration -> Website Options), it will use its own php.ini file, located at etc/php5/php.ini under the domain's home.

Only when mod_php mode is used will a single global php.ini be used.

FCGId (run as virtual server owner)

is set for the server but yet it is still using the global apache PHP.ini

Are you sure? Which particular PHP setting is coming from the global config?

all of them

How are you testing this exactly?

i run a small test.php script containing

<?php
phpinfo( );
?>

this indicates to me that /etc/php5/apache2/php.ini is being used

also when i make changes to the local virtual servers php.ini they are not reflected in the virtual servers website

"phpinfo( ) "

Jamie, any Ideas, I'm at my wits end trying to figure this out

Did you try my previous comment (number 8) ?

Sorry can't try it because when I look at the comments section above my numbering goes 1,2,3,4,5,6,7,9,10

comment 8 is missing for some reason.

Wierd! What I wrote was :

Ok, I remember the cause of this now .. it is specific to Ubuntu 10. You need to edit the file /etc/apache2/mods-available/php5.conf and comment out all the SetHandler lines, then restart Apache.

Wierd! What I wrote was :

Ok, I remember the cause of this now .. it is specific to Ubuntu 10. You need to edit the file /etc/apache2/mods-available/php5.conf and comment out all the SetHandler lines, then restart Apache.

Wierd! What I wrote was :

Ok, I remember the cause of this now .. it is specific to Ubuntu 10. You need to edit the file /etc/apache2/mods-available/php5.conf and comment out all the SetHandler lines, then restart Apache.

Wierd! What I wrote was :

Ok, I remember the cause of this now .. it is specific to Ubuntu 10. You need to edit the file /etc/apache2/mods-available/php5.conf and comment out all the SetHandler lines, then restart Apache.

Wierd! What I wrote was :

Ok, I remember the cause of this now .. it is specific to Ubuntu 10. You need to edit the file /etc/apache2/mods-available/php5.conf and comment out all the SetHandler lines, then restart Apache.

Fantastic, worked like a charm. Thanks

Also do you know why this is set that way in Ubuntu 10.04?

No idea why Ubuntu does that .. but future versions of the Virtualmin installer will remove that SetHandler line automatically.

cool once again thanks.

Hi Jamie,

I just ran into another problem associated with this issue. one of my Drupal sites all of a sudden began spitting out when I applied your fix

The directory sites/default/files/css is not writable, because it does not have the correct permissions set.

and when I look at the permissions associated with this directory it is writable, also the other problem that occurs is that the webFM module that the website uses for handling files sees all the files as read only no matter what I do in the file system

Thanks

What PHP execution mode do you have set for the domain with that Drupal site?

FCGId (run as virtual server owner) is set on the virtual server as well as Ruby scripts disabled

Ok, that should allow writing.

What actually are the permissions on the directory mentioned in that error message from drupal?

The permissions on the files directory is 775 and 664 on the files themselves.

the issue seems to occur when I comment out the SetHandler statments and the virtual servers begin using there own PHP.ini files

Does it help if you completely remove that file (the one you commented out the directives in) and then restart Apache?

Haven't been able to test this yet, will give it a go tonight.

Just an FYI (and I posted in the other bug report as well for this) the issue is probably because mod_php5 is running. For some reason mod_php5 overrides mod_fcgid so that is why the global php.ini file is being used. If you do not use mod_php5 at all anywhere then I would disable the module and see if the issue goes away. You will find it at Webmin -> Servers -> Apache Webserver -> Global Configuration -> Configure Apache Modules then remove the checkmark next to php5 and click Enable Selected Modules.

It was the only way I got rid of the issue. The website configs looked fine but I'm not sure if there was any intention to be able to run both mod_php5 and mod_fcgid on the same apache server configuration.

Thanks Problem is now sorted :-)

Automatically closed -- issue fixed for 2 weeks with no activity.