Lunarpages Web Hosting Forum

Author Topic: How to upgrade from PHP 4 to PHP 5  (Read 3779 times)

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
How to upgrade from PHP 4 to PHP 5
« on: July 02, 2008, 08:39:40 AM »
I recently upgraded from a shared hosting plan to a VPN plan.  Currently the server is running php 4.3.9.  I need to update it to version 5.2.  How do I do this?

Offline perestrelka

  • Master Jedi
  • *****
  • Posts: 1397
Re: How to upgrade from PHP 4 to PHP 5
« Reply #1 on: July 03, 2008, 03:23:27 AM »
Hi,

I would recommend to make it through RPM. All the command below should be run as root when you are logged into the serer by SSH. First, setup yum using instructions from http://www.lunarforums.com/lunarpages_vps_hosting/how_do_i_setup_my_vps_server-t41213.0.html.

Then run

Code: [Select]
yum remove "php*
to remove old php packages.

After that, add a custom repository with latest Apache, MySQL and PHP packages using instructions at http://www.jasonlitka.com/yum-repository/. Now you can use "yum install" to add needed PHP5 packages.


Kind Regards,
Vlad Artamonov

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
Re: How to upgrade from PHP 4 to PHP 5
« Reply #2 on: July 03, 2008, 11:10:11 AM »
Ok so I started on the instructions on the "How to set  up my server"http://www.lunarforums.com/lunarpages_vps_hosting/how_do_i_setup_my_vps_server-t41213.0.html page

I ran the following.

Quote
############################
# install yum:
############################
rpm -ihv --nodeps http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm
rpm -ihv --nodeps http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm
rpm -ihv --nodeps http://mirror.centos.org/centos-4/4/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm
yum makecache

###########################
# enable centosplus
###########################
   vim /etc/yum.repos.d/CentOS-Base.repo
   enabled=1

###########################
# install gcc
###########################
yum remove glibc-dummy-centos-4
yum install gcc
yum install gcc-c++

###########################
# upgrade httpd from 2.0.52 -> 2.0.59, php5 mysql5
###########################
yum update httpd
yum update php
yum install httpd-devel  # this is needed for compile apache modle

All that seemed to go ok except 1 error message that showed up several times.

Quote
Warning, could not load sqlite, falling back to pickle


Then I ran your code.

Quote
yum remove "php*
and nothing happened....

Quote
[root@vps ~]# yum remove "php*   
>
>

I then tried.

Quote
/sbin/service httpd restart
and got

Quote
Stopping httpd:                                            [FAILED]
Starting httpd: no listening sockets available, shutting down
Unable to open logs
                                                           [FAILED]


What did I do wrong?  How do I fix it?

Offline Vitalian

  • Spaceship Navigator
  • *****
  • Posts: 75
Re: How to upgrade from PHP 4 to PHP 5
« Reply #3 on: July 03, 2008, 11:24:58 AM »
Are you running httpd as the proper user? The user you are running httpd from does not seem to have permission to write to the log files or open sockets.

Offline perestrelka

  • Master Jedi
  • *****
  • Posts: 1397
Re: How to upgrade from PHP 4 to PHP 5
« Reply #4 on: July 03, 2008, 10:12:05 PM »

What is said in the error logs from the Apache located at /var/log/httpd/error_log?
Kind Regards,
Vlad Artamonov

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
Re: How to upgrade from PHP 4 to PHP 5
« Reply #5 on: July 07, 2008, 03:10:44 AM »
Here are the last few lines.

Quote

