About Linux FAQ

Browse More FAQs:

PHP Linux installation or php upgrade howto

Posted by Vivek Gite [Last updated: December 12, 2006]

Q. How do I install PHP under Red Hat enterprise Linux?

A. PHP (Hypertext Preprocesso) is a server-side web programming language that you can embed into HTML pages. When a user accesses a PHP-based page, PHP dynamically creates a web page that is then passed to the browser.

PHP works with Apache, Lighttpd and other webservers. PHP offers built-in database integration for several commercial and non-commercial database management systems. It also has the ability to perform many useful Web-related tasks using a large set of built-in functions.

PHP generally runs on a web server, taking PHP code as its input and creating Web pages as output, but command-line scripting and client-side GUI applications are part of the three primary uses of PHP as well. PHP can be deployed on any web server and on almost every OS platform free of charge.

Installing PHP is easy these days.

Red Hat enterprise Linux PHP installation

If you would like to install or upgrade PHP use up2date command:
# up2date php

CentOS/Fedora core Linux PHP installation

If you would like to install PHP use yum command
# yum install php

If you would like to upgrade PHP use yum command
# yum update php

Debian / Ubentu Linux PHP installation

If you would like to install or upgrade PHP use atp-get command
# apt-get install php4-cgi php4-cli
# sudo apt-get install php4-cgi php4-cli

To install PHP 5
# apt-get install php5-cgi php5-cli
# sudo apt-get install php5-cgi php5-cli

FreeBSD PHP installation

Use pkg_add command as follows:
# pkg_add -v -r php

Use above command to install Apache or Lighttpd web server.

Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.

Related Other Helpful FAQs:

Discussion on This FAQ

  1. Mohan Says:

    Can you please provide the detailed step by step process for Upgrading the PHP4 to PHP 5.?

    Also the system requirements for this like Zend Engine, Apache server version required or MySQL version required ?

  2. nixcraft Says:

    Just run up2dat/yum or apt-get command to update version. If you need more help join our forum

  3. Naresh Khokhaneshiya Says:

    Hello there,
    Actually when I run ‘yum update php’ on CentOS 5, it does not update the php to the latest version of 5.2.3 and remains to version 5.1.6 only and says that it can not find any updates.
    Anything am I missing?
    Regards,
    Naresh Khokhaneshiya

  4. vivek Says:

    Naresh,

    5.1.6 is latest and stable for RHEL / CentOS. PHP 5.2.3 won’t be available for CentOS 5.0. You have to wait or compile from source code.

  5. Mars Says:

    I to in a way have the same problem as Naresh
    however a little defferant. I have version 5.1.6
    and am trying to install ffmpeg.php it needs the comand phpize to be ran and there is no sush program on my server !
    which phpize / it says none
    Why would this not get installed with my version of php (any ideas ?) Also if you have any thoughts as to how I can install this please let me no. I realy do not want to have to reinstall php or upgrade.
    have you hurd of a patch for this or something?

    Thanks Mars

  6. vivek Says:

    Mars,

    Install php-devel package to get phpize binary:
    yum install php-devel

  7. John Says:

    Hi,

    Thanks for your guide. I ran the update command using yum and my PHP was updating to a version of Nov 2005. My system is Redhat. Can you tell me how to upgrade to the latest PHP version? Do I have to first uninstall the old version or something?

    Thanks

  8. vivek Says:

    John,

    If you are using RHEL 4, there is no offical PHP 5 exists. Redhat only provides updates for RHEL 4. I strongly recommend to update your box to RHEL 5.x

  9. Marlin Says:

    HEllo all
    I ran this and it installed the phpize
    Install php-devel package to get phpize binary:
    yum install php-devel

    However now when i try to use phpize it says?
    make sure you run ‘usr/bin/phpize’ in the top level source directory of the module

    I have looked everywhere on the net and there is no help on this that i could find. Do you have any thoughts on what this means?

    Thank You

  10. Photos China Says:

    I tryed the command on Ubuntu:
    sudo apt-get install php5-cgi php5-cli

    Ant it installed the version 5.2.3 of php but the last version is 5.2.6.

    It’s not so important, but how upgrade to the last version using apt-get ?

    Thanks for this post

Leave a Reply

We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!

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

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Click to hear an audio file of the anti-spam word

Copyright © 2006-2008 nixCraft. All rights reserved - TOS/Disclaimer - Privacy policy - Sitemap - Powered by Open source software.