一. 源码编译Apache
http://www.php100.com/manual/apache2/programs/configure.html Apache编译参数介绍
- tar zxf httpd-2.2.10.tar.gz
- cd /usr/local/src/httpd-2.2.10;
- echo "./configure --prefix=/usr/local/apache2 \
- --enable-mods-shared=all --enable-rewrite=shared --with-included-apr \
- --enable-so --enable-headers --enable-expires --enable-include \
- --enable-alias --enable-proxy --enable-rewrite --enable-setenvif \
- --disable-autoindex --disable-negotiation --disable-cgid --disable-asis \
- --disable-actions --disable-userdir " >install.sh;
- chmod +x install.sh
- cd /usr/local/src/httpd-2.2.10&&./install.sh
- cd /usr/local/src/httpd-2.2.10&&make&&make install
- cd /usr/local; ln -s apache-2.2.10 apache
二.源码编译mysql
- cd /usr/local/src/mysql-5.0.37;
- echo " CFLAGS=\"-O3 -mpentiumpro\" CXX=gcc CXXFLAGS=\"-O3 \
- -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti\" \
- ./configure --prefix=/usr/local/mysql-5.0.37 --enable-assembler \
- --with-libwrap=/usr/lib/ --with-charset=gbk \
- --with-extra-charsets=gb2312,big5,latin1,utf8 \
- --with-mysqld-user=mysql --enable-large-files \
- --with-big-tables --with-client-ldflags=-all-static \
- --enable-thread-safe-client \
- --with-mysqld-ldflags=\"-all-static\"" >configure.sh;
- chmod +x configure.sh
- cd /usr/local/src/mysql-5.0.37&&./configure.sh
- cd /usr/local/src/mysql-5.0.37&&make&&make install
- cd /usr/local; ln -s mysql-5.0.37 mysql
- cd /usr/local/src/mysql-5.0.37;/bin/cp -rf support-files /usr/local/mysql/
- groupadd mysql;useradd -g mysql mysql
- chown -R mysql:mysql /usr/local/mysql
- cd /usr/local/mysql;bin/mysql_install_db --user=mysql
- cp /usr/share/mysql/my.cnf /etc/my.cnf
- /usr/local/mysql/bin/mysqld_safe --user=mysql &
- > grant all privileges on *.* to 'root'@'localhost' identified by '123456';
- > grant all privileges on *.* to 'root'@'%' identified by '123456';
- > flush privileges;
- > quit;
三.源码编译php
- cd /usr/local/src/php-5.2.13;
- echo "./configure --prefix=/usr/local/php-5.2.13 \
- --with-mysql=/usr/local/mysql \
- --with-mysqli=/usr/local/mysql/bin/mysql_config \
- --with-apxs2=/usr/local/apache/bin/apxs \
- --with-config-file-path=/usr/local/php/etc \
- --with-iconv --with-libxml-dir --with-gd --with-jpeg-dir \
- --with-png-dir --with-bz2 --with-freetype-dir --with-iconv \
- --with-zlib --enable-gd-native-ttf --enable-mbstring \
- --enable-sockets" >install.sh;
- chmod +x install.sh
- cd /usr/local/src/php-5.2.13&&./install.sh
- cd /usr/local/src/php-5.2.13&&make&&make install
- cd /usr/local; ln -s php-5.2.13 php
四.整合lamp
- # cp /usr/local/src/php-5.2.14/php.ini-dist /usr/local/php/etc/php.ini
- vi /etc/httpd/httpd.conf
- AddType application/x-httpd-php .php .phtml
- #添加这一条 # vi test.php
- <?php
- phpinfo();
- ?>
五.感受
安装的过程出现跟多错误,整整搞了两天才搞定。其中最麻烦的就是php,php主要是依赖包比较多,我传了一个附件上来,附件是有比较细的安装方式,也有php依赖包的下载路径。有些包的版本较旧,可以先到主目录,然后再找现有的版本下载就可以。其中一个最头疼的问题就是编译并安装完php后,提示没有找到libphp5.so这个文件。再网上找了很久有人说是selinux的问题,可能selinux确实会影响php的安装。但是我可以确定我的selinux是关闭的。最后找了n久,也不知哪来的灵感,所有的php ./configure 后的参数都是手敲上去的,不用复制粘贴。一复制就有问题,手敲就没问题。所以告诫大家,编译php时,最好手敲上去。
附件也是我在网上down的,写的比较全,编译的参数和我上述的有些出入。根据个人需要调整吧。