php开发环境的搭建(不用xampp)



在已经装了mysql 和php的机器上装 apache,apr,apr-util和pcre
下载:
下载:apr: http://apr.apache.org/download.cgi
下载:apr-util: http://apr.apache.org/download.cgi
下载:pcre: http://pcre.org/
首先检查机器上有没有装这些软件,一般会装在/usr/local 这个目录里面,如果没有可以find查找下。
如果发现没有就安装之;
1.装apr,我这里是:apr-1.4.8.tar.gz
tar -zvxf apr-xxxxx.tar.gz
进入解压后的目录执行:
./configure  ./configure --prefix=/usr/local/apr/
make
make install
2.装apr-util,我这里是:apr-util-1.5.2.tar.gz
tar -zvxf apr-util-xxxxx.tar.gz
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/
make
make install
3.装pcre,我这里是:pcre-8.32.tar.gz
tar -zvxf pcre-8.32.tar.gz
./configure --prefix=/usr/local/pcre
make
make install
4.装apache,我这里是:httpd-2.4.4.tar.gz 
tar -zvxf httpd-2.4.4.tar.gz 
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/bin/pcre-config 
如果出现类似错误:
checking for APR-util... configure: error: the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file
则在./configure 后面加参数:--with-included-apr
如果出现类似错误:
exports.c:2539: error: redefinition of 'ap_hack_apr_version_string'
则将apr,apr-util 拷贝到解压后的apache目录下的目录(自建)apr,apr-util,这个不能带版本号,否则可能有问题的。
cp -r apr-1.4.6 httpd-2.4.3/srclib/apr
cp -r apr-util-1.4.1 httpd-2.4.3/srclib/apr-util
./configure成功后执行
make
make install
---------------------------------------------------------------
以下为网络中的资料:
#./configure --prefix……检查编辑环境时出现:
1. 缺失 APR APR-util
configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
解决办法:
将APR和APR-util源码下载,解压放到httpd-2.4.3/srclib里面,并去除版本号
cp -r apr-1.4.6 httpd-2.4.3/srclib/apr
cp -r apr-util-1.4.1 httpd-2.4.3/srclib/apr-util
2. 缺少pcre
configure: error: pcre-config for libpcre not found. PCRE is required and available from
解决办法:
下载pcre,编译
tar zxvf pcre-8.31.tar.gz
cd pcre-8.31
./configure && make && make install
3. mod_ssl
checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures
解决办法:yum install openssl-devel
------------------------------------------------
http://blog.csdn.net/lgm252008/article/details/5379722
类似于以下信息:
“exports.c:1653: error: redefinition of 'ap_hack_apr_version_string'
exports.c:1022: error: previous definition of 'ap_hack_apr_version_string' was here
make[2]: *** [exports.lo] Error 1
make[2]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/httpd-2.2.*/server'
make: *** [all-recursive] Error 1”
有些人说路径不对,有些说perl包不对,有的说zlib不对。
反正有病乱投医。
翻了好久的网页才搞定。 
解决办法:
在configure后加上 “--with-included-apr”。
再重新编译, make, make install. 即可:)。
----------------------------------------------------
百度文库中的安装指导:
http://wenku.baidu.com/link?url=qc64s5lDGatJFYRlQiyhgqb6QcBJPjPxWDQjgWBUquBNs4cervsM3mEXDXJgn-DBNFQWQ-AeNK-arrwX5rAHuiFQ44PVjEeK93oVajJK7_q
Linux下安装apache 提示APR not found 解决方法
推荐方法,注意版本号。
1.下载apr安装包:
http://labs.mop.com/apache-mirror//apr/apr-1.4.6.tar.gz
tar zxvf apr-1.4.6.tar.gz
cd apr-1.4.6
./configure --prefix=/usr/local/apr
make && make install
2.下载apr-util安装包:
http://labs.mop.com/apache-mirror//apr/apr-util-1.4.1.tar.gz
tar zxvf apr-util-1.4.1.tar.gz
cd apr-util-1.4.1
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config
3.下载pcre安装包:
http://sourceforge.net/projects/pcre/files/pcre/8.30/pcre-8.30.tar.gz/download
tar zxvf pcre-8.30.tar.gz
cd pcre-8.30
./configure --prefix=/usr/local/pcre
make && make install
4.安装httpd包:
http://httpd.apache.org/download.cgi#apache24
tar zxvf httpd-2.4.3.tar.gz
cd httpd-2.4.3
./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre/bin/pcre-config
make && make install
安装完成。
出现下列问题解决方案:
httpd: Could not reliably determine the server's fully qualified domain name
解决方案:
进入apache的安装目录:
linux : /usr/local/apache/conf
用记事本打开httpd.conf
将里面的#ServerName localhost:80注释去掉即可。
再执行httpd
然后可以通过浏览器访问http://localhost:80,如果页面显示“It works!”,即表示apache已安装并启动成功。
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
解决办法:
semanage port -l|grep http
semanage port -a -t http_port_t -p tcp 81
这个两个命令一是查看,一个是添加,添加完再查看一遍,如果有81,则成功。另可能要以root用户运行。
此外,如果要外网访问,还要打开linux的防火墙:
[root@localhost html]# vim /etc/sysconfig/iptables
[root@localhost html]# service iptables restart
重启apache.
make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs 
解决办法是: http://www.neverkill.com/forum.php?mod=viewthread&tid=22205
httpd: Could not reliably determine the server's fully qualified domain name
解决办法是: http://www.neverkill.com/forum.php?mod=viewthread&tid=22207
(13)Permission denied: AH00072: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
AH00015: Unable to open logs
解决办法是 : http://www.neverkill.com/forum.php?mod=viewthread&tid=22208

 

posted @ 2013-11-05 11:12  myblogszz  Views(607)  Comments(1)    收藏  举报