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.



This entry was posted in Programming, Server Setup, Tech Ed, Web Development and tagged , , , , , . Bookmark the permalink.

31 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. Pingback: How I updated PHP & MySQL on RedHat Enterprise Linux (RHEL) 5.3 « Binit Bhatia Geeking with Technology

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

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

  13. Dan says:

    Yea that did it. Thanks alot.

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

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

  16. Tim says:

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

  17. timt881 says:

    you’ll have to uninstall the old el5 rpms.

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

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

  20. timt881 says:

    Actually its not really a problem… You left off the ‘m’ at the end of the url. its a .rpm file. Fix that and you should be good.

    For clarification the full url is…

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

  21. The Squad says:

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

  22. Amy says:

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

  23. Joseph 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?

  24. Tim Tutt says:

    Missing an ‘m’ at the end of your filename. Line should be wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-2.noarch.rpm

    Sorry if this was an error in the post, checking now to update!

  25. Simon 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?

  26. Jonathan 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?

  27. Eric says:

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

  28. Tim Tutt says:

    I assume you just mean something like yum –update?

  29. Pingback: Tweets that mention Installing phpmyadmin and PHP 5.2.* on a Centos 5.2 Server (updated) - Tech From Tech -- Topsy.com

  30. marc says:

    getting transaction check errors when do the process above on a 64 bit system with the url changed to match the version and 64 bit release. Should I try uninstalling mysql?

    Transaction Check Error:
    file /etc/my.cnf from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/charsets/cp1250.xml from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/czech/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/danish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/dutch/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/english/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/estonian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/french/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/german/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/greek/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/italian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/japanese/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/korean/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/polish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/romanian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/russian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/serbian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/slovak/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.x86_64
    file /etc/my.cnf from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/charsets/Index.xml from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/charsets/cp1250.xml from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/czech/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/danish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/dutch/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/english/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/estonian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/french/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/german/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/greek/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/hungarian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/italian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/japanese/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/korean/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/norwegian-ny/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/norwegian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/polish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/portuguese/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/romanian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/russian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/serbian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/slovak/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/spanish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/swedish/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386
    file /usr/share/mysql/ukrainian/errmsg.sys from install of mysql-libs-5.1.52-1.el5.remi.x86_64 conflicts with file from package mysql-5.0.77-4.el5_5.4.i386

    Error Summary
    ————-

  31. Amroe says:

    I have an error message :
    Error: Missing Dependency: libldap-2.3.so.0 is needed by package php-ldap
    Error: Missing Dependency: liblber-2.3.so.0 is needed by package php-ldap

    Before it, I’m using command :
    rpm -Uvh remi-release-5-7.el5.remi.noarch.rpm epel-release-5-4.noarch.rpm

    How do we fix this?
    Thank you in advance…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>