All posts

Install or update PHP 5 on Centos

I tried compiling PHP 5.2 on CentOS but after so many tries I gave up. I was getting struck at compiling PHP with gd. And without gd it was useless. So I decided to yum and install the same.

By default if you use yum install php it will be install only php 4 series and not 5. In order to install version 5 I had to enable repo centosplus.

yum install php --enablerepo=centosplus

or

yum update php --enablerepo=centosplus

I came across another interesting repo for yum by kbsingh and after installing I was able to install a lot more. If you are interested please check out this website

http://centos.karan.org/

Have fun !! ;-)

Category

Discussion

33 comments

  1. Arun VIjayan
    thanks. that really worked!
  2. jack
    i keep getting this error: Excluding packages in global exclude list any one know why that is?
  3. codesmith
    BTW this as of November 2007 only PHP 5.1.6 is included in the centosplus repository, not PHP 5.2
  4. joe
    i am working with centos5. And I did not get any errors this are the steps I used # wget ftp://xmlsoft.org/libxml2/libxml2-2.6.11.tar.gz # tar xzvf libxml2-2.6.11.tar.gz # cd libxml2-2.6.11 # ./configure # make # su -c "make install" # wget http://uk2.php.net/get/php-5.2.5.tar.gz/from/uk.php.net/mirror # tar zxvf php-5.2.5.tar.gz # cd php-5.2.5 # ./configure --enable-soap # make # su -c "make install" I hope it helps u
  5. zahid
    it solved my problem. i was configuring php before xml installing and the word enable-soap solved it.
  6. aoddy
    Thanks for your guide. :D
  7. John
    Thanks for the guide: I installed as per Joe said above, using the latest releases. Install seemed to go OK, but if I check phpinfo, it still says 5.1.6! Any ideas please?
  8. William
    to Joe: why do you use '-enable-soap' as the configure options? If you configure in this way, the upgrade will be really different as the CentOS 5's default configure for php 5.1.6.
  9. Darren
    Thanks for this, it worked and my PHP version is upgraded but it's still 5.1 not 5.2. Any ideas how to get 5.2?
  10. Karanbir Singh
    If you want to get PHP-5.2 on CentOS-5, you really should be looking at using the php-5.2 hosted in the c5-testing repository at the moment ( those packages will get moved into the CentOS-5 Plus repo in the next few weeks ) - but for the time being look at http://wiki.centos.org/Repositories for info on howto get the c5-testing repo setup on your machine and use the php-5.2 from there. Hope this helps.
  11. Tyger
    Well i found the problem with Joe's way php when you do make install moves all to /usr/local and httpd looks for php in /usr
  12. sudopeople
    for the copy/pasters (like myself) there are two dashes (--) before eneablerepo=centosplus yum update php --enablerepo=centosplus
  13. ruX
    fantastics! it's really works on my vps! thanks a lot!
  14. Brent
    Modified it a bit for the latest versions (as of 3/17/09) # wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz # tar xzvf libxml2-2.7.3.tar.gz # cd libxml2-2.7.3 # ./configure # make # su -c “make install” # wget http://uk2.php.net/get/php-5.2.9.tar.gz/from/uk.php.net/mirror # tar zxvf php-5.2.9.tar.gz # cd php-5.2.9 # ./configure –enable-soap # make # su -c “make install”
  15. Aaron
    Thanks Brent.
  16. fishi
    yeah! that works!!! thanks a lot!
  17. Stephan
    @Brent: Do i need to uninstall the php that i installed by 'Yum install php'? And which packages do I need to use the 'make' command?
  18. ImthiazAuthor
    @Stephan (#comment-30068) If you want to compile PHP you might have to install gcc and all its dependencies yum install gcc gcc-c++ kernel-devel If you want to compile you don't have to uninstall it. You can compile php to another custom location in configure ./configure --prefix=/usr/local/php5.2.8
  19. webshop
    I have a Centos install that just keep giving "Error: Missing Dependency: php <= 4.4.0 is needed by package php-sqlite2" when i try to install ?? can anyone help me out ?
  20. Webshop
    I figured it out it was caused by my Plesk install which holds a different Mysql server package ... reinstalled Plesk PHP en Mysql al together and it works :)
  21. Jamie
    @Brent (#comment-29226) Bret, I just ran a yum update php on a centos, it didnt update from 5.2.8 to 5.2.9, do I need to follow your instructions to do this? Any reason why it wouldnt just update? # wget http://uk2.php.net/get/php-5.2.9.tar.gz/from/uk.php.net/mirror # tar zxvf php-5.2.9.tar.gz # cd php-5.2.9 # ./configure –enable-soap # make # su -c “make install” Let me know Jamie
  22. Jamie
    @Jamie (#comment-30494) Sorry Brent, not Bret.
  23. Elixir
    any one help me how to install smarty in CentOS-5
  24. Elixir
    please help me the command for install and uninstall of Smarty in CentOS-5
  25. Lee
    @Brent (#comment-29226) to Brent: I followed what you did. However, the phpinfo still show old version.
  26. kazem
    @scoff (#comment-28316) You da man. Thank you.
  27. pachimon
    Hello, I'm I have also re-compiled php and restarted the server. phpinfo still shows the old version?? on the command line show the correct version though # php -v PHP 5.2.10 (cli) (built: Sep 14 2009 06:51:48) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies anyone can help or shed some light pls.
    mshonda
    Just try to logout, log in again. Worked for me!
    mike
    Hi pachimon, I too faced the same problem. command line shows it 5.2.4 while phpinfo() shows it as 5.2.9 I restarted apache many times and also logged out and logged in. But no luck. were you able to fix it? Thanks Mike
  28. Urban
    tnx man :)
  29. William
    I used the method from http://www.atomicorp.com/wiki/index.php/PHP to upgrade my php on centOS 5 to php version 5.2.12, it seems working fine, but a lot of modules are missing (exactly 4 from the error warning): PHP Warning: PHP Startup: fileinfo: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 [05-Feb-2010 11:12:14] PHP Warning: PHP Startup: mcrypt: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 [05-Feb-2010 11:12:14] PHP Warning: PHP Startup: memcache: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0 [05-Feb-2010 11:12:14] PHP Warning: PHP Startup: mssql: Unable to initialize module Module compiled with module API=20050922, debug=0, thread-safety=0 PHP compiled with module API=20060613, debug=0, thread-safety=0 These options need to match in Unknown on line 0
  30. Dnver Leo
    Muy buen aporte al menos instalo todo pero en el php (5.3.1) em salio una observacion: PEAR package PHP_Archive not installed: generated phar will require PHP's phar extension be enabled. ocasionara algun tipo de problema con el PEAR Espero sus rptas.