homepage Welcome to WebmasterWorld Guest from 54.225.24.227
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
upgrading php on a live server
jamie




msg:908177
 6:25 pm on May 7, 2003 (gmt 0)

hi,

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?

 

daisho




msg:908178
 8:01 pm on May 7, 2003 (gmt 0)

No you don't need to uninstall the RPM. Shouldn't cause a problem. But have that RPM ready to reinstall incase of a problem.

1. download PHP 4.3.1
2. ./configure with your options
3. compile.
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.

daisho.

jamie




msg:908179
 7:19 am on May 8, 2003 (gmt 0)

thanks for a really clear explanation daisho!

much obliged.

"keep the rpm ready just in case.."

amen to that ;-)

NickCoons




msg:908180
 5:06 am on May 9, 2003 (gmt 0)

daisho,

<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.

daisho




msg:908181
 11:57 am on May 9, 2003 (gmt 0)

Are you running mod_php? I have had problems with not being able to upgrade while PHP is running.

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.

daisho.

jamie




msg:908182
 7:03 am on May 11, 2003 (gmt 0)

hi daisho,

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
cd /tmp/php-4.3.1

./configure
--with-apxs=/usr/local/apache/bin/apxs
--prefix=/usr/local/apache
--with-system-regex
--with-config-file-path=/etc
--disable-debug --enable-versioning
--enable-sockets
--enable-track-vars
--enable-ftp
--enable-memory-limit=yes
--enable-bcmath
--with-mysql=/usr
--enable-exif

make

cp php.ini-dist /etc/php.ini

apachectl stop
make install
apachectl start

jamie




msg:908183
 7:29 am on May 11, 2003 (gmt 0)

another afterthought...

might i have had to stop the mysql server?

daisho




msg:908184
 3:43 pm on May 11, 2003 (gmt 0)

No you should not need to stop mySQL. Are you sure that you are currently using PHP as a loadable module? If PHP is compiled into your apache then you will have issues with this install.

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.

daisho.

jamie




msg:908185
 9:44 pm on May 13, 2003 (gmt 0)

thanks for answering daisho,

/usr/local/apache/bin/httpd -l
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

thanks

daisho




msg:908186
 1:59 am on May 14, 2003 (gmt 0)

where is your apache "httpd" binary? A standard install puts it in /usr/local/apache/bin. (from your configure command it seems that that is where it is).

In this case modules are normaly put in the /usr/local/apache/libexec directory.

daisho

mischief




msg:908187
 5:40 am on May 14, 2003 (gmt 0)

Also try checking the output of "
php -m" 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 "<? phpinfo();?>" 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: <? dl('mysql.so');?>. 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. ]

jamie




msg:908188
 10:08 am on May 14, 2003 (gmt 0)

hi mischief,

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.

daisho,

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?

mischief




msg:908189
 1:49 pm on May 14, 2003 (gmt 0)

Hi jamie,

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.

jamie




msg:908190
 3:08 pm on May 14, 2003 (gmt 0)

maybe the new version of the MySQL module is also in a different place

hi mischief,

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.

so...

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 :-(

<added>
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?

mischief




msg:908191
 2:16 am on May 13, 2003 (gmt 0)

Try this to find config.cache:

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.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved