Installing phpmyadmin and PHP 5.2.* on a Centos 5.2 Server (updated)

So I spent the better part of last night (12-3:30am) trying to figure out just exactly how to get phpmyadmin installed on my Centos 5.2 Server. Now, I’m no dummy when it comes to linux, package management etc… But this was a task which apparently many other people have had trouble with. I finally gave up on it and went to bed, woke up this morning and went back to it… At which point I actually figured everything out and now have PHP 5.2.8 installed working with phpmyadmin 3.1.2 (which to day, all the most recent stuff) using mysql-server 5.1.31.

So here’s how I did it: Apparently the repositories that Centos 5.2 uses by default still have php 5.1.* so you can just do a yum update or yum install php. The first step here is to set up the Remi repository. He maintains a repository that has the most up to date version oh php and all of its extensions. You can set this up by doing the following:

$ wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

$ wget http://rpms.famillecollet.com/el5.i386/remi-release-5-7.el5.remi.noarch.rpm

$ rpm -Uvh remi-release-5-7.el5.remi.noarch.rpm epel-release-5.3.noarch.rpm

This will set up the Remi repository for yum. By default it is disabled so you’ll have to use the –enablerepo option with yum when you are using it to install or update anything. So in order to update to php 5.2.* you just say:

$ yum –enablerepo=remi install php

To verify that you have php 5.2.8 installed issue a

$ php -v

And you’ll get a response like:

PHP 5.2.8 (cli) (built: Dec  9 2008 14:11:33)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

At this point I assume you already have mysql and mysql-server installed and configured. If not just issue:

$ yum –enablerepo=remi install mysql-server

It will install all of the necessary dependencies including mysql. Configuring mysql server using mysqladmin is actually out of the scope of this but there are plenty of tutorials online for that. Make sure you set up your   and passwords for accessing it otherwise you’ll have issues later.

Now, you’ll want to install php-mysql. Again use the remi repository for this, otherwise you’ll end up with tons and tons of dependency issues. Trust me, I learned this the hard way…

$ yum –enablerepo=remi install php-mysql

This will install the mysql.so module for you and add it to php.ini so you don’t need to add the extension=mysql.so. It does the same for mysqli.

So now you’ve got everything you need set up properly, so install phpmyadmin. Get the tar ball from the server, extract it somewhere in your htdocs folder, create a system link called phpmyadmin.  Go into the phpmyadmin and create a folder called config. Issue:

$ chmod o+rw config

Now because you’ve already set everything else up, you won’t receive the errors that I got on my first attempts. Now go to http:/www.yoursite.com/phpmyadmin/setup and follow the steps there. It’s a very nice little graphical interface that helps you set the configuration file. After this is done, move the config.inc.php file in the config directory to the head of the phpmyadmin directory. Then remove the permissions you set before:

$ chmod o-rw config

That’s it. Now you can go to http://www.yoursite.com/phpmyadmin and log in using your credentials for mysql-server.

Hope this saves everyone from running into all of the issues I had.



