安装 pthreads 后 Apache 未加载 php7

Apache not load php7 after pthreads install

我在尝试在 ubuntu 服务器 16.04 上安装 php7 + pthreads + apache2 时遇到问题。我在 debian 8 上取得了成功,但使用 php 5.6.24

下面是我在 ubuntu 上安装的脚本(与 debian 相同,但修改为 php7)

apt-get update
apt-get install -y apache2 mysql-server
apt-get install -y build-essential apache2-mpm-prefork apache2-prefork-dev libcurl4-openssl-dev libsqlite3-dev sqlite3 mysql-server libmysqlclient-dev libreadline-dev libzip-dev libxslt1-dev libicu-dev libmcrypt-dev libmhash-dev libpcre3-dev libjpeg-dev libpng12-dev libfreetype6-dev libbz2-dev libxpm-dev
apt-get -y build-dep php7.0

wget http://cl1.php.net/get/php-7.0.9.tar.gz/from/this/mirror -O php-7.0.9.tar.gz

tar zxvf php-7.0.9.tar.gz

rm -rf ext/pthreads/

wget http://pecl.php.net/get/pthreads-3.1.6.tgz -O pthreads-3.1.6.tgz
tar zxvf pthreads-3.1.6.tgz

cp -a pthreads-3.1.6/. php-7.0.9/ext/pthreads/

cd php-7.0.9

rm -rf aclocal.m4
rm -rf autom4te.cache/
./buildconf --force
make distclean

#--enable-debug

./configure --disable-fileinfo --enable-maintainer-zts --enable-pthreads --prefix=/usr --with-config-file-path=/etc --with-curl --enable-cli --with-apxs2=/usr/bin/apxs2 \
--enable-mbstring \
--enable-mbregex \
--enable-phar \
--enable-posix \
--enable-soap \
--enable-sockets \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-zip \
--enable-inline-optimization \
--enable-intl \
--with-icu-dir=/usr \
--with-gd \
--with-jpeg-dir=/usr \
--with-png-dir=shared,/usr \
--with-xpm-dir=/usr \
--with-freetype-dir=/usr \
--with-bz2=/usr \
--with-gettext \
--with-iconv-dir=/usr \
--with-mcrypt=/usr \
--with-mhash \
--with-zlib-dir=/usr \
--with-regex=php \
--with-pcre-regex \
--with-openssl \
--with-openssl-dir=/usr/bin \
--with-mysql-sock=/var/run/mysqld/mysqld.sock \
--with-mysqli=mysqlnd \
--with-sqlite3=/usr \
--with-pdo-mysql=mysqlnd \
--with-pdo-sqlite=/usr \
--enable-fpm \
--with-fpm-user=www-data \
--with-fpm-group=www-data \
--config-cache \
--localstatedir=/var \
--with-layout=GNU \
--disable-rpath

make clear 

make

make install
cp php.ini-development /etc/php.ini

cp /etc/apache2/mods-available/php7.load /etc/apache2/mods-enabled/php7.load
echo "<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
" > /etc/apache2/mods-enabled/php7.conf

/etc/init.d/apache2 restart

cd ..

rm php-7.0.9.tar.gz
rm -rf php-7.0.9
rm -rf pthreads-3.1.6
rm pthreads-3.1.6.tgz

sed -i "s/^;date.timezone =$/date.timezone = \"America\/Sao_Paulo\"/" /etc/php.ini |grep "^timezone" /etc/php.ini


# change local-infile=1 on [mysql] and [mysqld] 
# change document root on  nano /etc/apache2/sites-enabled/000-default and restart apache


apt-get install -y ntp ntpdate

# nano /etc/ntp.conf and add server ntp.shoa.cl iburst
/etc/init.d/ntp stop 
ntpdate ntp.shoa.cl
/etc/init.d/ntp start
date  



#disable browse on apache nano nano /etc/apache2/sites-enabled/000-default remove INDEX
#disable banner

pthreads 和 php 在 cli 上工作正常,但 apache 不加载任何东西,当我尝试重新启动 apache 2 服务时,我看到消息:

"Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details."

最后,当我执行 service apache2 status 时,我看到了这个:

service apache2 status
● apache2.service - LSB: Apache2 web server
   Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
  Drop-In: /lib/systemd/system/apache2.service.d
       └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Sun 2016-08-21 15:37:27 UTC; 1min 55s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3772 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Aug 21 15:37:07 ubuntu-512mb-nyc3-01 systemd[1]: Starting LSB: Apache2 web server...
Aug 21 15:37:07 ubuntu-512mb-nyc3-01 apache2[3772]:  * Starting Apache httpd web server apache2
Aug 21 15:37:07 ubuntu-512mb-nyc3-01 apache2[3772]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to s
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 apache2[3772]:  *
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 apache2[3772]:  * The apache2 instance did not start within 20 seconds. Please read the log files to discover problems
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 systemd[1]: Failed to start LSB: Apache2 web server.
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 systemd[1]: apache2.service: Unit entered failed state.
Aug 21 15:37:27 ubuntu-512mb-nyc3-01 systemd[1]: apache2.service: Failed with result 'exit-code'.

我将非常感谢对此的任何帮助。

这是我的制作方法,也许可以帮助到别人。我创建了一个脚本来在 ubuntu 上使用 apache 全新安装 php7:https://github.com/ibrunotome/Install-php7-with-pthreads-on-ubuntu

如果可能,我将使用最新的 php 版本更新存储库。