Install Apache, MySQL 8 or MariaDB 10 and PHP 7 on CentOS 7

This how-to guide explains how to install the latest version of the Apache, MySQL 8 or MariaDB 10 and PHP 7 along with the required PHP modules on RHEL / CentOS 7/6 and Fedora 24-29.

This combination of the operating system (Linux) with the web server (Apache), database server (MariaDB/MySQL) and server-side scripting language (PHP) is known as the LAMP stack.

Don’t Miss: How to Install Nginx 1.15, MariaDB 10 and PHP 7 on CentOS 7

Since September 2015, PHP 5.4 is no longer supported by PHP team and it’s reached to end-of-life, still, PHP 5.4 ships with RHEL/CentOS 7/6 with minor version change and Red Hat supports it, so upgrading to a higher version not required. However, it is highly recommended to upgrade your PHP 5.4 to PHP 5.5+ for greater security and performance.

Here is what your current Linux distribution ships with:

PHP Current Version RHEL/CentOS 7 RHEL/CentOS 6
7.3 5.4 5.3

To do this, we will enable the EPEL and Remi repository and use yum and dnf (the new package management tool available in Fedora).

Step 1: Installing EPEL and Remi Repository

EPEL (Extra Packages for Enterprise Linux) is a community based repository offers add-on software packages for RHEL-based Linux distributions.

Remi is a repository where you can find the latest versions of the PHP stack (full featured) for installation in the Fedora and Enterprise Linux distributions.

On RHEL/CentOS 7

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

------ For RHEL 7 Only ------
# subscription-manager repos --enable=rhel-7-server-optional-rpms

On RHEL/CentOS 6

# yum update && yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

------ For RHEL 6 Only ------
# subscription-manager repos --enable=rhel-6-server-optional-rpms

On Fedora 24-29

# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-29.rpm  [On Fedora 29]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-28.rpm  [On Fedora 28]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-27.rpm  [On Fedora 27]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-26.rpm  [On Fedora 26]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-25.rpm  [On Fedora 25]
# rpm -Uvh http://rpms.remirepo.net/fedora/remi-release-24.rpm  [On Fedora 24]

Step 2: Installing Apache Web Server

Apache is a Free and Open Source HTTP web server that runs on most UNIX-based operating systems as well as on Windows. As such, it can be used to serve static web pages and handle dynamic content. Recent reports show that Apache is the number one server used in websites and Internet-facing computers.

To install Apache web server, first update the system software packages and install it using following commands.

# yum -y update
# yum install httpd

Once Apache web server installed, you can start enable it to auto start at system boot.

# systemctl start httpd
# systemctl enable httpd
# systemctl status httpd

If you are running firewalld, make sure to allow Apache traffic on the firewall.

# firewall-cmd --zone=public --permanent --add-service=http
# firewall-cmd --zone=public --permanent --add-service=https
# firewall-cmd --reload

Step 3: Installing PHP Using Remi Repository

PHP (Hypertext Preprocessor) is a Free and Open Source server-side scripting language that is best suited for web development. It can be used to produce dynamic web pages for a website and is most frequently found in *nix servers. One of the advantages of PHP is that it is easily extensible through the use of a wide variety of modules.

To install PHP, first you need to enable Remi repository by installing yum-utils, a collection of useful programs for managing yum repositories and packages.

# yum install yum-utils

Once installed, you can use yum-config-manager provided by yum-utils to enable Remi repository as the default repository for installing different PHP versions as shown.

For example, to install PHP 7.x version, use the following command.

------------- On CentOS & RHEL ------------- 
# yum-config-manager --enable remi-php70 && yum install php       [Install PHP 7.0]
# yum-config-manager --enable remi-php71 && yum install php       [Install PHP 7.1]
# yum-config-manager --enable remi-php72 && yum install php       [Install PHP 7.2]
# yum-config-manager --enable remi-php73 && yum install php       [Install PHP 7.3]

------------- On Fedora ------------- 
# dnf --enablerepo=remi install php70      [Install PHP 7.0]
# dnf --enablerepo=remi install php71      [Install PHP 7.1]
# dnf --enablerepo=remi install php72      [Install PHP 7.2]
# dnf --enablerepo=remi install php73      [Install PHP 7.3]

Next, we are going to install all these following PHP modules in this article. You can search for more PHP-related modules (perhaps to integrate a specific functionality that your web applications need) with the following command:

------ RHEL/CentOS 7/6------
# yum search all php     

------ Fedora ------
# dnf search all php   

Regardless of the distribution, the above commands return the list of packages in the currently enabled repositories that include the word php in the package name and/or the description.

Here are the packages that we will install. Please keep in mind that MySQL connectors (PHP, Perl, Python, Java, etc.) will work unchanged with MariaDB as both systems use the same client protocol and the client libraries are binary compatible.

  1. MariaDB/MySQL (php-mysql) – a dynamic shared object that will add MariaDB support to PHP.
  2. PostgreSQL (php-pgsql) – PostgreSQL database support for PHP.
  3. MongoDB (php-pecl-mongo) – An interface for communicating with the MongoDB database in PHP.
  4. Generic (php-pdo) – A dynamic shared object that will add a database access abstraction layer to PHP.
  5. Memcache (php-pecl-memcache) – Memcached is a caching daemon designed especially for dynamic web applications to decrease database load by storing objects in memory.
  6. Memcached (php-pecl-memcached) – An extension that uses the libmemcached library to provide API for communicating with memcached servers.
  7. GD (php-gd) – A dynamic share object that adds support for using the gd graphics library to PHP.
  8. XML (php-xml) – A dynamic shared objects that adds support to PHP for manipulating XML documents.
  9. MBString (php-mbstring) – An extension to handle multi-byte string in PHP applications.
  10. MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
  11. APC (php-pecl-apcu) – APC module used to optimize and cache PHP code.
  12. CLI (php-cli) – Command-line interface for PHP.
  13. PEAR (php-pear) – Application Repository framework for PHP.

Install these following necessary PHP modules with the command below.

------ On RHEL/CentOS 7/6 ------
# yum --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear

------ On Fedora ------
# dnf --enablerepo=remi install php-mysqlnd php-pgsql php-pecl-mongo php-pdo php-pecl-memcache php-pecl-memcached php-gd php-xml php-mbstring php-mcrypt php-pecl-apcu php-cli php-pear

