首先安装apache环境
在http://apr.apache.org/download.cgi 下载apr-1.4.6.tar.gz apr-util-1.4.1.tar.gz
在http://ishare.iask.sina.com.cn/f/22932110.html?from=like 下载pcre-8.10.tar.gz (http://pcre.org/)
在http://httpd.apache.org/download.cgi#apache24 下载httpd-2.4.2.tar.gz
# tar -zvxf apr-1.4.6.tar.gz
linux-liangfuming:/home/apache # cd apr-1.4.6/
linux-liangfuming:/home/apache/apr-1.4.6 # ./configure --prefix=/home/apache/apr
#tar -zvxf apr-util-1.4.1.tar.gz
#cd apr-util-1.4.1/
linux-liangfuming:/home/apache/apr-util-1.4.1 # ./configure --prefix=/home/apache/apr-util --with-apr=/home/apache/apr --with-expat=builtin
先只用前面红色一段在make的时候报错
libtool: link:
cannot find the library `/home/apache/apr-util-1.4.1/xml/expat/libexpat.la' or unhandled argument `/home/apache/apr-util-1.4.1/xml/expat/libexpat.la'
然后加了后面一段话,再make的时候 ok (清楚原来make的文件 用#make clean命令)
参考地址:http://crazytoon.com/2010/07/16/error-while-compiling-apache-on-centos-5-5/
make install
#tar -zvxf pcre-8.10.tar.gz
linux-liangfuming:/home/apache # cd pcre-8.10/
linux-liangfuming:/home/apache/pcre-8.10 # ./configure -prefix=/home/apache/pcre
linux-liangfuming:/home/apache # tar -zvxf httpd-2.4.2.tar.gz
#cd httpd
linux-liangfuming:/home/apache/httpd-2.4.2 # ./configure --prefix=/home/apache/apache-home --enable-module=so --with-apr=/home/apache/apr --with-apr-util=/home/apache/apr-util --with-pcre=/home/apache/pcre
启动会报一下错
linux-liangfuming:/home/apache/apache-home/bin # ./httpd -k start
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 192.168.0.25. Set the 'ServerName' directive globally to suppress this message
只需在httpd.conf文件中添加 ServerName 127.0.0.1:80
重新启动就行了
安装PHP
到http://www.php.net/downloads.php 下载php-5.4.4.tar.gz
到http://download.chinaunix.net/download.php?id=35177&ResourceID=6095 下载libxml2-2.7.8.tar.gz
linux-liangfuming:/home/php # tar -zvxf libxml2-2.7.8.tar.gz
linux-liangfuming:/home/php/libxml2-2.7.8 # ./configure
# tar -zvxf php-5.4.4.tar.gz
linux-liangfuming:/home/php # cd php-5.4.4/
#./configure --prefix=/home/php/php-home --with-gettext=/home/php/gettext --with-mysql=mysqlnd --with-libxml-dir=/home/php/libxml2 --with-config-file-path=/usr/local/lib --with-apxs2=/home/apache/apache-home/bin/apxs --enable-pdo=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd
然后遇到以下
错误
Message: SQLSTATE[HY000] [2002] No such file or directory
根据 http://codingcool.com/%E5%85%B3%E4%BA%8Esqlstatehy0002002/
这个问题主要是要修改php.ini中的
socket路径跟mysql一样
修改后运行text.php的时候出现以下错Fatal error: Call to undefined
function ImageCreate() in /var/www/html/bacula-web/core/external/phplot/phplot.php on line 290
发现没有安装gd包
linux_c2:/home/liangfuming/php/php-5.4.4 # ./configure --prefix=/home/liangfuming/php/php-home --with-gettext=/home/liangfuming/php/gettext --with-mysql=mysqlnd --with-libxml-dir=/home/liangfuming/php/libxml2 --with-config-file-path=/usr/local/lib --with-apxs2=/home/liangfuming/apache-home/httpd/bin/apxs --enable-pdo=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-jpeg-dir=/home/liangfuming/php/jpeg/ --with-freetype-dir=/home/liangfuming/php/freetype2/ --with-gd=/home/liangfuming/php/gd-s/
安装失败 查看网页 http://www.51action.cn/?p=414
后面根据http://zjmaslow.blog.163.com/blog/static/203163062201215111851478/
发现php5.4要用自带的gd 所以configure的时候 直接用--with-gd就行
这样用安装还是有问题 configure: error: Problem with libpng.(a|so) or libz.(a|so). Please check config.log for more information.
缺少libpng和libz包
http://www.libpng.org/pub/png/libpng.html 下载libpng包http://www.google.com.hk/url?sa=t&rct=j&q=zlib+-+tar.gz&source=web&cd=1&ved=0CG
QQFjAA&url=http%3A%2F%2Fzlib.net%2F&ei=ghPkT9aNHvHumAXghvGXCw&usg=AFQjCNFL2_0XnMHVaaa9KVkc4LJwZhjSAw&cad=rjt下载libz包
linux_c2:/home/liangfuming/php/php-5.4.4 # ./configure --prefix=/home/liangfuming/php/php-home --with-gettext=/home/liangfuming/php/gettext --with-mysql=mysqlnd --with-libxml-dir=/home/liangfuming/php/libxml2 --with-config-file-path=/usr/local/lib --with-apxs2=/home/liangfuming/apache-home/httpd/bin/apxs --enable-pdo=mysqlnd --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-jpeg-dir=/home/liangfuming/php/jpeg/ --with-freetype-dir=/home/liangfuming/php/freetype2/ --with-gd --with-zlib-dir=/home/liangfuming/php/zlib/ --with-png-dir=/home/liangfuming/php/libpng/
重启后一切正常
--with-config-file-path=/usr/local/php/etc 指定自己的php.ini路径 然后从源码里面 cp过去php.ini 源码里面有个php.ini-development和php.ini-production 如果不是本地调试模式的 选择后者。
就是因为没指定这个 所以反问不了php文件
配置httpd.conf 一定要把下面的话
注释 否则不能访问
#<Directory />
# AllowOverride none
# Require all denied
#</Directory>
http://pecl.php.net/package/PDO_MYSQL 下载PDO_MYSQL-1.0.2.tgz mysql驱动 安装这个前 先安装PDO
http://pecl.php.net/package/PDO
(百度
关键字 mysqlnd pdo 搜索php5.3以后 或者 (php5.4 PDO linux)
,php5.4都用php自带的pdo configure的时候加上即可 所以不用另外下载)
http://down.51cto.com/data/182317 下载 51CTO下载-autoconf-2.61.tar.gz
- 新建文件夹__3_.rar (1.8 MB)
- 下载次数: 3