1、mysql,参考linux下源码安装mysql
2、php,参考linux下源码安装nginx + php笔录
编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-mysql=/usr/local/mysql --enable-fastcgi --enable-fpm --with-mysqli=/usr/local/mysql/bin/mysql_config
3、nginx,参考linux下源码安装nginx + php笔录
4、apache,
编译参数:./cigure --prefix=/usr/local/apache2 --enable-so --enable-mods-shared=most
查看以前的编译选项(如果以前安装过的话):cat /usr/local/apache2/build/config.nice
http.conf添加以下两行
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
虚拟主机设置:
ServerAdmin webmaster@test.com
DocumentRoot /var/www/other-test
ServerName other-test.com
ErrorLog logs/www.other-test.com-error_log
CustomLog logs/www.other-test.com-access_log common
Options Indexes FollowSymlinks MultiViews
AllowOverride None
DirectoryIndex index.html index.php
Order allow,deny
Allow from All
5、重新编译、安装php是能够在apache上运行,编译参数:./configure --prefix=/usr/local/php --with-gd --enable-gd-native-ttf --with-freetype-dir --with-jpeg-dir --with-png-dir --with-mysql=/usr/local/mysql --with-zlib --enable-fastcgi --enable-fpm --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=/usr/local/mysql/bin/mysql_config
cp php.ini-dist /usr/local/php/lib/php.ini
重启apache,如果发现错误“cannot restore segment prot after reloc: Permission denied”解决方案:
1. chcon -t /usr/local/apache2/modules/libphp5.so
2. #vi /etc/sysconfig/selinux file 或者用 #gedit /etc/sysconfig/selinux file 修改SELINUX=disabled 重启