Welcome to WebmasterWorld Guest from 126.96.36.199
Forum Moderators: bakedjake
i installed the php 4.1.2 rpm (with a lot of help from this board 3 months ago ;-) on our RH7.2 server.
i would now like to install the newest 4.3.1 version and compile it myself (to make use of newer functions).
the problem is we run a busy forum and on online shop which both use php/mysql, so i have to keep downtime to a minimum
am i right in thinking i have to force the rpm uninstall to stop dependancy problems and then 'quickly' compile the new version. then restart apache and everything should continue as normal?
1. download PHP 4.3.1
2. ./configure with your options
4. Make a script that simply has <?phpinfo();?> in it to test later.
how here is the point you should be quick.
5. shut down apache
6. make install PHP
7. restart apache.
8. call the script you made in #4 to ensure you are running the new version.
If phpinfo() shows you that your running the new version then check that everything else is ok.
At any point simply turn apache off and reinstall the old PHP rpm and restart apache to get things up and running again.
<5. shut down apache
6. make install PHP
7. restart apache.>
Is shutting Apache down prior to the install the generally accepted procedure? During this process, I've never shut down Apache prior to the install.. I've always done it afterwards, so my HTTP server is down for about 3 seconds. Not had any problems with this.
The CGI version of PHP should not have a problem unless php.cgi is running at that exact time. If it is then "make install" will not be able to rewrite it.
My process only takes about 10 seconds since "make install" for PHP goes quite quick.
the install appeared to work, but phpmyadmin woudn't display and gave me a
"cannot load MySQL extension,
please check PHP Configuration."
i then specified the extension_dir = /usr/lib/php4
and this time phpinfo worked, but gave me the same version as last time - 4.1.2 instead of 4.3.1?
furthermore my phpbb installation just didn't work after this
well i copied the old php.ini back to /etc and restarted apache and I am back where I started - a bit shaken, but at least my pulse is running normally again now ;-)
the funny thing is i didn't have to reinstall the rpms, just copy the php.ini back - so it seems as though the newer version of php just wasn't installed properly, and yet here are the steps i went through, (it ran with no mistakes)
tar zxvf php-3.2.1.....gz
cp php.ini-dist /etc/php.ini
doing "httpd -l" will give you the list of modules compiled into apache. PHP4 should not be listed.
Also in most cases there is no need to change your INI file.
One possibility is that RedHat's RPMs put PHP in a non standard directory. RedHat does have a habit of doing this. You should be able to look in httpd.conf to see where apache is looking for PHP4 if it's a loadable module.
does NOT list php as a compiled in module
the httpd.conf says
LoadModule php4_module /usr/lib/apache/libphp4.so
php is not compiled into apache, as i myself installed php-4.1.2.rpm and php-mysql-4.1.2.rpm after getting the server.
i find it really odd that the newer version installed seemingly correctly (make && make install) but my server still runs the older version.
i have tried locating libphp4.so but it only exists in the one place - /usr/lib/apache/libphp4.so
" if you have the binary installed as well (it's compiled and installed by default in the latest versions of PHP). If you don't see mysql listed, PHP doesn't have support for it so won't be able to connect.
If you don't have PHP installed as a binary, put "
" in a file on its own and load it from the web browser. There should be a table somewhere down the page with "MySQL Support" on one side and "enabled" on the other. If you can't find it, you're not going to be able to access MySQL servers.
One quick fix could be if you try adding this to the top of a PHP script using MySQL:
. It's possible that MySQL has been installed as a shared library and just isn't getting loaded. (If that is the case, you should really recompile or reinstall PHP with MySQL compiled in statically, because having a shared library every time someone looks at one of your pages isn't the most efficient way of accessing a database.)
[edit: D'oh, serves me right for not reading past posts properly - I guess you've already tried phpinfo(). PHP is definitely being loaded -- you wouldn't get "Check PHP configuration" otherwise -- so my guess is still that the RPM's either not installed MySQL support or installed it as a as a shared library. ]
i have been running php and mysql for 4 months now having installed them using the latest rpms from the RH Network.
i simply wanted to upgrade to php 4.3.1 to make use of the GD libraries.
at the moment php works perfectly with mysql, i simply wished to install a newer version of php.
it looks like you are right...
there is a libphp4.so* in /usr/local/apache/libexec/ with a creation date of yesterday.
so it must be as you suspected, the original rpm installed the libphp4.so* in a strange place.
well, i have just change the httpd.conf to reflect the libexec/pibphp4.so location of the php module and restarted the server, and i am UNABLE to access either phpMyAdmin, or our phpbb forum. it gives page not found and internal error 500.
in the apache / error_log it says:
PHP Warning: mysql: Unable to initialize module
Module compiled with debug=0, thread-safety=0 module API=20020429
PHP compiled with debug=0, thread-safety=0 module API=20010901
These options need to match
looks like i compiled php incorrectly - if i read that right, the API numbers need to match?
many thanks both!
p.s. i have just found an answer by rasmus lerdorf (he ought to know ;-) to exactly this problem:
"You recompile that extension."
what exactly does he mean?
PHP is complaining because it's trying to load the MySQL module which is for an earlier version of PHP (or at least, a different version). If you've just installed a new version of PHP and it ended up somewhere unexpected, maybe the new version of the MySQL module is also in a different place? Or maybe new versions of the modules didn't get installed?
Your php.ini file should have a section in it headed "Dynamic Extensions" which lists the modules PHP loads. Have a look to see what file the mysql module is called (I think it's just mysql.so or php_mysql.so) and see if you can find two copies that file. If you've just got a new set of extensions installed somewhere else, you can just change the "extension_dir" setting in php.ini. If you don't have the module installed... erm, well like Rasmus says, recompile the extension. ;) Either download the source and compile it manually, or look for an rpm that just installs that module. If you're recompiling it yourself, I think just "./configure --your-options && make install-modules" should work.
maybe the new version of the MySQL module is also in a different place
i am not sure what you mean - as i only installed php not mysql?
when i locate mysql.so - there is only one, which is in /usr/lib/php4/ - this is the one which was installed by the php-mysql-4.1.2.rpm which i installed months ago together with the version of php which i currently run: php-4.1.2.
if i understand you correctly, i need to install a version of the mysql.so which is compatible with the newer version of php?
... a version 4.3.1 of mysql.so?
just need to find it now ;-)
thing is, there is no where i can see on php.net to download and or install such an extension :-(
i have just read in the INSTALL file that
If you are recompiling PHP to add new extensions or upgrading something like GD, remove the config.cache file before you re-run configure.
but the only config.cache files i can see are to do with mod_ssl and qpopper?
find /tmp -name 'config.cache'
Also, it could be that your locate database hasn't updated since you compiled PHP last, so try this to search everywhere for mysql.so:
find / -name 'mysql.so'
Probably not though...
Oh, wait, I just had a thought. I think the reason the new mysql.so didn't get installed is because you used "--with-mysql=/usr" in your configure line - to compile a shared library you need to use either "--with-mysql=shared" or "--enable-shared=mysql". Perhaps try recompiling with one of these options and see if you get another mysql.so?
BTW, sorry for not reading through this thread properly earlier. My replies could probably have been more helpful.