• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

PHP5, I want it!!! But how?

J

jvanv8

Guest
I would like to upgrade to php5 but am very hesitant that the upgrade will fail and the server will go down.

What is the best and safest way to upgrade to PHP5? I am not worried about current php4 scripts and compatibility since I don't think it will be an issue.

Any thoughts?
 
First, you need to back up the server or all the files and domains you don't want to loose. Then if the install goes bad you can restore the server back to the way it was.

Borf
 
I checked "> yum info" and I see that my yum config is currently set such that PHP is for:
Version: 5.1.4
Release: 1.rhfc3.art

Currently, I have
PHP Version: 4.3.2
with GD and lots of others
(* Would it help if I posted my phpinfo?)

Is running "yum update php" going to cause ANY problems? I've heard about some people upgrading and suddenly the server just spits out php code instead of rendering it.

What are the most common problems if any?
What should I back up?
What is the general % of success for running yum update php?

My main priority is having PHP function correctly and with little or no downtime. Hopefully Plesk 8 will work as well, but it isn't as critical.

Thanks for your help guys!
- John
 
Anyone tried this?
On a risk level of 1 (safe & no downtime) to 10 (possible downtime, restore required or worse) where would this fall?
 
I tried atomics ver. 5.0.4 on a testserver today. Worked fine. Had to change one line in /etc/httpd/con.d/php.ini (If I remember correct) and a few lines in /etc/php.ini. After that it seemed to work fine. Haven't tested it much, but worked connecting to mysql, running Joomla etc... read the instructions before you install :)
 
FC4 & 5 stands for Fedora Core, right? I'm not sure if I have FC4 or 5, how can I tell?
I do know that the PSA build is for RedHat EL3... will it work with that?
I'm not really familiar with these server terms :)
Just for kicks here's some versions I currently am trying to upgrade from:
Code:
MySQL:			3.23.58-16.RHEL3.1
PHP:			4.3.2-23.ent
psa:			8.0.0-rhel3.build80060331.13
psa-api-rpc:		8.0.1-rhel3.build80060613.20
httpd:			2.0.46-46.ent
 
Correct, you're on rhel3. I have 5.0 rpms for that distro, 5.1 will not be available without major modifications on RH9 or RHEL3/CentOS3.
 
sounds great, how do I configure my yum.conf file so it picks up the 5.0 version that's compatible with rhel3?
 
ok I was able to yum update php and then yum install php-mysql. phpinfo() now gives me the php 5.0.4 as the version.

However, yum seems to have configured php "without-mysql" and "without gd" and "disable dom" and a few others that I notice are differnt from the previous version I was running.

I ran
yum install php-mysql

it installed correctly, I restarted apache but still phpinfo gives me "without-mysql" ... etc....

