在debian 9上用apache2安装PHP7.1时出错

你好我安装了debian的9安装的Apache。 然后安装php7.0与apt-get,但我需要安装php7.1,起初我做的

$ su $ apt-get purge php7.0 

所以我从http://php.net/downloads.php下载了php 7.1.10并做出了这个

 $ ./configure --with-mcrypt $ make $ make install 

phpinfo()得到的php7.0,所以我做

 $ su $ apt-get purge php7.0 $ apt-get autoremove php7.0 

并知道phpinfo()不工作。 我认为,现在的PHP没有安装。

然后从http://php.net/downloads.php下载php 7.1.11(今天新增)和里面

 $ tar jxvf php-7.1.11.tar.bz2 $ apt-get install build-essential $ apt-get install libxml2-dev libmcrypt-dev libjpeg-dev $ cd php-7.1.11 $ ./configure --with-mcrypt --with-pdo-pgsql=/etc/postgresql/9.6/main --with-openssl=/usr/bin/openssl --with-zlib --with-apxs2=/usr/bin/apxs2 

在所有的检查之间,我会得到下一个错误

 Configuring SAPI modules checking for Apache 2.0 handler-module support via DSO through APXS... [Fri Oct 27 12:30:45.328686 2017] [core:warn] [pid 12056] AH00111: Config variable ${APACHE_RUN_DIR} is not defined apache2: Syntax error on line 80 of /etc/apache2/apache2.conf: DefaultRuntimeDir must be a valid directory, absolute or relative to ServerRoot yes configure: error: Cannot find OpenSSL's <evp.h> 

这有什么问题?

apt-get install libssl-dev

你必须安装openssl开发文件才能编译php

https://packages.debian.org/stretch/libssl-dev

另外,一旦你成功地编译php,不要忘了把apache模块改成php.so的正确目录

在apacheconfiguration中必须有一行代码行LoadModule php7_module modules / libphp7.so