Step 4: Installing MySQL or MariaDB Database

In this section, we will show you installation of both databases MySQL and MariaDB, so its up-to you what to choose based on your requirements.

Installing MySQL 8 Database Server

MySQL is one of the world’s most popular open source relational database management system (RDBMS) that runs any server by providing multi-user access to multiple databases. MySQL runs with Apache.

To install latest MySQL 8.0 version, we will install and enable official MySQL Yum software repository using the following commands.

# rpm -Uvh https://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm        [On RHEL/CentOS 7]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-el6-1.noarch.rpm     [On RHEL/CentOS 6]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc29-1.noarch.rpm    [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc28-1.noarch.rpm    [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc27-1.noarch.rpm    [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc26-1.noarch.rpm    [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc25-1.noarch.rpm    [On Fedora 29]
# rpm -Uvh https://dev.mysql.com/get/mysql80-community-release-fc24-1.noarch.rpm    [On Fedora 29]

After installing the MySQL Yum software repository for your Linux platform, now install the latest version of MySQL (currently 8.0) using the following command.

# yum install mysql-community-server      [On RHEL/CentOS]
# dnf install mysql-community-server      [On Fedora]

After successful installation of MySQL, it’s time to start the MySQL server with the following command.

# service mysqld start

Check out our article on how to secure MySQL 8 database installation.

Installing MariaDB 10 Database Server

MariaDB is a fork of the well-known MySQL, one of the world’s most popular Relational Database Management System (RDBMS). It is entirely developed by the community and as such it is intended to remain FOSS and compatible with the GPL.

If you are or have been, a MySQL user, migrating to MariaDB will be a very straightforward process: the popular commands to connect to, backup and restore, and manage databases are identical in both RDBMSs.

In latest RHEL/CentOS 7 distribution, MariaDB is a drop-in replacement for MySQL and in RHEL/CentOS 6 MySQL remains same and you’re not allowed to install MariaDB on RHEL/CentOS 6 from default repository, but you can install MariaDB using official MariaDB repository.

To enable the MariaDB repository on RHEL/CentOS 7 distributions, create a file named /etc/yum.repos.d/mariadb.repo with the following contents:

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Note: As i said above, you can also install MariaDB on RHEL/CentOS 6 using official MariaDB repository as stated above.

After enabling MariaDB repository, then do:

------ On RHEL/CentOS 7 ------
# yum --enablerepo=remi install httpd MariaDB-client MariaDB-server

------ On Fedora ------
# dnf --enablerepo=remi install httpd MariaDB-client MariaDB-server

Step 5: Enable/Start Apache and MySQL/MariaDB

On SystemD

------ Enable Apache and MariaDB on Boot ------
# systemctl enable httpd
# systemctl enable mariadb

------ Start Apache and MariaDB ------
# systemctl start httpd
# systemctl start mariadb

On SysVinit

------ Enable Apache and MySQL on Boot ------
# chkconfig --levels 235 httpd on
# chkconfig --levels 235 mysqld on

------ Start Apache and MySQL ------
# /etc/init.d/httpd start
# /etc/init.d/mysqld start

Step 6: Verifying PHP Instalation

Let’s stick with the classic way of testing PHP. Create a file called test.php under /var/www/html and add the following lines of code to it.

The phpinfo() function shows a great deal of information about the current PHP installation:

<?php
	phpinfo();
?>

Now point your web browser to http://[server]/test.php and check the presence of the installed modules and additional software by scrolling down the page (replace [server] with your domain or the IP address of your server). Your output should be similar to:

Check PHP 7 Info
Check PHP 7 Info

Congratulations! You now have a latest working installation of a LAMP stack. If something did not go as expected, feel free to contact us using the form below. Questions and suggestions are also welcome.

Note: you can also install MariaDB in other distributions by creating a custom repository following the instructions provided here.

Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

