阿里云ubuntu系统上安装lnmp时提示PHP安装失败的解决办法

在阿里云ubuntu系统上,使用lnmp官方的安装命令:

wget http://soft.vpser.net/lnmp/lnmp1.5.tar.gz -cO lnmp1.5.tar.gz && tar zxf lnmp1.5.tar.gz && cd lnmp1.5 && ./install.sh lnmp

安装提示失败,看到nginx,mysql都成功了,但PHP失败了。

进入src/php目录,打开config.log,可以看到error。这时,可以把里面的./configure xxx这段话拷贝出来,手动执行。

比如:

./configure –prefix=/usr/local/php –with-config-file-path=/usr/local/php/etc –with-config-file-scan-dir=/usr/local/php/conf.d –enable-fpm –with-fpm-user=www –with-fpm-group=www –enable-mysqlnd –with-mysqli=mysqlnd –with-pdo-mysql=mysqlnd –with-iconv-dir –with-freetype-dir=/usr/local/freetype –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –enable-mbregex –enable-mbstring –enable-intl –enable-pcntl –enable-ftp –with-gd –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –with-gettext –disable-fileinfo –enable-opcache –with-xsl

应该会看到,提示curl检查失败。

可是当我们使用apt install 
libcurl4-openssl-dev来安装curl的时候,又提示要安装其他依赖,如果我们再安装这个依赖的时候,又会提示需要另外的依赖…

显然,是软件包之间的依赖关系出问题了。

于是,我们要修改/etc/apt/source.list文件,一般默认为空。

修改成:

deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main

Major bug fix updates produced after the final release of the 
distribution.

deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main

N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu

team. Also, please note that software in universe WILL NOT receive any

review or updates from the Ubuntu security team.

deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial universe
deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates universe
deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main
deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe
deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe

然后执行:

sudo apt-get clean && sudo apt-get autoclean

sudo apt-get update

sudo apt-get upgrade

sudo apt-get install libcurl4-openssl-dev

就好了。

再在src/php目录执行./configure xxx,就不会提示错误了。

这时,重新安装lnmp,就会成功的。

由于前面已经下载了lnmp.tar.gz,所以这次只需要回到lnmp目录,执行:

./install.sh lnmp

即可。

当然,最好的办法是直接最开始就把系统盘初始化一下,改成ubuntu 16版本的系统。(默认是14版本的)


Posted

in

,

by

Tags:

Comments

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注