Compileren Apache / PHP / MySQL
Door Apache en PHP op je linux webserver te compileren kan er een aanzienlijke prestatie toename ontstaan. Dit is wel iets complexer maar als je dit ook wilt proberen: Installeer in dit geval Fedora met alleen de development tools (custom install)
Vervolgens de volgende Bestanden om te downloaden naar /usr/local/src
MySQL www.mysql.com (binary tar.gz)
Apache www.apache.org (source tar.gz)
Php www.php.net (source tar.gz)
Vervolgens de onderstaande scripts in je terminal window laten uitvoeren :
# Uitpakken :
cd /usr/local/src
tar zxvf $apache.tar.gz
tar zxvf $apc.tgz
tar zxvf $php.tar.gz
tar zxvf $Net_SSLeay.tar.gz
tar zxvf $mysql.tar.gz
# eerst met Yum de server updaten :
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY* #voorkomt GPG key errors voor ghostscript fonts
yum install ImageMagick
yum update openssh*
yum update zlib-devel*
# MySQL installeren (binary distro) :
groupadd mysql
useradd -g mysql mysql
cd /usr/local
tar -zxvf /usr/local/src/$mysql.tar.gz
ln -s $mysql mysql
cd mysql
scripts/mysql_install_db --user=mysql
chown -R root:mysql /usr/local/mysql
chown -R mysql /usr/local/mysql/data
cp /usr/local/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
chmod 0755 /etc/rc.d/init.d/mysqld
chkconfig --levels 2345 --add mysqld # for auto startup
# Apache installeren
cd /usr/local/src/$apache
./configure \
--prefix=/usr/local/apache2 \
--enable-so \
--enable-ssl
make
make install
mkdir /usr/local/apache2/conf/ssl.key
mkdir /usr/local/apache2/conf/ssl.crt
cd /usr/local/apache2/conf/ssl.key
openssl genrsa -des3 -rand some_big_file_1:some_big_file_2 -out localhost.key 1024
openssl rsa -in localhost.key -out server.key
openssl req -new -key localhost.key -out localhost.key.csr
openssl x509 -req -days 365 -in localhost.key.csr -signkey localhost.key -out /usr/local/apache2/conf/ssl.crt/server.crt
# Simpele Apache Startup script zetten in /etc/init.d – zodat Apache bij ?n reboot automatisch herstart)
echo "#!/bin/sh
# description: apache2
# chkconfig: 2345 99 00
case \"\$1\" in
'start')
/usr/local/apache2/bin/apachectl startssl
touch /var/lock/subsys/httpd
;;
'stop')
/usr/local/apache2/bin/apachectl stop
rm -f /var/lock/subsys/httpd
;;
*)
echo \"Usage: \$0 { start | stop }\"
;;
esac
exit 0" > /etc/init.d/httpd
chkconfig --levels 2345 --add httpd # for auto startup
chmod 0775 /etc/init.d/httpd
# PHP installeren :
cd /usr/local/src/$php
if [ -f config.cache ] ; then
rm config.cache
make clean
fi
./configure --with-apxs2=/usr/local/apache2/bin/apxs \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysql=/usr/local/mysql \
--with-zlib \
--with-zlib-dir \
--with-curl \
--enable-track-vars \
--with-config-file-path=/usr/local/apache2/conf \
--enable-trans-id \
--enable-mbstring \
--enable-sockets \
--with-openssl
make
make install
# Kopieren van de phi.ini naar Apache conf map en aanpassen httpd.conf bestand
cp /usr/local/src/$php/php.ini-dist /usr/local/apache2/conf/php.ini
echo "AddType application/x-httpd-php .php" >> /usr/local/apache2/conf/httpd.conf
echo "<?phpinfo()?>" > /usr/local/apache2/htdocs/phpinfo.php