197 thoughts on “Install Apache, MySQL 8 or MariaDB 10 and PHP 7 on CentOS 7”

  1. Ravi,

    If am using yum conflict will come, it will install dependency all packages include apache, so am using source file .

    Reply
  2. Thanks for the article, I have using php 5.6 with apache 2.4, i need to install mysqli extension, i have done with below commands.

    $ cd extname
    $ phpize
    $ ./configure
    $ make
    # make install# its seem installed correctly 
    

    and also i have added path in php.ini, but still its not install mysqli, php -i | grep mysqli is given mysqli with details, please help me to do correctly .

    Reply
  3. Pingback: PhpMyAdmin 4.2.2 Released - Install for Apache or Nginx on RHEL/CentOS 6.5/5.9 Fedora 20-12
  4. Pingback: Install Latest Nginx 1.10.1, MariaDB 10 and PHP 5.5/5.6 on RHEL/CentOS 7/6 & Fedora 20-23
  5. Pingback: Install PrestaShop (Free Online Ecommerce Shopping Store) On RHEL/CentOS And Fedora
    • @Victor,

      Have you enabled said Remi repository on the system, before trying to install/update Apache? Which version of Apache, you currently have on the system?

      Reply
  6. I had some issues when i tried to install Apache, Mysql and PHP using this method but now i guess it’s working.

    I would like to know how i could test my webserver ? I’m not using any GUI at my Red Hat Server. I saw you posting to test using 127.0.0.1 . But how could i do that in my pc? I tried to use the server ip address and i don’t have any success. :(

    Could you help me?

    Reply
  7. hi, when I try to create a phpinfo.php and view it from the browser level, i wasn’t able to see the same page as you.
    Instead I am seeing things like

    Reply
  8. Pingback: BEGINNER'S GUIDE FOR LINUX - Start Learning Linux in Minutes
  9. Hi,
    my current version of soft. running on server are –
    1.php – 5.3
    2.mysql-5.1

    I need to upgrade php5.3 to 5.4 but during upgrading one of php module (i.e php-mysql) trying to upgrade my mysql server too as it considering it as its dependency.

    I need to use mysql5.1 with upgraded version of php5.4 and need php-mysql module to have proper communication with them but do not want to upgrade my mysql version.Is it possible?

    Please help.

    Reply
  10. Pingback: 25 Hardening Security Tips for Linux Servers | Mã Nguồn Mở
  11. Hi, I am getting an error while re-installing PHP packages on centos 6.6

    I do have mysql 5.6.12 (server version) and I want to install PHP enbled with mysqli support. Can you please tell me without changing any other configuration how can I get PHP installed with mysqli support.

    Reply
    • @Sneha,
      Could you please tell us what error you getting while re-installing PHP? Could you post that error here, so that we can work around for the solution…

      Reply
  12. Hello,

    I’m trying to setup my server for the latest version of moodle, which has requirements in mysql and php which you have made easy through this tutorial, however while running the install command for apache, mysql ,and php I get the following error:

    Finished Dependency Resolution
    Error: Package: php-common-5.5.15-0.1.RC1.el6.remi.x86_64 (remi-test)
    Requires: php-pecl-zip(x86-64)
    Available: php-common-5.4.33-1.el6.remi.x86_64 (remi)
    php-pecl-zip(x86-64) = 1.11.0
    Available: php-common-5.4.33-2.el6.remi.x86_64 (remi)
    php-pecl-zip(x86-64) = 1.11.0
    Removing: php-common-5.3.3-27.el6_5.1.x86_64 (@rhel-x86_64-server-6)
    Not found
    Updated By: php-common-5.5.15-0.1.RC1.el6.remi.x86_64 (remi-test)
    Not found
    Available: php-common-5.3.2-6.el6.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.2-6.el6_0.1.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-3.el6.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-3.el6_1.3.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-3.el6_2.5.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-3.el6_2.6.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-3.el6_2.8.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-14.el6_3.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-22.el6.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-23.el6_4.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-26.el6.x86_64 (rhel-x86_64-server-6)
    Not found
    Available: php-common-5.3.3-27.el6_5.x86_64 (rhel-x86_64-server-6)
    Not found

    Any Ideas?

    Reply
  13. Hello Ravi Saiveji,
    first of all thanks for the tutorial.I am a regular reader of your website, I learn a lot from it, thanks for your all post.

    Can you give details for BOSS OS and How to install LAMP in BOSS.

    Reply
  14. Hello Mr. Ravi Saive,
    I am a regular reader of your post, I learn a lot from it, thanks for your all post.
    Today I will request you for a topic about Apache & ftp(vsftp or proftp) configuration . Here I am sharing the issue.

    I have 2 sites in same server say site1.abc.com & site2.abc.com. I have 2 developer for each site say user1 & user2.
    Now I need to configure apache & ftp server, so that both developer can upload site contain to there site folder(/var/www/html/site1 & /var/www/html/site2).
    How to configure this type of setting. Hope you understand the issue & will share configuration tips on this. I ma using CentOS 6.5 64 bit Os.

    Reply
    • Dear Ananda,

      Thanks for being regular reader of TecMint.com. After looking into your requirements, I can say first you have to install apache and vsftp. Once these required packages are installed, follow the below configuration steps.

      1. Create two Virtual hosts in apache configuration for both the domains with respective folders. For example,

      /var/www/html/site1
      /var/www/html/site2
      

      For more information about how to create Vhosts, read our following article.

      https://www.tecmint.com/apache-ip-based-and-name-based-virtual-hosting/

      2. Create two FTP users say user1 and user2 with their respective passwords with home directories as site1 and site2.

      3. Now grant permission as owner and group to new Vhosts folders.

      # chown -R user1:user1 /var/www/html/site1
      # chown -R user2:user2 /var/www/html/site2
      

      That’s it now they are able to login to their respective folder and do ftp.

      Reply
  15. Hi Ravi,

    As per your guide am installed apache 2.2.15,now i need upgrade httpd 2.2.10 to 2.4.x in centos 6.5..how can i upgrade…

    Reply
    • I don’t know, actually I haven’t tested yet, but as per your requirement, will try to uprade httpd 2.4.x. Please stay tuned for the update.

      Reply
  16. Hi Ravi,

    Nice article and proper procedure.

    I complected LAMP installation on CentOS6.5 using your article. However I stucked while issuing password. After going through post section I understood where I made mistake.
    My suggestion is you may have to add a step or link to configure MYSQL

    Anyhow wonderful work.

    Reply
  17. Pingback: 25 tips hardening security linux server - idyf.net
  18. Ravi,

    Yesterday, I installed CentOS6.5, clean install, with a LAMP installation with MySQL 5.1 included (misery to upgrade with all those dependencies). This is the first website, where a procedure has been published to smoothly replace the MySQL5.1 with the MySQL5.5 version, including more recent version of PHP and Apache. I followed exactly all the steps that you described, and the result was wonderfull ! Not one error showed up and not one time I had to google to solve an unexpected problem. Thank you very much for this perfect installation procedure, you did a great job, it’s really great !
    Thanks !
    Kind regards,
    Dirk.

    Reply
  19. Ravi,
    Great tutorial. I have followed it all on a brand new CentOS 6 install, but not getting the php pdo for mysql:

    Skipped (dependency problems):

    php-mysql.x86_64 0:5.4.26-1.e16.remi

    a couple of others skipped too, but I’m not worried about them. the PDO driver for mysql is what I need. After first install, phpinfo() showed only pdo for sqlite. After a second install, it had added sqlite2, but still no pdo for mysql.
    What am I missing?
    TIA

    Reply
  20. Hi Ravi

    am fresh to this php i do not know any thing in na dout of this but i tried to do the installation i think i have screws the php in the system its linux box

    pleae if you can help me on this
    how do i clear the existing php and do a clean install

    Thanks
    Nagaraj

    Reply
  21. HI I’m trying to get LAMP configured on Red Hat Linux 5.8 running the following version of php and mysq

    [root@FBDMoodlePRD tmp]# php -v
    PHP 5.3.3 (cli) (built: Dec 5 2013 06:39:35)
    Copyright (c) 1997-2010 The PHP Group
    Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
    [root@FBDMoodlePRD tmp]# mysql -V
    mysql Ver 14.14 Distrib 5.5.36, for Linux (x86_64) using readline 5.1
    [root@FBDMoodlePRD tmp]#

    l’m told I need the PDO drivers enbale for mysqli, see the php-i output below…

    [root@FBDMoodlePRD tmp]# php -i | grep PDO
    PHP Warning: Unknown: It is not safe to rely on the system’s timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected ‘UTC’ for ‘GMT/0.0/no DST’ instead in Unknown on line 0
    PDO
    PDO support => enabled
    PDO drivers => mysql, odbc, pgsql, sqlite
    PDO Driver for MySQL => enabled
    PDO_ODBC
    PDO Driver for ODBC (unixODBC) => enabled
    PDO Driver for PostgreSQL => enabled
    PDO Driver for SQLite 3.x => enabled

    I don’t know how to do it. The developer is running Moodle on the server and he says he needs it… Any ideas ? List of the current php pkg installed via yum

    yum list installed | grep php
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    php-pear.noarch 1:1.4.9-8.el5 installed
    php53.x86_64 5.3.3-22.el5_10 installed
    php53-bcmath.x86_64 5.3.3-22.el5_10 installed
    php53-cli.x86_64 5.3.3-22.el5_10 installed
    php53-common.x86_64 5.3.3-22.el5_10 installed
    php53-dba.x86_64 5.3.3-22.el5_10 installed
    php53-devel.x86_64 5.3.3-22.el5_10 installed
    php53-gd.x86_64 5.3.3-22.el5_10 installed
    php53-imap.x86_64 5.3.3-22.el5_10 installed
    php53-intl.x86_64 5.3.3-22.el5_10 installed
    php53-ldap.x86_64 5.3.3-22.el5_10 installed
    php53-mbstring.x86_64 5.3.3-22.el5_10 installed
    php53-mysql.x86_64 5.3.3-22.el5_10 installed
    php53-odbc.x86_64 5.3.3-22.el5_10 installed
    php53-pdo.x86_64 5.3.3-22.el5_10 installed
    php53-pgsql.x86_64 5.3.3-22.el5_10 installed
    php53-process.x86_64 5.3.3-22.el5_10 installed
    php53-pspell.x86_64 5.3.3-22.el5_10 installed
    php53-snmp.x86_64 5.3.3-22.el5_10 installed
    php53-soap.x86_64 5.3.3-22.el5_10 installed
    php53-xml.x86_64 5.3.3-22.el5_10 installed
    php53-xmlrpc.x86_64 5.3.3-22.el5_10 installed

    Reply
    • Hi,

      I’m tried to install LAMP on RHEL5.8(32 bit) by following the steps.

      Getting the below error if I execute the below command.
      ——————————————————————-
      [root@server1 ~]# yum –enablerepo=remi,remi-test install httpd mysql mysql-server php php-common
      Loaded plugins: katello, product-id, security, subscription-manager
      Updating certificate-based repositories.
      Unable to read consumer identity
      Could not retrieve mirrorlist http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=i386 error was
      [Errno 4] IOError:
      Error: Cannot retrieve repository metadata (repomd.xml) for repository: epel. Please verify its path and try again
      ———————————————————————————-

      Reply
  22. Hi Ravi saive,

    kindly advise about the php,mysql and apache on CentOS 6.3, i already installed those are in the CentOS, and everything’s fine, event the php and mysql, they known each others, i mean those were connectted with the php script connecting the database, but unfortunatelly there are any scripts in my source could not run on the web base, it can only connect the database, but when i used the code to list the record in the database it didn’t me that codes, so could you please advise or send me the email?

    Reply
  23. Excuse me, i forget to traduce, Hi John, I need to enable gd library in Oracle linux server, I have php 5.5.8 and mysql 5.6.15 apache 2.2.3, I can use this repository?

    Reply
  24. Pingback: Tecmint's Biggest Milestones and Achievements in 2013 - Happy New Year 2014
  25. only php 5.3

    =============================================================================================================================
    Package Arch Version Repository Size
    =============================================================================================================================
    Installing:
    php-gd x86_64 5.3.3-27.el6_5 updates 107 k
    php-mbstring x86_64 5.3.3-27.el6_5 updates 455 k
    php-mcrypt x86_64 5.3.3-3.el6 epel 19 k
    php-mysql x86_64 5.3.3-27.el6_5 updates 81 k
    php-pdo x86_64 5.3.3-27.el6_5 updates 75 k
    php-pear noarch 1:1.9.4-4.el6 base 393 k
    php-pecl-apc x86_64 3.1.9-2.el6 base 96 k
    php-pecl-memcache x86_64 3.0.5-4.el6 base 60 k
    php-pecl-memcached x86_64 1.0.0-1.el6 epel 28 k
    php-pecl-mongo x86_64 1.4.4-1.el6 epel 123 k
    php-pgsql x86_64 5.3.3-27.el6_5 updates 70 k
    php-xml x86_64 5.3.3-27.el6_5 updates 103 k
    Installing for dependencies:
    libmcrypt x86_64 2.5.8-9.el6 epel 96 k
    libmemcached x86_64 0.31-1.1.el6 base 80 k
    postgresql-libs x86_64 8.4.18-1.el6_4 base 201 k

    Transaction Summary

    Reply
  26. I have a doubt in Cron jobs. Can we execute a Cron job before system shutdown? I want to execute a Cronjob/script in fedora 18 before it shuts down. Kindly reply me….

    Reply
  27. i cudn’t enable mbstring on my php tried all the methods..please to help ! i have installed = apache – 2.2.25 , php 5.3.27,mysql 5.5.34.
    Its a strugge to enable any extension here.

    Reply
  28. Hi,

    First, thank you so much for this great tutorial. I only have some questions here :)

    I already remove my old version of php,mysql and apache before install and doing this procedure but when I checked the version of my newly installed php,mysql and apache I found out that my php version is still not the same with this tutorial have.

    MY current PHP version: (update from 5.2.1 but not the with the tutorial)

    —PHP 5.4.21 (cli) (built: Oct 27 2013 12:42:05)
    Copyright (c) 1997-2013 The PHP Group
    Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

    —MY Current Apache Version: (Still the same)
    Server version: Apache/2.2.3
    Server built:Oct 16 2013 12:18:29

    —My Current MYSQL Version:(updated)
    Server version:5.5.34 MySQL Community Server (GPL) by Remi
    Protocol version:10

    Hope we can fix this issue :)

    Thanks again!

    Reply
      • Thanks for the reply, My CentOS version is 5.9 and I think this version is indicated on this tutorial?

        I also tried 6.4 but I don’t feel this vesion ;) so I’m staying with the old 5.9 :)

        Just to share, I’m upgrading because I want to setup a new drupal website server.

        MY current drupal site contains this versions:

        CentOS 5.8
        PHP 5.3.3
        MySQL 14.12 Distib 5.0.9
        Server Version: 5.0.95
        Apache 2.2.3
        Drupal 7.14

        my plan is

        Going to 5.9 ( not 6.x )
        Drupal 7.23
        and your PHP,MYSQL and Apache version

        do you think I need to upgrade these versions just to run a new drupal site or just leave it?

        I also read some articles saying that the version of php 5.3.3 is a buggy version.. and they recommend to upgrade to 5.3.27 version but that article is way back last year..

        i know this is Off topic but I’m hopping for your suggestions :)

        Thanks!

        Reply
        • No need of up-gradation of OS and packages, you can deploy latest version of Drupal on the current configuration of your server.

          Reply
  29. Hi Ravi,

    I’m running RHEL 6.3 and followed your recipe for upgrading PHP and MySQL.

    I’m getting the same issue as others above with the following when trying to install ‘mysql-server’ package:

    Error: Package: mysql-server-5.5.34-1.el6.remi.x86_64 (remi)
    Requires: libz.so.1(ZLIB_1.2.0)(64bit)

    It appears that the ‘libz.so’ already installed is newer than 1.2.0:

    yum whatprovides *libz.so*

    zlib-1.2.3-27.el6.x86_64 : The zlib compression and decompression library
    Repo : installed
    Matched from:
    Filename : /lib64/libz.so.1.2.3
    Other : libz.so.1()(64bit)
    Filename : /lib64/libz.so.1

    zlib-devel-1.2.3-27.el6.x86_64 : Header files and libraries for Zlib development
    Repo : installed
    Matched from:
    Filename : /usr/lib64/libz.so

    Will removing this package as you recommend mean the required one is installed (downgraded) as a dependency?

    I really don’t wish to start a wild goose-chase tracking down dependencies and downgraded versions…

    Thanks for any help!
    – Richard

    Reply
  30. Need to upgrade PHP to 5.4 or above. Server don’t have internet connection. How do I do it? Thanks a lot..

    Centos with Apache ENV.

    Reply
  31. i got this error:-
    Error: Package: mysql-server-5.5.34-1.el6.remi.i686 (remi)
    Requires: perl-DBI
    Error: Package: mysql-server-5.5.34-1.el6.remi.i686 (remi)
    Requires: perl-DBD-MySQL
    Error: Package: mysql-server-5.5.34-1.el6.remi.i686 (remi)
    Requires: perl(DBI)
    Error: Package: mysql-server-5.5.34-1.el6.remi.i686 (remi)
    Requires: libz.so.1(ZLIB_1.2.0)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest
    [secpod@localhost httpd-2.2.9]$ chkconfig –levels 235 mysqld on
    error reading information on service mysqld: No such file or directory

    Reply
      • I’m using rhel 6-base and I tried this
        yum remove perl-DBI
        Loaded plugins: product-id, refresh-packagekit, subscription-manager
        Updating Red Hat repositories.
        INFO:rhsm-app.repolib:repos updated: 0
        Setting up Remove Process
        No Match for argument: perl-DBI
        No Packages marked for removal

        Reply
  32. Hi Ravi,
    I need to install phpmyadmin. Currently I am having-
    # mysql -V
    mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (i386) using readline 5.1
    #httpd -v
    Server version: Apache/2.2.15 (Unix)
    Server built: Feb 7 2012 09:50:15
    # php -v
    PHP 5.5.4 (cli) (built: Sep 19 2013 14:43:01)
    Copyright (c) 1997-2013 The PHP Group
    Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    When I run
    # yum –enablerepo=remi,remi-test install httpd mysql mysql-server php php-common
    I am getting-
    Error: Package: mysql-server-5.5.34-1.el6.remi.i686 (remi)
    Requires: libz.so.1(ZLIB_1.2.0)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest
    Can you suggest me what could be the reason or how shall I install phpmyadmin?

    Reply
  33. Pingback: 13 Apache Web Server Security and Hardening Tips
  34. I have installed mysql and mysql-server on fedora 19 successfully but when I am trying to
    start service /etc/init.d/mysqld start its showing
    /etc/init.d/mysqld: command not found
    why its happening could you please let me know

    Reply
    • In latest Fedora release, they’ve introduced systemctl to enable, start and stop services. Like this way.

      # systemctl enable httpd.service
      # systemctl enable mysqld.service
      # systemctl start httpd.service
      # systemctl start mysqld.service
      
      Reply
  35. Ravi,

    Thanks for the great info. Installed all on my Centos 5.8 box. My php is I-386 version.

    A few small problems…

    First, I’m getting this error in PhpMyAdmin:

    Your PHP MySQL library version mysqlnd 5.0.11-dev – 20120503 – $Id: 40933630edef551dfaca71298a83fad8d03d62d4 $ differs from your MySQL server version 5.5.33. This may cause unpredictable behavior.

    Next, I need to enable the cURL extension.

    Any help would be greatly appreciated .

    Reply
  36. Hi,

    Very useful article. Followed the steps and installed without any issues.

    Just want to know If we need to install the individual packages of this Apache, Mysql and Php for those who do not have Internet connection. Just assume for a standalone workstation.

    Could you please guide how to download the individual packages and configure them in centos.

    Thanks..

    Reply
    • Hi Bala…

      Follow the below procedure to download all pkgs and install them into stand alone machine.

      – First install yum-downloadonly pkg

      # yum install yum-downloadonly -y

      – Next create a dir for repsective pkgs Ex: /PHP-5.5.0-Modules

      Now just fire the below command

      # yum –enablerepo=remi,remi-test install php-mysql php-pgsql php-pecl-mongo php-sqlite php-pecl-memcache php-pecl-memcached php-gd php-mbstring php-mcrypt php-xml php-pecl-apc php-cli php-pear php-pdo –downloadonly –downloaddir=/PHP-5.5.0-Modules

      Thats it… All pkgs will get downlaod here and u can install them into anywhere u want.

      Reply
  37. Thank you very much for the tutorial… very good work… My problem is, I want to set up phpmyadmin 4.0.5 but version 2.3.11 is established. please help

    Reply
  38. I went through everything twice and when i dial up the server in a browser it doesn’t show the page, “this page cant be displayed”

    using Centos 6.4 on xen center VM

    Reply
  39. Hey, nice tutorial. I’m running Fedoa 17, 64 bit.
    I tried installing PHP 5.5 with this tutorial but it seems to install php 5.4
    I checked the contents of the directory where it is pulling from and it seems 5.5 is not listed.
    Any ideas?

    Reply
    • I think in Fedora 17, 5.5 version not supported. If you looking for updated version of PHP, then you need to upgrade your system.

      Reply
  40. great tutorial except for one thing, and not your fault. I have CentOS 6.4 on a 64 bit system and when I installed the REMI repository from http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm, it contained mysql 5.1.6 not 5.5 and php 5.3.3. As for the process, it went seamlessly … just not the results I was expecting. Thought I’d mention it for anyone else with a 64 bit system. Or maybe I did something wrong, wouldn’t be the first time.

    Reply
    • Did you added both Remi and Epel repositories? Can you post the output of the said command. So, we could find out why it showing 5.1.6 instead of 5.5.

      # yum --enablerepo=remi,remi-test list httpd mysql mysql-server php php-common
      
      Reply
      • I don’t know what I did wrong but I did a fresh install of CentOS on a different machine and followed your instructions again and this time it worked. I did notice that there were some errors regarding PHP not being able to initialize modules and also an error about the libc libraries are not 100% compatible. Would that have something to do with the MySQL plugin libdbi-dbd-mysql-0.8.3-5.1.el6.x86_64.rpm not being the latest version?

        Reply
  41. Hello, I have centos 6.3 (64bit)
    I am getting this error, could you help me.
    Loaded plugins: security
    base | 1.9 kB 00:00
    base/primary | 2.2 MB 00:00
    base 6339/6339
    epel/metalink | 12 kB 00:00
    epel | 4.2 kB 00:00
    epel/primary_db | 5.4 MB 00:08
    extras | 1.3 kB 00:00
    extras/primary | 6.6 kB 00:00
    extras 17/17
    openlogic | 1.3 kB 00:00
    openlogic/primary | 272 kB 00:00
    openlogic 20/20
    updates | 1.3 kB 00:00
    updates/primary | 497 kB 00:00
    updates 1170/1170
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package httpd.x86_64 0:2.2.15-15.el6.centos.1 will be installed
    –> Processing Dependency: httpd-tools = 2.2.15-15.el6.centos.1 for package: httpd-2.2.15-15.el6.centos.1.x86_64
    –> Processing Dependency: apr-util-ldap for package: httpd-2.2.15-15.el6.centos.1.x86_64
    –> Processing Dependency: libaprutil-1.so.0()(64bit) for package: httpd-2.2.15-15.el6.centos.1.x86_64
    –> Processing Dependency: libapr-1.so.0()(64bit) for package: httpd-2.2.15-15.el6.centos.1.x86_64
    —> Package mysql.x86_64 0:5.5.32-1.el6.remi will be installed
    –> Processing Dependency: real-mysql-libs(x86-64) = 5.5.32-1.el6.remi for package: mysql-5.5.32-1.el6.remi.x86_64
    —> Package mysql-server.x86_64 0:5.5.32-1.el6.remi will be installed
    –> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.5.32-1.el6.remi.x86_64
    –> Processing Dependency: libz.so.1(ZLIB_1.2.0)(64bit) for package: mysql-server-5.5.32-1.el6.remi.x86_64
    —> Package php.x86_64 0:5.5.1-1.el6.remi will be installed
    –> Processing Dependency: php-cli(x86-64) = 5.5.1-1.el6.remi for package: php-5.5.1-1.el6.remi.x86_64
    —> Package php-common.x86_64 0:5.5.1-1.el6.remi will be installed
    –> Processing Dependency: php-pecl-jsonc(x86-64) for package: php-common-5.5.1-1.el6.remi.x86_64
    –> Running transaction check
    —> Package apr.x86_64 0:1.3.9-5.el6_2 will be installed
    —> Package apr-util.x86_64 0:1.3.9-3.el6_0.1 will be installed
    —> Package apr-util-ldap.x86_64 0:1.3.9-3.el6_0.1 will be installed
    —> Package httpd-tools.x86_64 0:2.2.15-15.el6.centos.1 will be installed
    —> Package mysql-libs.x86_64 0:5.5.32-1.el6.remi will be installed
    —> Package mysql-server.x86_64 0:5.5.32-1.el6.remi will be installed
    –> Processing Dependency: libz.so.1(ZLIB_1.2.0)(64bit) for package: mysql-server-5.5.32-1.el6.remi.x86_64
    —> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be installed
    –> Processing Dependency: libmysqlclient.so.16(libmysqlclient_16)(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
    –> Processing Dependency: libmysqlclient.so.16()(64bit) for package: perl-DBD-MySQL-4.013-3.el6.x86_64
    —> Package php-cli.x86_64 0:5.5.1-1.el6.remi will be installed
    —> Package php-pecl-jsonc.x86_64 0:1.3.1-2.el6.remi.1 will be installed
    –> Processing Dependency: /usr/bin/pecl for package: php-pecl-jsonc-1.3.1-2.el6.remi.1.x86_64
    –> Processing Dependency: /usr/bin/pecl for package: php-pecl-jsonc-1.3.1-2.el6.remi.1.x86_64
    –> Running transaction check
    —> Package compat-mysql51.x86_64 0:5.1.54-1.el6.remi will be installed
    —> Package mysql-server.x86_64 0:5.5.32-1.el6.remi will be installed
    –> Processing Dependency: libz.so.1(ZLIB_1.2.0)(64bit) for package: mysql-server-5.5.32-1.el6.remi.x86_64
    —> Package php-pear.noarch 1:1.9.4-20.el6.remi will be installed
    –> Processing Dependency: php-xml for package: 1:php-pear-1.9.4-20.el6.remi.noarch
    –> Processing Dependency: php-posix for package: 1:php-pear-1.9.4-20.el6.remi.noarch
    –> Running transaction check
    —> Package mysql-server.x86_64 0:5.5.32-1.el6.remi will be installed
    –> Processing Dependency: libz.so.1(ZLIB_1.2.0)(64bit) for package: mysql-server-5.5.32-1.el6.remi.x86_64
    —> Package php-process.x86_64 0:5.5.1-1.el6.remi will be installed
    —> Package php-xml.x86_64 0:5.5.1-1.el6.remi will be installed
    –> Finished Dependency Resolution
    Error: Package: mysql-server-5.5.32-1.el6.remi.x86_64 (remi)
    Requires: libz.so.1(ZLIB_1.2.0)(64bit)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    Reply
  42. Just a quick correction: if are having problems with mysqli, please use the following command:

    yum –enablerepo=remi,remi-test install php-mysql

    Do not forget to use the remi repo, other wise it will install an old version (php .5.1).

    I did this for CentOS 5.X.

    Reply
  43. Hello!

    Can you help me? I couldn’t installa My sql On RHEL 5.8 X86_64

    Loaded plugins: katello, security
    Unable to read consumer identity
    Setting up Install Process
    Resolving Dependencies
    –> Running transaction check
    —> Package mysql.x86_64 0:5.5.32-1.el5.remi set to be updated
    –> Processing Dependency: real-mysql-libs = 5.5.32-1.el5.remi for package: mysql
    —> Package mysql-server.x86_64 0:5.5.32-1.el5.remi set to be updated
    –> Processing Dependency: perl-DBI for package: mysql-server
    –> Processing Dependency: perl-DBD-MySQL for package: mysql-server
    –> Processing Dependency: perl(DBI) for package: mysql-server
    –> Running transaction check
    —> Package mysql-libs.x86_64 0:5.5.32-1.el5.remi set to be updated
    —> Package mysql-server.x86_64 0:5.5.32-1.el5.remi set to be updated
    –> Processing Dependency: perl-DBI for package: mysql-server
    –> Processing Dependency: perl-DBD-MySQL for package: mysql-server
    –> Processing Dependency: perl(DBI) for package: mysql-server
    –> Finished Dependency Resolution
    mysql-server-5.5.32-1.el5.remi.x86_64 from remi has depsolving problems
    –> Missing Dependency: perl-DBD-MySQL is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    mysql-server-5.5.32-1.el5.remi.x86_64 from remi has depsolving problems
    –> Missing Dependency: perl(DBI) is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    mysql-server-5.5.32-1.el5.remi.x86_64 from remi has depsolving problems
    –> Missing Dependency: perl-DBI is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    Error: Missing Dependency: perl(DBI) is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    Error: Missing Dependency: perl-DBI is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    Error: Missing Dependency: perl-DBD-MySQL is needed by package mysql-server-5.5.32-1.el5.remi.x86_64 (remi)
    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
    The program package-cleanup is found in the yum-utils package.

    Reply
    • To get rid of such dependency errors, remove the Perl-DB package.

      # yum remove perl-DB perl-DBD-MySQL
      

      And then try to install again, hope it will work.

      Reply
  44. Hello Ravi, first of all i hat a lot of help through this great how to.

    But as stated a comment above i also have the issue of MySQL Daemon failed to start.

    Where exactly can i find the my.conf file to check if configuration is correct.

    Reply
    • I fixed the problem, but cant seem to get the FTP working, It givis me error that i do not have the right permissions.

      Reply
  45. Thanks for your post..

    I got an error while i start the mysql…

    “MySQL Daemon failed to start.
    Starting mysqld: [FAILED]”

    Can you explain how can i start mysql…

    Reply
  46. Pingback: 25 Hardening Security Tips for Linux Servers | ..::Last Bits::..
  47. Pingback: 25 Hardening Security Tips for Linux Servers
  48. Pingback: Creating Your Own Webserver and Hosting A Website from Your Linux Box
  49. Hi here i got the info abt how to install…can u please post something like how it work…The details are below.

    I have install install linux,apache,mysql and php. But now i can’t know how its work together. Means how php website is conecting to mysql database and how it host on apache web server.

    Reply
      • What should I do in order to install both in different locations but not in default directories like if I want to install under /apps?

        And If I want to have two different versions of apache for testing purpose before deleting older one in different directories then will there be any difference in installation procedure?

        Reply
        • Yes! use yum to install first version of Apache in default location and compile the second version using source.

          Reply
  50. Thanks. My doubt is should I delete older version and install latest version or is there any update option for both apache and PHP. If so pls let me know.

    Reply
    • Yes! you must delete older versions before compiling new versions. Till now there are no official updates from repositories.

      Reply
  51. I want to upgrade Apache from 2.4.3 to 2.4.4 and PHP from 5.4.6 to 5.4.14 in RHEL. Can I get steps to accomplish this.

    Thanks

    Reply
  52. Need help in solving “Your PHP installation appears to be missing the MySQL extension which is required by WordPress”.
    OS RedHat Linux 6 Ent. 64bit x86

    Reply
  53. Php is not beeing parsed. What can i do? using Centos 6.2

    I installed virtualmin, then i followed the steps on this page.
    php-cli works fine do

    Reply
    • for some reason, i find the following lines in httpd.conf
      RemoveHandler .php
      RemoveHandler .php5
      php_admin_value engine Off

      after removing, php works fine.

      Reply
  54. Error: mysql55-libs conflicts with mysql-libs-5.1.67-1.el6_3.x86_64
    Error: Package: php54w-mysql-5.4.13-1.w6.x86_64 (@webtatic)
    Requires: libmysqlclient.so.18(libmysqlclient_18)(64bit)
    Removing: mysql55-libs-5.5.29-1.w6.x86_64 (@webtatic)
    libmysqlclient.so.18(libmysqlclient_18)(64bit)
    Updated By: mysql55-libs-5.5.30-1.ius.el5.x86_64 (ius)
    Not found
    Available: mysql55-libs-5.5.28-1.w6.x86_64 (webtatic)
    libmysqlclient.so.18(libmysqlclient_18)(64bit)
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    Reply
      • I want to access to of my projects simultaneously in the same machine .How can I setup virtual hosts or is their any other ways to that.

        Reply
        • You can create as many as virtual hosts same way as shown below. Just add the following lines to your httpd.conf file.

          NameVirtualHost *:80
          
          <VirtualHost *:80>
              ServerAdmin [email protected]
              DocumentRoot "/var/www/html/tecmint"
              ServerName tecmint.com
              ServerAlias www.tecmint.com
              ErrorLog "logs/tecmint/error_log"
              CustomLog "logs/tecmint/access_log" common
          </VirtualHost>
          
          <VirtualHost *:80>
              ServerAdmin [email protected]
              DocumentRoot "/var/www/html/tecmint1"
              ServerName tecmint1.com
              ServerAlias www.tecmint1.com
              ErrorLog "logs/tecmint1/error_log"
              CustomLog "logs/tecmint1/access_log" common
          </VirtualHost>
          
          Reply
          • I am getting [FAILED] when I restart my httpd. I want to run two projects on my local machine I dont know whether it can be done using by virtual hosts are not.

      • The requested URL /conf/myadmin was not found on this server.
        Apache Server at 82.165.24.94 Port 80

        PHP 5.4.12 (cli) (built: Feb 21 2013 20:17:01)
        Copyright (c) 1997-2013 The PHP Group
        Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

        my each step is right but not proper open my phpmyadmin..what the solution

        Reply
  55. Pingback: How to Install Varnish Cache (Web Accelerator) in RHEL/CentOS/Fedora and Ubuntu/Debian
  56. first of all thanks for the tutorial.

    the linke for the libmcrypt is dead :

    Error Downloading Packages:
    libmcrypt-2.5.7-5.el5.i386: failure: libmcrypt-2.5.7-5.el5.i386.rpm from epel: [Errno 256] No more mirrors to try.

    please fix it.

    Thanks

    Reply
  57. i wont to start apache but …

    [root@hotel526 ~]# /etc/init.d/httpd start
    Starting httpd: Syntax error on line 206 of /var/www/vhosts/shikolajme.com/conf/13605257930.90124700_httpd.include:
    Wrapper /var/www/cgi-bin/cgi_wrapper/cgi_wrapper cannot be accessed: (2)No such file or directory
    [FAILED]

    Reply
    • I think you messed up your PHP installation with Plesk under your CentOS system. To fix such errors do this.

      # ln -s /usr/bin/sw-engine-cgi /var/www/cgi-bin/cgi_wrapper/cgi_wrapper
      

      If you don’t have wrappers installed, then install using yum command as show.

      # yum install sw-engine-cgi
      

      That’s it. let me know.

      Reply
  58. The easiest method to update PHP from older version 5.1.x to 5.3.x & the method is called “NASHOT’s Method”.

    ================== START ===============================
    NASHOT’s Method:

    Step 1) Go to GUI mode(X-Windows preferably Gnome desktop) & then “Add/Remove Software section(Package Manager).

    Step 2) Click on Search TAB & enter the search string as php & set the radio button to “Installed Packages” & Hit the Search Button.

    Step 3) Search result will show existing php modules with Ticked check-boxes at the beginning. It’s something like this:
    [/] php-5.1.x…..
    [/] php-common-5.1.x……
    [/] php-cli-5.1.x……
    [/] php-ldap-5.1.x……
    Etc…Etc…

    Step 4) Now Un-Tick the Check-Boxes from all resulted lines & then Click on Apply Button. This will remove existing PHP version Modules.

    Step 5) Inside the “Package Manager” click on Search Tab & enter the search string as php53 & set the radio button to “All Packages” & Hit Search Button.

    Step 6) Search shows many Result lines related to new PHP version 5.3.x with Un-Ticked Check-Box before each line.

    Step 7) Now Tick the Check-Boxes from all resulted lines & then Click on Apply Button.

    Now “Package Manager” will begins to check for Dependancy Modules for Selected PHP Modules & Downloads the new PHP 5.3.x package modules & then installs Automatically.

    Now Restart your system & check the version of the installed PHP Version by using “php -v” command & result should be PHP 5.3.x

    Please NOTE: If your installation halts at “Checking Dependancy”, then check for selection of “PHP53-odbc64-5.3.x…..”. Actually there are 2 odbc packages & each meant for 32bit & 64bit version of OS. So select only ONE odbc package which is compatible with your OS.

    =================== END ==============================

    Reply
    • First replace old php version using.

      # yum remove php php-common php-devel
      

      Then install latest version as described in the article.

      Reply
    • Set the following variable in your php.ini file, If you don’t have access to the php.ini, you can add it to .htaccess file.

      short_open_tag=On
      

      Restart your Apache server.

      Reply
  59. Hey Ravi,
    I am new to linux, Thanks for the steps i followed the steps but while checking the phpinfo i am getting php code of the file,
    Linux version – Redhat enterprise linux 5.4
    While checking with the command php -v its giving me 5.2.17 version not the installed one, do i need to uninstall previous version first?

    Please let me know if you need any other information to help me

    Reply
  60. well i am using cent os 6.3 32 bit there is a problem when iam trying to install the php module
    Error: Package: mysql-server-5.1.61-4.el6.i686 (tejas-barot-wine)
    Requires: mysql = 5.1.61-4.el6
    Installed: mysql-5.5.29-1.el6.remi.i686 (@remi)
    mysql = 5.5.29-1.el6.remi
    Available: mysql-5.1.61-4.el6.i686 (tejas-barot-wine)
    mysql = 5.1.61-4.el6
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest
    what i wl do ?

    Reply
  61. indeed Impressive repository and post KB to convert fresh linux distro into productive web server in few minutes !

    It rocks flawless.

    Thanks Ravi.

    Reply
  62. Thank you so much for creating this tutorial. I am having to install various content management systems on a RedHat 6 server for testing. After installing PHP, mysql and Apache before starting the install of the systems, discovered that one of them needed php mbstring enabled. I found other search results but I realized a reinstall of PHP was needed and this tutorial efficiently helped me exactly do that.

    Your site is now going to be among those I look directly for help and look at daily with my other tech resources.

    Thanks,

    James

    Reply
  63. FYI – it isn’t mentioned because it is assumed a fresh install, but it also works with an upgrade. You just need to remember to run “mysql_upgrade” from the command line after the upgrade to fix the privileges and performance_schema.

    Reply
    • @Gary

      If it is fresh MySQL installation, then password would be blank.. or you can set password using following command.

      mysqladmin -u root password NEWPASSWORD
      

      Or to change MySQL password use.

      mysqladmin -u root -p'oldpassword' password 'newpass'
      
      Reply

Got something to say? Join the discussion.

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.