In desparation, I even ran
Code:
[B]yum -y install php php-devel php-gd php-imap php-ldap php-mysql php-odbc[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
php is installed and is the latest version.
php-imap is installed and is the latest version.
php-ldap is installed and is the latest version.
php-mysql is installed and is the latest version.
Resolving dependencies
.Dependencies resolved
I will do the following:
[install: php-devel 5.0.4-13.rhel3.art.i386]
[install: php-odbc 5.0.4-13.rhel3.art.i386]
[install: php-gd 5.0.4-13.rhel3.art.i386]
I will install/upgrade these to satisfy the dependencies:
[deps: unixODBC 2.2.3-6.i386]
Downloading Packages
Getting php-devel-5.0.4-13.rhel3.art.i386.rpm
php-devel-5.0.4-13.rhel3. 100% |=========================| 366 kB    00:00     
Getting unixODBC-2.2.3-6.i386.rpm
unixODBC-2.2.3-6.i386.rpm 100% |=========================| 1.1 MB    00:01     
Getting php-odbc-5.0.4-13.rhel3.art.i386.rpm
php-odbc-5.0.4-13.rhel3.a 100% |=========================|  58 kB    00:00     
Getting php-gd-5.0.4-13.rhel3.art.i386.rpm
php-gd-5.0.4-13.rhel3.art 100% |=========================| 252 kB    00:00     
Running test transaction:
Test transaction complete, Success!
unixODBC 100 % done 1/4 
php-devel 100 % done 2/4 
php-odbc 100 % done 3/4 
php-gd 100 % done 4/4 
Installed:  php-devel 5.0.4-13.rhel3.art.i386 php-odbc 5.0.4-13.rhel3.art.i386 php-gd 5.0.4-13.rhel3.art.i386
Dep Installed:  unixODBC 2.2.3-6.i386
Transaction(s) Complete
Any ideas? Is there a way to recompile?
 
ok, just a follow up on my current state of despiration:

I tried
yum install php-mysql
after php was installed (mysql was already running on this machine) and I didn't notice at the time but it required mysql 4.1.20 to be installed over the top(?) of mysql 4.0.20.
Code:
I will do the following:
[update: php 5.0.4-13.rhel3.art.i386]
I will install/upgrade these to satisfy the dependencies:
[deps: php-mysql 5.0.4-13.rhel3.art.i386]
[deps: php-pear 5.0.4-13.rhel3.art.i386]
[deps: php-ldap 5.0.4-13.rhel3.art.i386]
[deps: mysql 4.1.20-1.art.rhel3.art.i386]
[deps: php-imap 5.0.4-13.rhel3.art.i386]
Is this ok [y/N]: y
Downloading Packages
......
.....
This caused some problems as I later discovered that "service mysql restart" produced a "unrecognized service" error and mysql was no longer operating.

I quickly reinstalled mysql from the 3 rpms I had on the server (Mysql client, Mysql server, and MySQL-shared-compat all of version 4.0.20-0.i386.rpm)

This got mysql back running.

So to get php so it has mysql support, I've been told I need to do "yum install php-mysql" but when I check it says that mysql is not on the list of installed packages and again attempts to install ver 4.1.20:
Code:
[B]# yum info php-mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Looking in Available Packages:
Name   : php-mysql
Arch   : i386
Version: 5.0.4
Release: 13.rhel3.art
Size   : 376.59 kB
Group  : Development/Languages
Repo   : Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Summary: A module for PHP applications that use MySQL databases.
Description:
 The php-mysql package contains a dynamic shared object that will add
MySQL database support to PHP. MySQL is an object-relational database
management system. PHP is an HTML-embeddable scripting language. If
you need MySQL support for PHP applications, you will need to install
this package and the php or mod_php package.

 
Looking in Installed Packages:
 
[B]# yum info mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Looking in Available Packages:
Name   : mysql
Arch   : i386
Version: 4.1.20
Release: 1.art.rhel3.art
Size   : 6.95 MB
Group  : Applications/Databases
Repo   : Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Summary: MySQL client programs and shared library.
Description:
 MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. This package
contains the MySQL client programs, the client shared library, and
generic MySQL files.

 
Looking in Installed Packages:
 
#
So it appears that yum isn't detecting mysql (???) so it always attempts to install it.

If I decide to install the 4.1.20 version of mysql, this happens:
Code:
[B]# yum install php-mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
.Dependencies resolved
I will do the following:
[install: php-mysql 5.0.4-13.rhel3.art.i386]
I will install/upgrade these to satisfy the dependencies:
[deps: mysql 4.1.20-1.art.rhel3.art.i386]
Is this ok [y/N]: y
Downloading Packages
Getting php-mysql-5.0.4-13.rhel3.art.i386.rpm
php-mysql-5.0.4-13.rhel3. 100% |=========================| 151 kB    00:00     
Getting mysql-4.1.20-1.art.rhel3.art.i386.rpm
mysql-4.1.20-1.art.rhel3. 100% |=========================| 3.3 MB    00:03     
Running test transaction:
Test transaction complete, Success!
mysql 100 % done 1/4 
php-mysql 100 % done 2/4 
Erasing: MySQL-server 3/4
Erasing: MySQL-client 4/4
Installed:  php-mysql 5.0.4-13.rhel3.art.i386
Dep Installed:  mysql 4.1.20-1.art.rhel3.art.i386
Transaction(s) Complete
[B]# service mysql restart
mysql: unrecognized service[/B]
Now php stands at version 5, compiled with no mysql, gd, or all sorts of other basic things. I removed the php-mysql package that yum installed and built mysql with some trusty 4.0.20 rpms. This got mysql working at least.

I have read that some people enabled mysql support by changing their php.ini file. Apparently in the mysql section they enter or uncomment the line
Code:
extension=mysql.so
My mysql section of the php.ini file only says this (took out comments)
Code:
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.trace_mode = Off
Not much interesting. In fact, I see no mension of *.so extension files anywhere in php.ini
Code:
# locate mysql.so
/usr/lib/php/modules/mysql.so
If I try to be sneeky and add this to my php.ini file then restart apache, nothing changes. phpinfo() doesn't show that mysql.so is a loaded module under apache2handler or 'Additional Modules'.


Help!
?
!
 
You need to follow the instructions on the php project page on my website, upgrading to 5.0 is not a clean upgrade like 4.x . I suspect that you havent updated your php.ini to work with the new module paths used in php 5.0.

5.0 is linked against mysql 4.1, so an update is required.

Minor typo in your mysql startup, the correct way to start mysql is:
/etc/init.d/mysqld start
or
service mysqld start
 
Apparently the mysql service on this server is always called "mysql"
Code:
# service mysqld restart
mysqld: unrecognized service
# /etc/init.d/mysqld start
-bash: /etc/init.d/mysqld: No such file or directory
# service mysql restart
Shutting down MySQL..                                      [  OK  ]
Starting MySQL                                             [  OK  ]
I tried to update mysql via yum but it didn't notice mysql already installed on the system so I had to do a yum install mysql. It appeared to install but didn't work:
Code:
# [B]yum update mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Cannot find any package matching mysql available to be updated.
No actions to take
# [B]yum install mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
Dependencies resolved
I will do the following:
[install: mysql 4.1.20-1.art.rhel3.art.i386]
Is this ok [y/N]: [B]y[/B]
Downloading Packages
Running test transaction:
Test transaction complete, Success!
mysql 100 % done 1/3 
Erasing: MySQL-server 2/3
Erasing: MySQL-client 3/3
Installed:  mysql 4.1.20-1.art.rhel3.art.i386
Transaction(s) Complete
# [B]service mysqld start[/B]
mysqld: unrecognized service
# [B]/etc/init.d/mysqld start[/B]
-bash: /etc/init.d/mysqld: No such file or directory
# [B]service mysql start[/B]
mysql: unrecognized service
# [B]yum remove mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
Dependencies resolved
I will do the following:
[erase: mysql 4.1.20-1.art.rhel3.art.i386]
Is this ok [y/N]: [B]y[/B]
Downloading Packages
Running test transaction:
Test transaction complete, Success!
Erasing: mysql 1/1
Erased:  mysql 4.1.20-1.art.rhel3.art.i386
Transaction(s) Complete
I'm not really sure why yum erased the Mysql-server and Mysql-client but mysql doesn't seem to work, especially without Mysql-server. So I gave up with yum updating mysql and just downloaded the 3 rpms (I think these are the ones I need) from Mysql.com
Code:
MySQL-server-4.1.20-0.i386.rpm 
MySQL-client-4.1.20-0.i386.rpm
MySQL-shared-compat-4.1.20-0.i386.rpm
Installed fine and runs smooth with a rpm -ivh executed on all 3.

Now with mysql running alright, I tried to yum install php-mysql to see if I could get PHP5 to support mysql.
Code:
# [B]yum install php-mysql[/B]
Gathering header information file(s) from server(s)
Server: Atomic Rocket Turtle - 3ES - Atomic PSA-Compatible RPMS
Server: Red Hat Linux 3ES - i386 - Base
Server: Atomic Rocket Turtle - 3ES - SW-Soft PSA 7.5 RPMS
Server: Red Hat Linux 3ES - Updates
Finding updated packages
Downloading needed headers
Resolving dependencies
Dependencies resolved
I will do the following:
[install: php-mysql 5.0.4-13.rhel3.art.i386]
Is this ok [y/N]: [B]y[/B]
Downloading Packages
Running test transaction:
Test transaction complete, Success!
php-mysql 100 % done 1/1 
Installed:  php-mysql 5.0.4-13.rhel3.art.i386
Transaction(s) Complete
[B]# service httpd restart[/B]
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
However, phpinfo() still gives me the following configure settings
Code:
'./configure' '--host=i686-redhat-linux-gnu' '--build=i686-redhat-linux-gnu' 
'--target=i386-redhat-linux-gnu' 
'--program-prefix=' 
'--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc'
 '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' 
'--libexecdir=/usr/libexec' '--localstatedir=/var' 
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
 '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' 
'--with-config-file-path=/etc' 
'--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' 
'--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' 
'--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' 
'--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-zlib'
 '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' 
'--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' 
'--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' 
'--with-pear=/usr/share/pear' '--with-kerberos=/usr/kerberos' 
'--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' 
'--enable-memory-limit' '--enable-shmop' 
'--enable-calendar' '--enable-dbx' '--enable-dio' 
'--with-mime-magic=/etc/httpd/conf/magic' 
'--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' 'build' '--with-apxs2=/usr/sbin/apxs' 
[B]'--without-mysql' '--without-gd'[/B] 
'--without-odbc' [B]'--disable-dom'[/B] '--disable-dba'

Some other interesting bits from phpinfo()
Code:
PHP Version:				PHP Version 5.0.4
Server API:				Apache 2.0 Handler
Virtual Directory Support: 		disabled
Configuration File (php.ini) Path: 	/etc/php.ini
Scan this dir for additional ini files:	/etc/php.d
additional .ini files parsed 		/etc/php.d/gd.ini, /etc/php.d/imap.ini, /etc/php.d/ldap.ini, /etc/php.d/mysqli.ini, /etc/php.d/mysql.ini, /etc/php.d/odbc.ini
PHP API 				20031224
PHP Extension 				20041030
Zend Extension 				220040412
Debug Build 				no
Thread Safety 				disabled
IPv6 Support 				enabled

--- MySql ---
MySQL Support				enabled
Active Persistent Links 		0
Active Links 				0
Client API version 			4.1.20
MYSQL_MODULE_TYPE 			external
MYSQL_SOCKET 				/var/lib/mysql/mysql.sock
MYSQL_INCLUDE 				-I/usr/include/mysql
MYSQL_LIBS 				-L/usr/lib/mysql -lmysqlclient
It looks like it is parsing the mysql.ini file which only contains 1 line:
extension=mysql.so
which is located in
/usr/lib/php/modules/mysql.so
which seems to be correct since the extension directory is listed as:
extension_dir /usr/lib/php/modules/

But still... "without-mysql" looms...
 
ok, I just tried phpmyadmin which seems to work fine... I guess you can have "without-mysql" listed in the phpinfo() output but still have php work with mysql?
 
Sounds like you've got the MySQL.com rpms mixed in on the system. I'll bet if you do rpm -qa |grep -i mysql you'll see some packages in there labeled MySQL-<something>. Also you dont want to mix up "yum install" with "yum update". You use an install when a package doesn't exist on the system, for example if you don't have spamassassin, yum install spamassassin. You're trying to upgrade an existing package, so you want to use "yum upgrade".
 
rpm -qa |grep -i mysql
MySQL-shared-compat-4.1.20-0
perl-DBD-MySQL-2.1021-3
MySQL-server-4.1.20-0
php-mysql-5.0.4-13.rhel3.art
MySQL-client-4.1.20-0

Looks ok, I think
 
Yep you've got the mysql.com packages mixed in there all right. Since those packages aren't under my control, I can't really help you much on integration with them.
 
Back
Top