[Wed Jul 02 07:38:24 2008] [notice] Graceful restart requested, doing restart
[Wed Jul 02 07:38:24 2008] [notice] Digest: generating secret for digest authentication ...
[Wed Jul 02 07:38:24 2008] [notice] Digest: done
[Wed Jul 02 07:38:24 2008] [notice] LDAP: Built with OpenLDAP LDAP SDK
[Wed Jul 02 07:38:24 2008] [notice] LDAP: SSL support unavailable
PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/pgsql.so' - libpq.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
[Wed Jul 02 07:38:24 2008] [notice] mod_python: Creating 4 session mutexes based on 10 max processes and 0 max threads.
[Wed Jul 02 07:38:24 2008] [warn] RSA server certificate CommonName (CN) `plesk' does NOT match server name!?
[Wed Jul 02 07:38:24 2008] [warn] RSA server certificate CommonName (CN) `plesk' does NOT match server name!?
[Wed Jul 02 07:38:24 2008] [notice] Apache/2.0.52 (CentOS) configured -- resuming normal operations
[Wed Jul 02 10:17:52 2008] [notice] caught SIGTERM, shutting down

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
Re: How to upgrade from PHP 4 to PHP 5
« Reply #6 on: July 07, 2008, 03:43:03 AM »
This morning I decided to attempt to uninstall httpd and reinstall it to see if that would fix the httpd error.

I added http://www.jasonlitka.com/yum-repository/ to yum and then I ran:

Quote


yum remove httpd

yum install httpd
yum install php


those went fine but then I tried to run
Quote
yum install mysql

and got an error
Quote
Error: Missing Dependency: libmysqlclient.so.14(libmysqlclient_14) is needed by package psa-courier-imap-add

then I ran

Quote
service httpd start

and got
Quote
Starting httpd: [Mon Jul 07 04:31:59 2008] [warn] NameVirtualHost 74.50.25.47:443 has no VirtualHosts
                                                           [  OK  ]

I then checked to see if all was working.  And now apache is seems to be working.  But php is not.  Also the only page on pdesk that is working is the Virtuozzo section.   I'm just digging myself deeper and deeper...
« Last Edit: July 07, 2008, 04:37:39 AM by wheaton »

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
Re: How to upgrade from PHP 4 to PHP 5
« Reply #7 on: July 07, 2008, 04:07:53 AM »
Ok upon further testing.

if I go to my IP address via a web browser

http://74.50.25.47/

apache and php are working. 

But if I go to one of the domains that I that I set up with plesk before trying to upgrade php
http://gb-beta3.com/

it is not working.

Also as I said before the only page on plesk that is working is the Virtuozzo section.

Offline JeremyD

  • SleePy...
  • Jabba the Hutt
  • *****
  • Posts: 733
  • SMF Team Member
    • LcT Tribe
Re: How to upgrade from PHP 4 to PHP 5
« Reply #8 on: July 07, 2008, 02:53:38 PM »
Your last two lines of the error log show that it was up and running for about 3 hours before it caught a signal to terminate itself..


Code: [Select]
PHP Warning:  Unknown(): Unable to load dynamic library '/usr/lib/php4/pgsql.so' - libpq.so.3: cannot open shared object file: No such file or directory in Unknown on line 0
Thats most likely the issue. Postgresql isn't being built for php4.
Do you need Postgresql? if you don't you could just disable the option.

I may be wrong, but i think you need to do a mysql-clieent install first.

I found this on another forum:
Code: [Select]
yum install mysql-devel

yum install mysql-server
yum install php-mysql
yum install mysql-client
yum install mysql-debug
yum install mysql-bench

http://www.linuxforums.org/forum/servers/59648-mysql-server-problem.html

I don't think they mean for you to install all of them? but yea. Try to do a mysql-client first and then try the regular mysql or just a mysql-server


Do you have cpanel at all? If you have cpanel and can access whm you can use easy apache (also via command line with /scripts/easyapache I believe) to do this very easily and it will get all dependencies it needs.

Offline wheaton

  • Trekkie
  • **
  • Posts: 15
Re: How to upgrade from PHP 4 to PHP 5
« Reply #9 on: July 08, 2008, 06:48:29 AM »
I submitted a ticket.

Their recommendation was to reinstall the VPS to fix what ever I had broken and then run the following to update to current version of php.

Quote
rpm -ivh http://www.atomicorp.com/channels/atomic/centos/4/i386/RPMS/atomic-release-1.0-4.el4.art.noarch.rpm
rpm --nodeps -e php-domxml
yum update php*
yum update mysql*
yum install php-xml

And it worked perfectly.....