HostOnNet Blog

How to install Apache MySQL and PHP on Cent OS 6.6

centos-66

Following tutorial describes how to install Apache MySQL and PHP on a Cent OS based server.

First we need to identify the version of OS using on the server. For that, login to the server as root user and run following command:

cat /etc/*issue

Find a sample result below:

[root@xx-xxx ~]# cat /etc/*issue
CentOS release 6.6 (Final)
Kernel \r on an \m

Now, lets install Apache MySQL and PHP on this. Before

Before starting the installation, we should find actual name of packages. You can use below command for that:

yum search PACKAGE_NAME

For example, to get all available mysql packages, run

yum search mysql

First install Apache HTTP Server. For that, run:

yum install httpd httpd-devel

Once installation successfully finished, you can check the version using following command:

httpd -v

Result will be as:

[root@xx-xxxx ~]# httpd -v
Server version: Apache/2.2.15 (Unix)
Server built: Oct 16 2014 14:48:21
[root@xx-xxxx ~]#

For mysql, you may install all necessary packages. Lets use below command for that:

yum install mysql mysql-devel mysql-server

For PHP installation, use below command:

yum install php php-devel php-cli php-gd php-mbstring php-mysql

Above command includes basic php and other essential PHP modules.

To find php version on the server, use below command:

php -v

Result will be as follows:

[root@xx-xxxx ~]# php -v
PHP 5.3.3 (cli) (built: Oct 30 2014 20:12:53) 
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
[root@xx-xxxx ~]# php -m

To see the available php modules on server, run below command

php -m

Which will give you result as:

[root@xx-xxxx ~]# php -m
[PHP Modules]
bz2
calendar
Core
ctype
curl
date
dom
ereg
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imap
json
libxml
mbstring
mysql
mysqli
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

[Zend Modules]

[root@xx-xxxx ~]# 

About Vineesh Mohan

A Technical Support specialist with strong customer service and good communication skills. I live in the city of Cochin, which known as the Queen of Arabian Sea.