最新的软件包下载下来后,我开始正是编译安装:
一、编译安装Apache2.2.3。
shell>cd httpd-2.2.3
shell>./configure –prefix=/usr/local/apache \
>–enable-rewrite=shared \
>–enable-speling=shared
shell>make
shell>make install
shell>vi /usr/local/apache /conf/httpd.conf
//进入usr/local/apache/bin
shell>./apachectl -k start
//这时候可以通过http://localhost/. 测试
shell>./apachectl -k stop
shell> useradd -g mysql mysql
shell> tar zxvf mysql-5.0.22.tar.gz
shell> cd mysql-5.0.22
shell> ./configure –prefix=/usr/local/mysql
shell> make
shell> make install
shell> cp support-files/my-medium.cnf /etc/my.cnf
shell> cd /usr/local/mysql
shell> bin/mysql_install_db –user=mysql //创建MySQL授权表
shell> chown -R root .
shell> chown -R mysql var
shell> chgrp -R mysql .
shell> bin/mysqld_safe –user=mysql & //启动MYSQL服务器
shell>bin/mysqladmin -u root passwor “123456”//修改 mysql 的 root 密码
a.安装 jpeg6
# mkdir -p /usr/local/jpeg6
# mkdir -p /usr/local/jpeg6/bin
# mkdir -p /usr/local/jpeg6/lib
# mkdir -p /usr/local/jpeg6/include
# mkdir -p /usr/local/jpeg6/man
# mkdir -p /usr/local/jpeg6/man1
# mkdir -p /usr/local/jpeg6/man/man1
# tar -zvxf jpegsrc.v6b.tar.gz
# cd jpeg-6b
# ./configure –prefix=/usr/local/jpeg6/ –enable-shared –enable-static
# make; make install
# cd libpng-1.2.12
# ./configure –prefix=/usr/local/libpng/
# make; make install
# cd freetype-2.1.1
# mkdir -p /usr/local/freetype
# ./configure –prefix=/usr/local/freetype
# make;make install
#cd zlib.1.2.3
# ./configure
# make;make install
# mkdir -p /usr/local/gd2
# cd gd-2.0.33
# ./configure –prefix=/usr/local/gd2 –with-jpeg=/usr/local/jpeg6/
–with-png=/usr/local/lib/
–with-zlib=/usr/local/lib/
–with-freetype=/usr/local/freetype/
# make; make install
# cd libxml2-2.6.24
# mkdir -p /usr/local/libxml2
# ./configure –prefix=/usr/local/libxml2
# make; make install
cd php-5.1.4
./configure –prefix=/usr/local/php –with-apxs2=/usr/local/apache/bin/apxs
–with-mysql=/usr/local/mysql/
–with-libxml-dir=/usr/local/libxml2
–with-expat-dir=/usr/lib –enable-soap
–with-gd=/usr/local/gd2/
–with-jpeg-dir=/usr/local/jpeg6/
–with-zlib-dir=/usr/local/lib/
–with-png=/usr/local/lib/
–with-freetype-dir=/usr/local/freetype/
make
make install
cp php.ini-dist /usr/local/php/lib/php.ini 其中./configure 后的
–prefix=/usr/local/php
–with-apxs2=/usr/local/apache/bin/apxs
–with-mysql=/usr/local/mysql/
–with-libxml-dir=/usr/local/libxml2
是必要的选项
–with-gd=/usr/local/gd2/
–with-jpeg-dir=/usr/local/jpeg6/
–with-png=/usr/local/lib
–with-zlib-dir=/usr/lib
–with-freetype-dir=/usr/local/freetype
这是让PHP支持GD库的配置选项
–with-curl=/usr/local/curl 支持CURL库
–enable-ftp 打开FTP库函数支持
–enable-soap –with-xsl=/usr/local/libxslt –enable-xslt
让PHP支持SOAP, 上面这些一般用得少, 可以去掉
五、重新配置apache2让他支持php。
配置 httpd.conf 让apache支持PHP
vi /usr/local/apache/conf/httpd.conf
找到 AddType application/x-gzip .gz .tgz 在其下添加如下内容
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps
重启apache
/usr/local/apache/bin/apachectl restart
六、安装ZendOptimizer加速PHP
#tar zxvf ZendOptimizer-2.5.3-linux-glibc21-i386.tar.gz
#cd ZendOptimizer-2.5.3-linux-glibc21-i386
#./install.sh
注意:忘了mysql的root口令怎么办