Home >Backend Development >PHP Problem >What should I do if the website in php7.1 environment cannot be opened?

What should I do if the website in php7.1 environment cannot be opened?

PHPz
PHPzOriginal
2023-04-13 09:04:161023browse

With the development and updating of PHP technology, more and more modern applications require the latest PHP version to run. Therefore, the version of the PHP language is constantly changing and upgrading. With the launch of PHP7.1 version, its performance is higher than the old version, but sometimes the website may not be able to be opened after upgrading to PHP7.1. This article will help you solve this problem.

Problem Description

Some users will find a problem when upgrading PHP 7.1 to their own servers, that is, their websites cannot be opened. When they visit the website on their browser, they see a blank screen or a 404 page.

This problem occurs mainly due to the incompatibility of the application or plug-in with PHP 7.1 version. Therefore, when a program or plug-in cannot adapt to the PHP 7.1 version, website users will encounter problems that cannot be opened, which is very confusing.

Solution

Check PHP version

First, we need to check whether our PHP version is installed correctly and running normally. We can check with the following command:

php -v

If the version number you see is the PHP 7.1.x version, then it means that you have correctly installed the PHP 7.1 version. If not, then you need to install or upgrade to PHP7.1 version.

Check error_log

When a problem occurs, we need to check the error_log to find the specific problem. On Linux systems such as CentOS/RedHat, PHP's error_log is usually located in the /var/log/httpd/error_log file. On Debian/Ubuntu, PHP's error_log is usually located in the /var/log/apache2/error_log file.

You can check the error log with the following command:

tail -f /var/log/httpd/error_log

If you see a bunch of PHP error messages, please find and resolve them. These error messages will provide details about the problematic plugin, script, or application to help you fix it.

Change PHP configuration items

In PHP7.1, some configuration items were enabled by default in previous versions, but are disabled in the new version. If your application relies on these configuration items, you will need to turn them on manually.

For example, if your application depends on the "register_globals" or "magic_quotes_gpc" configuration items, but these are disabled in PHP7.1, you need to manually turn on these configuration items.

You can open them by editing the php.ini file, for example:

vi /etc/php.ini

In this file, you can set register_globals and magic_quotes_gpc to on. Then save the file and restart the web server.

Update applications or plug-ins

Sometimes there is code in the program or plug-in that is not compatible with PHP7.1, causing the website to fail to open. In this case, you need to update the application or plugin to adapt to the PHP7.1 version.

In some cases, the developer of the program or plug-in may have released an updated version, and users of the application or plug-in can directly upgrade to the latest version.

In other cases, you may need to manually modify the code in the program or plug-in to make it comply with PHP7.1 standards.

SEEK PROFESSIONAL HELP

If none of the above solutions solve your problem, then you need to consider seeking professional help. You can contact your web hosting provider or developer for help resolving the issue.

Summary

In this article, we introduced how to solve the problem that the website cannot be opened when you upgrade to PHP7.1. First, check whether the PHP version is installed correctly and functioning properly. Then, check the PHP error log to find the problem. Next, you may need to change the PHP configuration items to adapt to the PHP7.1 version. If none of these resolve the issue, then you may need to update the app or plugin, or seek professional help to resolve the issue.

The above is the detailed content of What should I do if the website in php7.1 environment cannot be opened?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn