Php file not running

Forum for you who has PHP installation issues

Moderators: egami, macek, gesf

Post Reply
zak100
New php-forum User
New php-forum User
Posts: 9
Joined: Fri May 24, 2019 1:36 pm

Mon Aug 26, 2019 8:52 pm

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.
zak100
New php-forum User
New php-forum User
Posts: 9
Joined: Fri May 24, 2019 1:36 pm

Tue Aug 27, 2019 5:44 am

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.
MarianDavid
New php-forum User
New php-forum User
Posts: 1
Joined: Mon Sep 30, 2019 12:50 am
Contact:

Mon Sep 30, 2019 1:13 am

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.
Hire PHP Developer | Hire PHP Programmer
Post Reply