Php file not running

A

Anonymous

Guest
Hi,
If I just type localhost, then I can see my index.html page. I can also run other html pages like:

<html>
<head>
<title> PHP Test</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>

These pages are stored in:
/var/www/html . But when I run a php file like:

<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php echo '<p>Hello World</p>'; ?>
</body>
</html>

I am getting the error:
502 bad gateway.

Can some body please guide me.

Zulfi.
 
Hi,

I found my error:

I am getting following message in error.log:
connect() to unix:/var/run/php/php7.0-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: 127.0.0.1, server: _, request: "GET /info.php HTTP/1.1", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "localhost"


In the directory /var/run/php/ I did not have this file. I have php7.2-fpm.sock file instead so I changed my configuration file:

i.e /etc/nginx/sites-enabled/default after creating its copy at the following location:

location ~ \.php$ {
include snippets/fastcgi-php.conf;
#
# # With php-fpm (or other unix sockets):
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;//at this point. Note don't write this comment in the file
# # With php-cgi (or other tcp sockets):
# fastcgi_pass 127.0.0.1:9000;
#}

# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
}





Zulfi.
 
Hello,

I think an older libpcre3 is installed and satisfies the dependency in the php7.0 package, but only the newer library package provides pcre_jit_stack_free.
If this is the case,
do an apt-get install libpcre3
hope this will help
Ref.: https://github.com/oerdnj/deb.sury.org/issues/372

Or you can hire PHP programmer from reputed company.

Thanks.
 
Back
Top