I’ve finally figured out a way to install PHP 5.2.x instead of PHP 5.1 which installs on CentOS 5.3 by default. I’ve wanted to use phpMyAdmin 3.x but could not because of this. Now I can, and if you keep reading you will too. Note if you follow this how-to and do everything correctly you won’t even loose your current database. But I highly recommend you backup your database before you proceed.
## Lets remove old MySQL 5, will install newer version later.
yum remove mysql
## Now lets install them:
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm
## OK, Now you should be able to install PHP 5.2.9 without a problem =)
yum –enablerepo=remi update php-cli
yum –enablerepo=remi update php*
## Now install MySQL
yum –enablerepo=remi install mysql mysql-server
chkconfig -levels 235 mysqld on
service mysqld start
If you get the following error when you try starting newly installed MySQL;
shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
## Now install PHP-MySQL module
yum –enablerepo=remi install php-mysql
1. Try restarting your web server;
service lighttpd restart
service httpd restart
2. Type this command:
3. Restart your mysql server;
service mysqld restart
## Set root and hostname passwords
mysqladmin -u root password ‘new_pass_here’
mysqladmin -h server.yourdomain.com -u root password ‘new_pass_here’
When it asks you to import signature, do it. press y and hit enter. It should ask you twice.
I use the first one because I don’t have Apache Web Server, I use LightTPD.
## Now run update on your system.
yum –enablerepo=remi update