VPS侦探论坛

 找回密码
 注册
查看: 10176|回复: 2

ubuntu安装LNMP0.6和“502错误及/usr/local/php/sbin/php-fpm: 没有那个文件或目录”解决方案

[复制链接]
发表于 2011-4-9 14:06:36 | 显示全部楼层 |阅读模式

原文地址:http://blog.csdn.net/sdfgh2046/archive/2011/04/08/6310432.aspx 本人原创。
发到此处,供大家批评借鉴。
此问根据debian下系统更改,所以结果对debain应该也适用。

本文已测试环境:ubuntu10.04/ubuntu10.10
最近想搭个网页服务器,网上一搜,发现有个LNMP一键安装包,做的不错,傻瓜安装,就尝试安装,但安完有问题,耗费将近一天才解决,重住数次,以下为解决方案。
1、下载LNMP一键安装包:
去这个网站 http://lnmp.org/install.html最好下载完整包。
2、解压LNMP一键安装包:执行tar zxvf lnmp0.6.tar.gz 或者tar zxvf lnmp0.6-full.tar.gz 就会将LNMP一键安装包解压缩。
3、Ubuntu下安装步骤
cd lnmp0.6-full
sudo sh ./ubuntu.sh |tee lnmp.log

使用 /root/lnmp start 运行。

但安装完之后会出现502错误(502 Bad Gateway)
检查php没有成功安装。
        /usr/local/php下面没有sbin等文件夹
        会报/usr/local/php/sbin/php-fpm文件夹不存在
遂按照脚本手动安装,发现错误,

参照http://www.yyserver.tk/html/space/LNMP/502/2011/0314/51.html找到解决办法
究其原因,就是“Autoconf version 2.58 or higher is required for this script ”要求autoconf版本高于2.58而一键安装包里把autoconf版本换成了2.13.所以解决办法如下:
第一种方法:(推荐用第二种,但此种方法不需要重装,省了很长时间的编译时间。)

首先卸载automake
        apt-get remove automake
这样并不能卸载2.13,需要sudo  rm /usr/local/bin/autoconf 才行。可能是因为2.13编译问题。

然后去 http://files.directadmin.com/ser ... utoconf-2.61.tar.gz下载autoconf2.61
        (不要使用更高版本,经尝试,出错。看来autoconf版本还是问题很多啊。有人说2.13是最经典版,但php偏偏要求更高版本,无奈啊)
        tar xzf autoconf-2.61.tar.gz
        cd autoconf-2.61
        ./configure --prefix=/usr
        make
        make install
       
        然后重新编译php-fpm(重新解压一次lnmp0.6压缩包,因为下面两个gz文件被删除了。)
        tar zxvf php-5.2.14.tar.gz
        gzip -d ./suhosin-patch-5.2.14-0.9.7.patch.gz
        gzip -cd php-5.2.14-fpm-0.5.14.diff.gz | patch -d php-5.2.14 -p1
        cd php-5.2.14/
patch -p 1 -i ../suhosin-patch-5.2.14-0.9.7.patch
        (此处ubuntu.sh脚本中和上句弄反,这也可能是错误原因之一)
        ./buildconf --force
        ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-iconv-dir --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-discard-path --enable-magic-quotes --enable-safe-mode --enable-bcmath --enable-shmop --enable-sysvsem --enable-inline-optimization --with-curl --with-curlwrappers --enable-mbregex --enable-fastcgi --enable-fpm --enable-force-cgi-redirect --enable-mbstring --with-mcrypt --enable-ftp --with-gd --enable-gd-native-ttf --with-openssl --with-mhash --enable-pcntl --enable-sockets --with-xmlrpc --enable-zip --enable-soap --without-pear --with-gettext --with-mime-magic --enable-suhosin
        make
        make install
        mkdir -p /usr/local/php/etc/
        cp php.ini-dist /usr/local/php/etc/php.ini
        strip /usr/local/php/bin/php-cgi
        cd ../
       
        ln -s /usr/local/php/bin/php /usr/bin/php
       
        -----------------------------------
        另一个方法,
此方法更改ubuntu.sh 重新安装。


首先 ./unistall.sh 卸载。然后删掉解压包,重新解压一个新包。
修改/ubuntu.sh中的:(277行左右)
cd php-5.2.14/
patch -p 1 -i ../suhosin-patch-5.2.14-0.9.7.patch

更换顺序。

        更换  ./buildconf --force
        为:
        PHP_AUTOCONF=autoconf213 PHP_AUTOHEADER=autoheader213 ./buildconf --force
        重新安装lnmp
,此方法完美运行,至今没发现问题。
其实还有种方法,可以看作前两种的结合。但我没实验,有兴趣的可以自己尝试,此处之给出思路。
从上面的链接地址下载autoconf2.61.复制到lnmp解压包里,删除原来的autoconf2.13.修改ubuntu.sh 196 197行,替换
2.13为2.61.修改278 279行互换,重新编译安装。
http://lanbolee.com/blog/html/tag/automak 这个链接给出了上面修改的原因,有兴趣深入理解的可以参考。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
 楼主| 发表于 2011-4-10 20:32:46 | 显示全部楼层


没人跟贴,看来我落伍了。自己抢个板凳坐。
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
发表于 2011-4-11 21:22:38 | 显示全部楼层

终于找到解决方案了。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-20 05:28 , Processed in 0.025860 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表