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.
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”.
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.
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.
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?
Oh, I see the problem. I had to do some reading on PHP’s “mysql_pconnect” function to notice it:
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.
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?
What output do you receive if you run this command:
rpm -qa | grep ‘php*’
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.
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?
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.
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)
What output do you see if you run this command:
ls -l /usr/lib64/php/modules
[root@vps09 ~]# ls -l /usr/lib64/php/modules
ls: /usr/lib64/php/modules: No such file or directory
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.
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.
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
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.
Server Configuration -> Website Options, and look at the “PHP Execution Mode”.
andreychek => Life saver =)
I registered just to thank you!!