This howto guide explains you’ll how to install Apache Server with latest MySQL 5.5.30 and PHP 5.4.12 versions with php required following modules on RHEL 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6, CentOS 6.4/6.3/6.2/6.1/6.0/5.9/5.8/5.6 and Fedora 12,13,14,15,16,17,18 systems using Remi repository via Yum tool.
What is Apache?
Apache is an open source freely available HTTP web server that runs on most UNIX-based operating systems as well as on Windows. Apache web server is used to serve web pages like (.htm .php .pl .cgi .js) etc. As per March 2012, Apache web server runs on almost 65.24% websites across all the domains.
What is MySQL?
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.
What is PHP?
PHP (Hypertext Preprocessor) is an open source server-side scripting language that is best suited for web development and can be used to produce dynamic web pages for a website.
PHP Modules
We are going to install all these following PHP modules in this installation.
- MySQL (php-mysql) – A extension for PHP applications that use MySQL databases.
- PostgreSQL (php-pgsql) – A extension for PostgreSQL database for PHP.
- MongoDB (php-pecl-mongo) – A driver for MongoDB database.
- SQLite (php-sqlite) – Extension for SQLite Database Engine.
- Memcache (php-pecl-memcache) – Memcached caching daemon.
- Memcached (php-pecl-memcached) – Memcached caching daemon.
- GD (php-gd) – GD extension for PHP application to serve graphics.
- XML (php-xml) – XML Parser for PHP applications.
- MBString (php-mbstring) – Mbstring extension is used to handle multi-byte string in PHP applications.
- MCrypt (php-mcrypt) – A Mcrypt library for PHP scripts.
- APC (php-pecl-apc) – APC module used to optimize and cache PHP code.
- CLI (php-cli) – Command-line interface for PHP.
- PEAR (php-pear) – Application Repository framework for PHP.
- PDO (php-pdo) – Database access module for PHP applications.
Step 1: Installing Remi Repository
## Install Remi Repository on Fedora 18, 17, 16, 15 ## rpm -Uvh http://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-stable.noarch.rpm rpm -Uvh http://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-stable.noarch.rpm ## Fedora 18 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-18.rpm ## Fedora 17 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-17.rpm ## Fedora 16 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-16.rpm ## Fedora 15 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-15.rpm ## Fedora 14 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-14.rpm ## Fedora 13 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-13.rpm ## Fedora 12 ## # rpm -Uvh http://rpms.famillecollet.com/remi-release-12.rpm ## Install Remi & Epel Repository on RHEL/CentOS 6.4-6.0 - 32 Bit ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ## Install Remi & Epel Repository on RHEL/CentOS 6.4-6.0 - 64 Bit ## rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ## Install Remi Repository on RHEL/CentOS 5.9-5.0 - 32 Bit ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm ## Install Remi Repository on RHEL/CentOS 5.9-5.0 - 64 Bit ## rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Step 2: Installing Apache, MySQL 5.5.30 & PHP 5.4.12
## Installing on Fedora 12, 13, 14, 15, 16, 17, 18 ## # yum --enablerepo=remi install httpd mysql mysql-server php php-common ## Installing on RHEL/CentOS 5-6 ## # yum --enablerepo=remi,remi-test install httpd mysql mysql-server php php-common
Step 3: Installing PHP 5.4.12 Modules
## Installing on Fedora 12, 13, 14, 15, 16, 17, 18 ## # yum --enablerepo=remi 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 ## Installing on RHEL/CentOS 5-6 ## # 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
Step 4: Starting/Stopping Apache & MySQL 5.5.30
## Enable Apache and MySQL on Run-Levels ## # chkconfig --levels 235 httpd on # chkconfig --levels 235 mysqld on ## Apache Commands ## # /etc/init.d/httpd start # /etc/init.d/httpd stop # /etc/init.d/httpd status ## MySQL Commands ## # /etc/init.d/mysqld start # /etc/init.d/mysqld stop # /etc/init.d/mysqld status
Step 5: Verifying Apache, MySQL 5.5.30 & PHP 5.4.12
1. Create a page called phpinfo.php under your Apache root directory and add the following lines to it. For example (/var/www/html/phpinfo.php).
<?php
phpinfo ();
?>2. Now access the page via web browser like http://localhost/phpinfo.php. You will see below screenshot.
That’s it!. If you are having any trouble installing, let me know via our comment section.




