Hi Guys,

see the script that I found.

let me know if it worked for you.


  • Script is for CentOS 6 and tested on CentOS6. it should work on CentOS 5 as long as you change the EPEL RPM.
  • No need to disable SElinux



It worked for me.


wget http://iesucks.net/linux/scripts/ApachePHP.sh
chmod +x ApachePHP.sh
./ApachePHP.sh





#!/bin/bash

#Welcome Message
echo
echo Welcome to the Installer script.
echo
echo This script will install Apache, PHP, MySQL, ProFTPD, and PHPMyAdmin
echo
echo WARNING!!! This script will overwrite any existing Apache, PHP, ProFTPD or MySQL install.
echo
echo If you have already have a working install of this push Ctrl+C Now!!!
echo
echo Starting install in 30 seconds!
sleep 30

#Check if OS is CentOS/RHEL
if [ -f /etc/redhat-release ];
then
echo "Found CentOS/RHEL"
else
echo "This OS Is NOT CentOS/RHEL. This setup script will not work with this os."
exit
fi

#Check if yum exists
if [ -f /usr/bin/yum ];
then
echo "Found Yum!"
else
echo "Yum is not installed. Yum MUST be installed for this script to work!"
exit
fi

#Remove Exiting Apache/PHP install if exists
yum -y remove httpd* php*

#Setup EPEL
rpm -ivh http://download.fedora.redhat.com/pu...6-5.noarch.rpm

#Install packages using yum
yum -y install kernel-headers kernel-devel gcc gd gd-devel curl curl-devel mysql mysql-server mysql-devel apr apr-devel libxml2 libxml2-devel libmcrypt libmcrypt-devel proftpd

#Grab packages
cd /usr/local/src/
wget http://mirror.olnevhost.net/pub/apac...-2.2.21.tar.gz
wget http://us2.php.net/get/php-5.3.8.tar...om/this/mirror
wget "http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.6/phpMyAdmin-3.4.6-all-languages.tar.gz*****&ts=1319286902&use_mirror=sup erb-sea2"

#Extract packages
tar zxvf httpd-2.2.21.tar.gz
tar xvf php-5.3.8.tar.bz2
tar zxvf phpMyAdmin-3.4.6-all-languages.tar.gz

#Compile Apache and PHP
cd /usr/local/src/httpd-2.2.21
./configure --prefix=/usr/local/apache --enable-mods-shared=all --enable-ssl --enable-unique-id --with-ssl --with-zlib --with-mpm=worker --enable-proxy --with-mpm=prefork --enable-suexec --with-suexec-bin --with-included-apr && make && make install
cd /usr/local/src/php-5.3.8
./configure --prefix=/usr/local/php --with-gd --with-mhash --with-libxml-dir --with-mcrypt --with-jpeg-dir=/usr --with-mysql=/ --with-curl --with-mysqli --with-pdo-mysql=mysqlnd --with-kerberos --enable-mbstring --with-apxs2=/usr/local/apache/bin/apxs && make && make install

#Setup config files and services
echo "#Added by Install script" >> /usr/local/apache/conf/httpd.conf
echo "#" >> /usr/local/apache/conf/httpd.conf
echo "AddType application/x-httpd-php .php" >> /usr/local/apache/conf/httpd.conf
echo "#" >> /usr/local/apache/conf/httpd.conf
echo "<IfModule dir_module>" >> /usr/local/apache/conf/httpd.conf
echo "DirectoryIndex index.php" >> /usr/local/apache/conf/httpd.conf
echo "</IfModule>" >> /usr/local/apache/conf/httpd.conf
echo "#" >> /usr/local/apache/conf/httpd.conf
echo "HostnameLookups On" >> /usr/local/apache/conf/httpd.conf
echo "#" >> /usr/local/apache/conf/httpd.conf

#Secure Apache with PCI complance.
echo "ServerTokens ProductOnly" >> /usr/local/apache/conf/httpd.conf
echo "#End of added by Install script" >> /usr/local/apache/conf/httpd.conf
cp /usr/local/src/php-5.3.8/php.ini-production /usr/local/php/lib/php.ini
wget http://iesucks.net/linux/script-configs/httpd -O /etc/init.d/httpd
chmod +x /etc/init.d/httpd
ln -s /usr/local/php/bin/php /bin/php

#Make sure services start on boot
chkconfig httpd on
chkconfig mysqld on
chkconfig proftpd on

#Temp Disable SElinux
setenforce 0

#Disable SElinux
sed -i "7s/enforcing/disabled/" /etc/selinux/config

#Setup hosts file for Apache
echo 127.0.0.1 $HOSTNAME >> /etc/hosts

#Flush firewall
iptables -F

#Start services
service httpd start
service mysqld start
service proftpd start

#Setup phpMyAdmin
cd /usr/local/src
cp -R /usr/local/src/phpMyAdmin-3.4.6-all-languages /usr/local/apache/htdocs/phpMyAdmin

#Prevent Apache and PHP form being installed via yum.
echo "exclude=httpd* php*" >> /etc/yum.conf

#Set MySQL root password.
echo
read -p "Enter a MySQL root passowrd: " mysqlrootpassword
mysqladmin -u root password $mysqlrootpassword
echo
echo "The MySQL root password has been set to: $mysqlrootpassword"
echo

#Finished and echo information
echo If you received no errors then your webserver should be working.
echo
echo If you need to edit apache the config file it is located at /usr/local/apache/conf/httpd.conf
echo
echo If you need to edit the PHP config file it is located at /usr/local/php/lib/php.ini
echo
echo The MySQL root password was set to: $mysqlrootpassword
echo
echo You may access phpMyAdmin at $HOSTNAME/phpMyAdmin or via your ServerIP/phpMyAdmin
echo
echo Install Complete!
echo
Novaroot Reviewed by Novaroot on . A script for Basic apache and php compile might be useful Hi Guys, see the script that I found. let me know if it worked for you. Script is for CentOS 6 and tested on CentOS6. it should work on CentOS 5 as long as you change the EPEL RPM. No need to disable SElinux Rating: 5