HOWTO.apache2_centos - raynaldmo/HOWTO GitHub Wiki

Install Apache 2, PHP(5.3) and MYSQL on CentOS 6 server

Reference

http://www.servermom.org/complete-newbie-guide-to-build-centos-server-to-host-websites/

Install Apache and PHP

yum install httpd
apachectl -v
yum install php php-mysql
yum search php-
yum info php-pdo.x86_64
yum install php-common php-cli php-devel php-fpm php-gd php-imap php-intl php-mysql php-process php-xml php-xmlrpc php-zts
service http restart

Fix "httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName" message

edit /etc/httpd/conf/httpd.conf file and add line "ServerName localhost"
chkconfig --list | grep httpd
chkconfig httpd on

Test web server

On browser navigate to localhost. Should see "Apache 2 Test Page"

Install MYSQL

yum install mysql-server
service mysqld start

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h centos67-vm password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

chkconfig mysqld on

Reference

http://www.servermom.org/top-most-common-basic-mysql-commands/124/

Add new site

Apache config file : /etc/httpd/conf/httpd.conf

Reference

http://www.servermom.org/how-to-add-new-site-into-your-apache-based-centos-server/454/