Nice post. I was watching continuously this site and I’m impressed! Extremely useful info especially the last part I care for such info much. I was looking for this specific info for a long time. Thank you and best of luck.
what is the root password of mysql?
@Gary
If it is fresh MySQL installation, then password would be blank.. or you can set password using following command.
Or to change MySQL password use.
Thanks very much
thanks a lot
Thanks very much. Easy to follow, no hassles. Upgraded my Virtualmin box this morning and no problems.
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.
/etc/init.d/mysqld start not a directory…wat to do
which Linux version you using? have you installed MySQL and restarted?
Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)
showing an error while connecting mysql
edit the /etc/my.cnf
change the ‘/tmp/mysql.sock’ become ‘/var/lib/mysql/mysql.sock’
it’s work for me
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
Great tip, it’s was very useful today during a CentOS 6 config
Thanks.
indeed Impressive repository and post KB to convert fresh linux distro into productive web server in few minutes !
It rocks flawless.
Thanks Ravi.
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 ?
Remove old version of mysql using:
and then follow the steps again..
Very helpful!
Thanks
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
Please remove the older version of PHP, and then follow the commands again and let me know.
phpMyAdmin – Error
The mysqli extension is missing. Please check your PHP configuration.
help me please
Please install extension like.
I follow the steps then.
i can’t connect to mysql with php
Ok. Thakyou
What error you getting, can you post here, did you restart the MySQL service.
It’s not explicitly stated in the guide above you have to do this. But you have to start the mysql server.
Do this:
chkconfig –levels 235 httpd on
so that mysql server starts on restart.
then either use:
service mysqld start
or
/etc/init.d/mysqld start
short_tag php5 configuration
Help Me.
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.
Restart your Apache server.
how to install Apache web server in fedaro13..
i have an tar file..
Why you want to install via tar file. just run the following command to install Apache.
you guys are life savers, good stuff. it worked on the first go
for my sql on phpinfo page, i am getting an
Client API version 5.1.66
First replace old php version using.
Then install latest version as described in the article.
Hello,
Very nice post…
Really great post! Very helpful.
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 ==============================
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]
I think you messed up your PHP installation with Plesk under your CentOS system. To fix such errors do this.
If you don’t have wrappers installed, then install using yum command as show.
That’s it. let me know.
Thanks so much! This was incredibly helpful.
I am glad it worked for you….
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
yum –enablerepo=remi,remi-test install httpd mysql mysql-server php php-common
gives error as
http://rpms.famillecollet.com/enterprise/5.50/remi/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404: Not Found
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: remi. Please verify its path and try again
Can you tell me which version of OS you using?
CentOS 6.4 – 64 Bit
This Happened To Me As Well. The Problem Is That The First URL In Step #1 Was Coming Up With A “Not Found” Error. If You Load The URL Into A Browser, It Was Redirecting Me To A Mirror That Wasn’t Available.
URL: http://download.fedoraproject.org/pub/epel/6/
Redirected Me To: http://rhn.brown.edu/pub/epel/6/
And I Got This:
Server not found
Firefox can’t find the server at rhn.brown.edu.
If You, However, Type In That Download URL Again, It Will Redirect You Someplace Else. That One Resolved And So I Was Able To Find The File By Following The Links Down. In My Case, It Ended Up Being This:
http://www.gtlib.gatech.edu/pub/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
Once I Had That, Everything Worked Correctly For Me.
-Rick
Worked for me. Thanks.
Error: mysql55-libs conflicts with mysql-libs-5.1.67-1.el6_3.x86_64
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
Frist, remove the conflicting package with yum like this:
And then try to install again.
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.
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 tecmint@tecmint.com DocumentRoot "/var/www/html/tecmint" ServerName tecmint.com ServerAlias http://www.tecmint.com ErrorLog "logs/tecmint/error_log" CustomLog "logs/tecmint/access_log" common </VirtualHost> <VirtualHost *:80> ServerAdmin tecmint@tecmint.com DocumentRoot "/var/www/html/tecmint1" ServerName tecmint1.com ServerAlias http://www.tecmint1.com ErrorLog "logs/tecmint1/error_log" CustomLog "logs/tecmint1/access_log" common </VirtualHost>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.
Can you post the output of the following command.
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
[kotesh@machine8 Jantakhoj]$ httpd -t
Syntax OK
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
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.
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
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
Yes! I will soon provide you steps on how to do it. Keep visiting.:)
Thanks Ravi, I am on standby
Hi Ravi,
Any update on this.
Only way to upgrade from older version to newer version using source code. You need to compile and install to get the latest Apache 2.4. Wait for few more days, latest Apache will be available from official repositories.
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.
Yes! you must delete older versions before compiling new versions. Till now there are no official updates from repositories.
how to proper remove PHP 5.4.12 ….
yum remove ?????
Yes, use yum remove command to remove completely a package from the system.
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?
Yes! use yum to install first version of Apache in default location and compile the second version using source.