Apache在pthreads安装后没有加载php7

时间:2016-08-21 15:46:03

标签: apache pthreads php-7

我在尝试在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'.

我真的很感激任何帮助。

1 个答案:

答案 0 :(得分:0)

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

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