23 Responses to Installing phpmyadmin and PHP 5.2.* on a Centos 5.2 Server (updated)

  1. John Van Haastert says:

    Worked like a charm and thanks I have been at it for a while and this saved me a ton of time. Awesome!

  2. John Van Haastert says:

    Having a difficult time with mcrypt extension. Did you have this problem?

  3. Tim says:

    I installed it using the remi repository as well. Have you attempted that yet?

  4. John Van Haastert says:

    Can not load mcrypt extension. Please check your PHP Configuration.

    libmcrypt.i386 2.5.8-4.el5.centos installed
    mcrypt.i386 2.6.8-1.el5 installed

    php.i386 5.2.8-1.el5.remi installed
    php-cli.i386 5.2.8-1.el5.remi installed
    php-common.i386 5.2.8-1.el5.remi installed
    php-devel.i386 5.2.8-1.el5.remi installed
    php-gd.i386 5.2.8-1.el5.remi installed
    php-imap.i386 5.2.8-1.el5.remi installed
    php-ldap.i386 5.2.8-1.el5.remi installed
    php-mbstring.i386 5.2.8-1.el5.remi installed
    php-mysql.i386 5.2.8-1.el5.remi installed
    php-odbc.i386 5.2.8-1.el5.remi installed
    php-pdo.i386 5.2.8-1.el5.remi installed
    php-pear.noarch 1:1.4.9-4.el5.1 installed
    php-xml.i386 5.2.8-1.el5.remi installed
    php-xmlrpc.i386 5.2.8-1.el5.remi installed

  5. Tim says:

    Have you checked your php.ini configuration to see that mcrypt is being loaded. Then restart httpd.

  6. John Van Haastert says:

    There is no entry in /etc/php.ini for mcrypt. Do you have the syntax in your php.ini file?

  7. Tim says:

    Just add the line:

    extension=mcrypt.so

    To your /etc/php.ini file and it should work fine. You may need to restart httpd.

  8. TRUNASUCI says:

    I do have the mcrypt problem..
    after long search, I try to install this and it worked!!

    [root@localhost etc]# yum –enablerepo=remi install php-mcrypt
    Setting up Install Process
    Parsing package install arguments
    Resolving Dependencies
    –> Running transaction check
    —> Package php-mcrypt.i386 0:5.2.8-1.el5.remi set to be updated
    –> Finished Dependency Resolution

    Dependencies Resolved

    =============================================================================
    Package Arch Version Repository Size
    =============================================================================
    Installing:
    php-mcrypt i386 5.2.8-1.el5.remi remi 29 k

    Transaction Summary
    =============================================================================
    Install 1 Package(s)
    Update 0 Package(s)
    Remove 0 Package(s)

    Total download size: 29 k
    Is this ok [y/N]: y
    Downloading Packages:
    (1/1): php-mcrypt-5.2.8-1 100% |=========================| 29 kB 00:00
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing: php-mcrypt ######################### [1/1]

    Installed: php-mcrypt.i386 0:5.2.8-1.el5.remi
    Complete!
    [root@localhost etc]# service httpd restart
    Stopping httpd: [ OK ]
    Starting httpd: [ OK ]

    anyone who got this probs, just do this and give your feedback here!

    i solve this within 10 mins…

  9. John Van Haastert says:

    Thanks that worked. I installed “mcrypt” instead of “php-mcrypt”;(.

    yum list installed | grep mcrypt

    libmcrypt.i386 2.5.8-4.el5.centos installed
    mcrypt.i386 2.6.8-1.el5 installed
    php-mcrypt.i386 5.2.9-1.el5.remi installed

    yum list installed | grep php

    php.i386 5.2.9-1.el5.remi installed
    php-cli.i386 5.2.9-1.el5.remi installed
    php-common.i386 5.2.9-1.el5.remi installed
    php-devel.i386 5.2.9-1.el5.remi installed
    php-gd.i386 5.2.9-1.el5.remi installed
    php-imap.i386 5.2.9-1.el5.remi installed
    php-ldap.i386 5.2.9-1.el5.remi installed
    php-mbstring.i386 5.2.9-1.el5.remi installed
    php-mcrypt.i386 5.2.9-1.el5.remi installed
    php-mysql.i386 5.2.9-1.el5.remi installed
    php-odbc.i386 5.2.9-1.el5.remi installed
    php-pdo.i386 5.2.9-1.el5.remi installed
    php-pear.noarch 1:1.4.9-4.el5.1 installed
    php-xml.i386 5.2.9-1.el5.remi installed
    php-xmlrpc.i386 5.2.9-1.el5.remi installed

  10. Dan says:

    Yea this doesn’t work for me.

    I have the exact same problem, but I’m getting this output (php remains as 5.1.6 from 2006):

    Transaction Check Error:
    file /etc/my.cnf from install of mysql-libs-5.1.32-1.el5.remi conflicts with file from package mysql-5.0.45-7.el5

    • timt881 says:

      Remove all of your current php related packages including php itself, then use the steps listed above. You’re getting conflicts because of previously installed packages.

  11. Dan says:

    Yea that did it. Thanks alot.

  12. ken says:

    except that removing the php packages will not clean it up. I have the same error. removed php and now I’m stuck in an odd state.

  13. Dan says:

    Wow I’ve found myself referring to this page a lot while setting up my new lamp server. Thanks so much for writing this.

  14. Tim says:

    Can you do the equivalent of –replacefiles in rpm with yum? Or do I have to uninstall the old el5 rpms?

  15. Dan says:

    This repository installs MySQL 5.1.32. I’m having a great deal of trouble transferring my stored routines from a production server running 5.0.67. I wonder if anyone has been able to successfully use stored procedures with this installation?

  16. steward says:

    wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rp
    –14:19:10– http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rp
    Resolving download.fedora.redhat.com… 209.132.176.221, 209.132.176.20, 209.132.176.220
    Connecting to download.fedora.redhat.com|209.132.176.221|:80… connected.
    HTTP request sent, awaiting response… 404 Not Found
    14:19:10 ERROR 404: Not Found.

    … so much for Step One.
    Is this a temporary problem I wonder?

  17. The Squad says:

    Great Tutorial. I have another method to install phpmyadmin from the newest version at sourceforge on my site.

  18. G33k2 says:

    I was SO excited when I finally started making progress and then I ran into the mcrypt issue. I have tried everything suggested here, as well as the yum-utils suggested below…

    [root@localhost phpmyadmin]# yum install php-mcrypt
    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
    * addons: mirror.cogentco.com
    * base: mirror.anl.gov
    * centosplus: yum.singlehop.com
    * epel: mirror.vcu.edu
    * extras: yum.singlehop.com
    * remi: rpms.famillecollet.com
    * rpmforge: fr2.rpmfind.net
    * updates: pubmirrors.reflected.net
    3788 packages excluded due to repository priority protections
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package php-mcrypt.x86_64 0:5.1.6-15.el5.centos.1 set to be updated
    –> Processing Dependency: php-api = 20041225 for package: php-mcrypt
    –> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt
    –> Running transaction check
    —> Package libmcrypt.x86_64 0:2.5.8-4.el5.centos set to be updated
    —> Package php-mcrypt.x86_64 0:5.1.6-15.el5.centos.1 set to be updated
    –> Processing Dependency: php-api = 20041225 for package: php-mcrypt
    –> Finished Dependency Resolution
    php-mcrypt-5.1.6-15.el5.centos.1.x86_64 from extras has depsolving problems
    –> Missing Dependency: php-api = 20041225 is needed by package php-mcrypt-5.1.6-15.el5.centos.1.x86_64 (extras)
    Error: Missing Dependency: php-api = 20041225 is needed by package php-mcrypt-5.1.6-15.el5.centos.1.x86_64 (extras)
    You could try using –skip-broken to work around the problem
    You could try running: package-cleanup –problems
    package-cleanup –dupes
    rpm -Va –nofiles –nodigest
    [root@localhost phpmyadmin]#

    I imagine I am having trouble due to something that has changed in the repos since these previous posts.

    Any suggestions?

    Thanks!

    • timt881 says:

      Since the original writing of this article, those repos have been updated… Please refer to this same article at http://www.timtutt.com for a more updated copy. If that doesn’t help, feel free to touch base again and I’ll get back to you and see if I can help.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: