Local php.ini changes dont take effect?

20 posts / 0 new
Last post
#1 Mon, 06/13/2011 - 09:54
rduval

Local php.ini changes dont take effect?

Changes I make to local php.ini files aren't showing up.

These are changes in the homes/myserver.com/etc/php.ini file. I then use 'service httpd restart' (and have even done complete reboot of the machine) but the changes don't take effect when I uses a phpinfo() request on a webpage (using CTRL-F5 to make sure it reloads the page)

Am I missing something?

Latest up to date Virtualmin on Centos5 BTW.

Thanks

Mon, 06/13/2011 - 10:07
andreychek

Howdy,

What you're describing can occur if the Virtual Server is setup to use mod_php rather than CGI or FCGID. Only CGI and FCGID offer per-domain php.ini files, mod_php uses one central php.ini file.

To determine which you're using, you can go into Server Configuration -> Website Options, and look at the "PHP Execution Mode".

-Eric

Wed, 08/17/2011 - 07:43 (Reply to #2)
neelu

Hi Erick,

I have same problem as above , means changes I make to local php.ini files aren't reflecting.I have also go through above solution but my problem is that from where i can set mod_php value. Do i set in php.ini file and do i need to install mod_php module

My php.ini file path is /etc/php.ini

please help me

Wed, 08/17/2011 - 09:02 (Reply to #3)
andreychek

The mod_php module is likely already installed.

If you're using mod_php, you'd need to edit the system-wide php.ini file located in /etc... in you're case, it sounds like that's /etc/php.ini.

Once you do that, when using mod_php, you may also need to restart Apache in order for those settings to take effect.

-Eric

Mon, 06/13/2011 - 10:24
rduval

Thanks Eric. Changing from mod_php worked and the phpinfo() showed the updated changes but now I'm getting strange errors like "Fatal error: Call to undefined function mysql_pconnect() in /home/..."

How does changing from mod_php to CGI or FCGID (not sure what they stand for or why I would use one or the other but...) How does the cahnge affect functions like this?

This website worked fine on PHP4.

Mon, 06/13/2011 - 10:37
andreychek

That just means that the way your system is setup, that the "MySQL" module isn't being loaded in those other two modes.

I do suggest using CGI or FCGID, as they're more secure, as well as being more flexible.

But you may need to make sure that the PHP5 MySQL module is installed and enabled.

If that website were previously setup to use PHP4, it's possible that the php.ini file has something in it that's preventing the MySQL module from being loaded.

You'd either need to troubleshoot your domain's php.ini file (my hunch is that it may have an incorrect extension_dir -- you could try commenting that out entirely) -- or you could simply copy over a new version of it from /etc/php.ini.

-Eric

Mon, 06/13/2011 - 10:54
rduval

It was a clean, new install of Virtuamin. THe only thing I changed was the session_autostart in the php.ini.

I'm a little confused as to why the MySQL module is there in mod_php but not there in the other two modes?

Mon, 06/13/2011 - 13:04
andreychek

Oh, I see the problem. I had to do some reading on PHP's "mysql_pconnect" function to notice it:

http://php.net/manual/en/function.mysql-pconnect.php

Apparently, this function is only designed to work with mod_php -- it won't work with PHP's CGI or FCGID modes.

So, in order to use the web application you have as it's currently written -- you'd have to use mod_php. That prevents you from being able to make changes to the php.ini file in $HOME/etc/php.ini (well, you can make changes, but they won't be seen).

You can, however, make changes to the global php.ini file in /etc.

-Eric

Mon, 06/13/2011 - 13:53
rduval

Thanks for the links and the info. Based on some reading I decided to go for FastCGI instead and rewrite the code (just an include anyway) to use mysql_connect instead of pconnect but it still comes back with an error..

Fatal error: Call to undefined function mysql_connect() in /home/blahblah.com/public_html/Connections/aasts_aasts.php on line 9

I installed virtualmin on a clean centos5 machine when I built this. Is this something I have to enable? Can you help me out with this? I wonder why it's not enabled by default on the install?

Thanks

Mon, 06/13/2011 - 13:56
andreychek

What output do you receive if you run this command:

rpm -qa | grep 'php*'

Mon, 06/13/2011 - 14:06
rduval
php-common-5.1.6-27.el5_5.3
php-odbc-5.1.6-27.el5_5.3
php-imap-5.1.6-27.el5_5.3
php-gd-5.1.6-27.el5_5.3
php-mysql-5.1.6-27.el5_5.3
php-xmlrpc-5.1.6-27.el5_5.3
php-devel-5.1.6-27.el5_5.3
wbm-php-pear-1.5-1
php-pdo-5.1.6-27.el5_5.3
php-cli-5.1.6-27.el5_5.3
php-pgsql-5.1.6-27.el5_5.3
php-snmp-5.1.6-27.el5_5.3
php-mbstring-5.1.6-27.el5_5.3
php-5.1.6-27.el5_5.3
php-pear-1.4.9-6.el5
Mon, 06/13/2011 - 14:13
andreychek

It looks like you do indeed have the PHP MySQL module installed. So I'm not quite sure what is wrong, most folks are able to begin using PHP and MySQL out of the box :-)

Is it possible you could post a link to a script running on your server that outputs "phpinfo()"?

Or, you could always attach your Virtual Server's php.ini file (in $HOME/etc/php.ini), that may contain some clues as to what's going on.

-Eric

Mon, 06/13/2011 - 14:20
rduval

I'm happy to do both for you but I really don't want to post a link on a forum. Can I email it to you? Messenger or something?

Mon, 06/13/2011 - 14:23
andreychek

Well, let's just start with the php.ini file for now :-)

That should be pretty generic by default... perhaps a problem with it will stand out.

-Eric

Mon, 06/13/2011 - 14:59
rduval

Ok, here's a sanitized dump of the phpinfo() [html, sorry] and php.ini ..

OK, well that's not working. I tried to upload a pdf of the dump using both Firefox and IE and I got the same error: "An HTTP error 0 occurred. /comment-upload/js"

So if you rename info.txt to info.html and open it in a browser, you will get the phpinfo() dump and the phpini.txt is the php.ini (again, sanitized)

Mon, 06/13/2011 - 15:03
andreychek

What output do you see if you run this command:

ls -l /usr/lib64/php/modules

Mon, 06/13/2011 - 15:21
rduval

[root@vps09 ~]# ls -l /usr/lib64/php/modules ls: /usr/lib64/php/modules: No such file or directory [root@vps09 ~]#

Mon, 06/13/2011 - 15:31
andreychek

ls: /usr/lib64/php/modules: No such file or directory

So, there's your problem :-)

The extension_dir set in your domain's php.ini file is invalid... so when PHP attempted to load the MySQL module, it wasn't able to.

CentOS and Virtualmin don't set an extension_dir, it's unset by default. So, somewhere along the way, that option somehow managed to get set :-)

My recommendation is to edit your $HOME/etc/php.ini file, and comment out the "extension_dir" line.

-Eric

Mon, 06/13/2011 - 16:14
rduval

Thanks Eric, that fixed it but I still can't see how it got set unless it was by Centos installer or virtualmin installer.

BTW there are modules in /usr/lib/php/modules and the main /etc/php.ini looks to that dir so I can't see how that got changed in the local homes one unless virtualmin did it during setup.

Rick

Thu, 11/26/2015 - 11:15
iboinas

Server Configuration -> Website Options, and look at the "PHP Execution Mode".

andreychek => Life saver =)

I registered just to thank you!!