Answer the question
In order to leave comments, you need to log in
After upgrading from PHP 5.6 -> 7.2, when index.php is accessed, the contents of the file are displayed on the screen, how can I fix it?
Installed php 7.2 on the server, specified
upstream php in Nginx config
{
server unix:/var/run/php/php7.2-fpm.sock;
}
Reloaded Nginx and when you go to the site, the contents of the index.php file are displayed on the screen, what's the matter? If you write
server unix:/var/run/php/php5.6-fpm.sock; then the problem goes away, and the Html template is loaded from the directory on the server, where to dig? Do you really need to reconfigure some Nginx rules for Php 7.2, or maybe the error lies in the fact that the script was written for PHP 5.6 and was never tested for 7.2, but it doesn’t introduce any errors either.
Answer the question
In order to leave comments, you need to log in
I also displayed at first if you have centos 6 or 7
then there is php.conf in the /etc/httpd/php-available.d folder
, and there is also probably a php.conf.new file, change it to php.conf, keeping the old one your version
should be something like here
#
# PHP is an HTML-embedded scripting language which attempts to make it
# easy for developers to write dynamically generated webpages.
#
# Cannot load both php5 and php7 modules
<IfModule !mod_php5.c>
<IfModule prefork.c>
LoadModule php7_module modules/libphp7.so
</IfModule>
</IfModule>
<IfModule !mod_php5.c>
<IfModule !prefork.c>
LoadModule php7_module modules/libphp7-zts.so
</IfModule>
</IfModule>
#
# The following lines prevent .user.ini files from being viewed by Web clients.
#
<Files ".user.ini">
<IfModule mod_authz_core.c>
Require all denied
</IfModule>
<IfModule !mod_authz_core.c>
Order allow,deny
Deny from all
Satisfy All
</IfModule>
</Files>
#
# Allow php to handle Multiviews
#
AddType text/html .php
#
# Add index.php to the list of files that will be served as directory
# indexes.
#
DirectoryIndex index.php
# mod_php options
<IfModule mod_php7.c>
#
# Cause the PHP interpreter to handle files with a .php extension.
#
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
#
# Uncomment the following lines to allow PHP to pretty-print .phps
# files as PHP source code:
#
#<FilesMatch \.phps$>
# SetHandler application/x-httpd-php-source
#</FilesMatch>
#
# Apache specific PHP configuration options
# those can be override in each configured vhost
#
php_value session.save_handler "files"
php_value session.save_path "/var/lib/php/session"
php_value soap.wsdl_cache_dir "/var/lib/php/wsdlcache"
#php_value opcache.file_cache "/var/lib/php/opcache"
</IfModule>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question