Before you begin your compilation you should need additional header files and libraries required, please use the following code to install pre-requisities, don’t delete them as you would definitely need them when you upgrade to new releases also:
yum install make gcc automake zlib-devel bison cmake libtool wget gcc-c++ unzip ncurses-devel openssl-devel pcre-devel libxml2-devel curl-devel gd-devel libxslt-devel
Building & Installing Apache prefork
download the latest release of Apache Web Server and unpack:
wget http://ftp.itu.edu.tr/Mirror/Apache//httpd/httpd-2.2.25.tar.gz
tar zxvf httpd-2.2.25.tar.gz
cd httpd-2.2.25
We advise you to configure with the options below as this form is widely used:
./configure \
"--prefix=/etc/httpd" \
"--exec-prefix=/etc/httpd" \
"--bindir=/usr/bin" \
"--sbindir=/usr/sbin" \
"--sysconfdir=/etc/httpd/conf" \
"--enable-so" \
"--enable-dav" \
"--enable-dav-fs" \
"--enable-dav-lock" \
"--enable-suexec" \
"--enable-deflate" \
"--enable-unique-id" \
"--enable-mods-static=most" \
"--enable-reqtimeout" \
"--with-mpm=prefork" \
"--with-suexec-caller=apache" \
"--with-suexec-docroot=/" \
"--with-suexec-gidmin=100" \
"--with-suexec-logfile=/var/log/httpd/suexec_log" \
"--with-suexec-uidmin=100" \
"--with-suexec-userdir=public_html" \
"--with-suexec-bin=/usr/sbin/suexec" \
"--with-included-apr" \
"--with-pcre=/usr" \
"--includedir=/usr/include/apache" \
"--libexecdir=/usr/lib/apache" \
"--datadir=/var/www" \
"--localstatedir=/var" \
"--enable-logio" \
"--enable-ssl" \
"--enable-rewrite" \
"--enable-proxy" \
"--enable-expires" \
"--with-ssl=/usr" \
"--enable-headers"
to build and install source distro, type:
# make
# make install
Build & Install MySQL
Since we need headers and libraries of mysql for compiling PHP, we will first install MySQL server before PHP compilation.
wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.14.tar.gz/from/http://cdn.mysql.com/If you encounter problems while running cmake, you have to delete CmakeCache.txt before re-compiling with cmake
tar zxvf mysql-5.6.14.tar.gz
cd mysql-5.6.14
groupadd mysql
useradd -g mysql mysql
cmake . -DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock
make
make install
#log in to newly created mysql dirchange your mysql password by typing:
cd /usr/local/mysql/
#change owner and group
chown -R mysql:mysql .
scripts/mysql_install_db --user=mysql --datadir=/var/lib/mysql
#add service command
cp support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig mysqld on
#start mysql server
service mysqld start
./bin/mysqladmin -u root password 'new-password'Build libmcrypt from the source
./bin/mysqladmin -u root -h change.this.hostname password 'new-password'
libmcypt repo is not included in the main yum repo, so better install it from the source:
wget http://sourceforge.net/projects/mcrypt/files/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz/download?use_mirror=garrBuilding PHP-5.5.5 from the source
tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
make install
PHP configuration is also given with the mostly used modules & functionality, download unpack & configure as stated below:
wget http://us2.php.net/get/php-5.5.5.tar.gz/from/this/mirrorDownload phpMyAdmin and install it to webroot:
tar zxvf php-5.5.5.tar.gz
cd php-5.5.5
./configure \
--with-apxs2 \
--with-curl=/usr \
--with-gd \
--with-gettext \
--with-jpeg-dir=/usr \
--with-freetype-dir=/usr \
--with-kerberos \
--with-openssl \
--with-mcrypt=/usr/local/lib \
--with-mhash \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pcre-regex \
--with-pear \
--with-png-dir=/usr \
--with-xsl \
--with-zlib \
--with-zlib-dir=/usr \
--with-iconv \
--enable-bcmath \
--enable-calendar \
--enable-exif \
--enable-ftp \
--enable-gd-native-ttf \
--enable-soap \
--enable-sockets \
--enable-mbstring \
--enable-zip \
--enable-wddx
make
make install
libtool --finish /root/php-5.5.5/libs
cp php.ini-production /usr/local/lib/php.ini
sed -i 's/;date.timezone =.*/ date.timezone \= "Europe\/Istanbul"/' /usr/local/lib/php.ini
wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.0.8/phpMyAdmin-4.0.8-all-languages.tar.gzcreate a test page to see if everything went well:
tar zxvf phpMyAdmin-4.0.8-all-languages.tar.gz
mv phpMyAdmin-4.0.8-all-languages /var/www/
mv /var/www/phpMyAdmin-4.0.8-all-languages/ /var/www/phpMyAdmin
echo "<?PHP phpInfo();?>" > /var/www/index.php If you cannot see a PHP info page, you need to add httpd directives to your httpd.conf:
echo "AddType application/x-httpd-php .php" >> /etc/httpd/conf/extra/httpd-php.confrestart apache by typing: apachectl restart
echo "AddType application/x-httpd-php-source .phps" >> /etc/httpd/conf/extra/httpd-php.conf
echo "Include conf/extra/httpd-php.conf" >> /etc/httpd/conf/httpd.conf