编程语言
首页 > 编程语言> > 在debian 9上安装带有apache2的PHP7.1时出错

在debian 9上安装带有apache2的PHP7.1时出错

作者:互联网

你好我用debian的9安装安装了apache.然后用apt-get安装php7.0,但我需要安装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>

这有什么问题?

解决方法:

使用Sury repo(https://deb.sury.org/),这是一个小脚本,可以将它添加到你的回购列表中.

#!/bin/bash
# To add this repository please do:

if [ "$(whoami)" != "root" ]; then
    SUDO=sudo
fi

${SUDO} apt-get install apt-transport-https lsb-release ca-certificates
${SUDO} wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
${SUDO} sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
${SUDO} apt-get update

>资料来源:https://packages.sury.org/php/README.txt

使用Debian repo来安装SW而不是去手动是一个更好的选择,它会避免你很多头痛:)

标签:php,debian,apache-httpd
来源: https://codeday.me/bug/20190816/1668361.html