H
H
HAbRAhabp2016-01-31 20:54:25
linux
HAbRAhabp, 2016-01-31 20:54:25

PHP7 not working on Debian 8?

Don't kick me too hard, I'm setting up my first server.
I will try to paint all the information that I did, if something is not enough, write. I can even pay for your help.
I'm trying to install nginx 1.9.10 + PHP/7.0.2.
How do I install nginx

# Obtain the latest source for NGINX from http://nginx.org/en/download.html
wget http://nginx.org/download/nginx-1.9.10.tar.gz
tar -xzvf nginx-1.9.10.tar.gz

# Obtain the development sources for nginScript
hg clone http://hg.nginx.org/njs

# Build and install NGINX
cd nginx-1.9.10
./configure --sbin-path=/usr/sbin/nginx --prefix=/etc/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --user=nginx --group=nginx --with-ipv6 --with-pcre-jit --with-http_gzip_static_module --with-http_ssl_module --with-http_v2_module --add-module=../njs/nginx --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-openssl=../openssl-1.0.1r

everything was set up well, a couple more manipulations with init.d and it all worked. I start the nginx service, hooray!, the html file is displayed.
I'm trying to pull up php. This is where the problems begin. I do everything exactly as in the manual https://codebeer.ru/ustanovka-php-7-v-debian-8/ , except as I specify listen = 127.0.0.1:7777. I connect the processing of php files to the nginx config, like this:
#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

        server {
  server_name 46.36.220.150;
  charset off;
  disable_symlinks if_not_owner from=$root_path;
  index index.html index.php;
  root $root_path;
  set $root_path /var/www/forum;
  access_log /var/www/access.log ;
  error_log /var/www/error.log notice;
  listen *:80;
  listen *:81;
  location / {
    location ~ [^/]\.ph(p\d*|tml)$ {
      try_files /does_not_exists @php;
    }
  }
  location @php {
    fastcgi_index index.php;
    fastcgi_param PHP_ADMIN_VALUE "sendmail_path = /usr/sbin/sendmail -t -i -f [email protected]";
    fastcgi_pass 127.0.0.1:7777;
    fastcgi_split_path_info ^((?U).+\.ph(?:p\d*|tml))(/?.+)$;
    try_files $uri =404;
    include fastcgi_params;
  }
}

    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}

I created the log files and gave them permissions 777. I create an index.php file, I write my favorite command into it
<?php
echo "Heloo World";

I go to 46.36.220.150, in response to silence ... I look at the headlines:
HTTP/1.1 200 OK
Server: nginx/1.9.10
Date: Sun, 31 Jan 2016 17:51:44 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.0.2

everything is ok, there is a connection to php, for the second test I kill the php process, go to /index.php and 502 Bad Gateway appears. I open php again, white screen. What could it be? And how to deal with it?
UPD:
>then look at the php-fpm logs (/var/log/php-fpm.log
>/var/log/php7-fpm.log
[31-Jan-2016 11:37:01] NOTICE: fpm is running, pid 3497
[31-Jan-2016 11:37:01] NOTICE: ready to handle connections
[31-Jan-2016 11:52:34] NOTICE: configuration file /usr/local/php7/etc/php-fpm.conf test is successful

[31-Jan-2016 12:35:57] NOTICE: Finishing ...
[31-Jan-2016 12:35:57] NOTICE: exiting, bye-bye!
[31-Jan-2016 12:35:57] NOTICE: configuration file /usr/local/php7/etc/php-fpm.conf test is successful

[31-Jan-2016 12:35:57] NOTICE: fpm is running, pid 3868
[31-Jan-2016 12:35:57] NOTICE: ready to handle connections
[31-Jan-2016 12:38:23] NOTICE: Finishing ...
[31-Jan-2016 12:38:23] NOTICE: exiting, bye-bye!
[31-Jan-2016 12:41:09] NOTICE: configuration file /usr/local/php7/etc/php-fpm.conf test is successful

[31-Jan-2016 12:41:09] NOTICE: fpm is running, pid 4015
[31-Jan-2016 12:41:09] NOTICE: ready to handle connections

>write before helloword display_errors("on"); error_reporting(E_ALL);
Added, silence
> try another php-fpm -t in the console
[email protected]:/etc/init.d# php-fpm -t
-bash: php-fpm: command not found

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nazar Mokrinsky, 2016-01-31
@HAbRAhabp

To begin with, I would advise you to install Nginx like this:
Is it really easier than compiling? And it still needs to be updated!
Now about PHP 7: https://got-tty.org/debian-jessie-php-7-repository
That is, add one repository (dotdeb is quite well-known and reliable), and then:
Everything! And it will be updated along with the rest of the software. You only need to compile from source when there is no other way or if you need some specific tweaks/patches at compile time.
In addition, with the packages you will register the services, and everything else.
Run it like this:

service nginx start
service php7.0-fpm start

W
wol_fi, 2016-01-31
@wol_fi

xs how you look, but it's better not to look like that)
U82fUko.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question