Home > Backend Development > PHP7 > body text

In-depth discussion of the problem that the php7.1 service cannot be found

PHPz
Release: 2023-04-03 14:34:30
Original
617 people have browsed it

When running PHP websites and applications, you may encounter many errors and problems. One of them is "php7.1 service not found" error. This error is usually caused by not correctly configuring the PHP installation path. In this article, we will delve into this issue and provide you with a solution.

The reason why the PHP7.1 service cannot be found

The most common reason for this error is that your system does not correctly configure the installation path of PHP 7.1. When you try to run a PHP script, the server cannot find the PHP language processor, causing this error. This may also mean that PHP was not added to the system path correctly.

Solve the problem that PHP7.1 service cannot be found

There are several ways to solve this problem, we will introduce them one by one below.

Method 1: Manually activate PHP7.1

If you are using a Linux server, you can manually activate PHP 7.1 to solve this problem. You just need to run the following command in the terminal:

sudo a2dismod php5.6
sudo a2enmod php7.1
sudo service apache2 restart
Copy after login

This will disable PHP from the PHP5.6 module and enable the PHP7.1 module as well as restart the Apache service, which will make PHP7.1 work correctly with the Web server to interact.

Method 2: Reinstall PHP 7.1

If you still encounter problems after trying to manually activate PHP7.1, you can try to reinstall PHP7.1. Before reinstalling, you need to completely uninstall PHP7.1 and clear all related configuration data.

Step 1: Uninstall PHP7.1, use the following command:

sudo apt-get purge php7.1*
Copy after login

Step 2: Clear all PHP 7.1 configuration data:

sudo rm -rf /etc/php/7.1/
Copy after login

Now, you can reinstall PHP7.1 and other required components. You just need to use the following command:

sudo apt-get update
sudo apt-get install php7.1 php7.1-mysql libapache2-mod-php7.1
Copy after login

After completing these operations, restart the Apache server.

Method 3: Check the php.ini file

You can also check whether the php.ini file is correctly configured. In some cases, incorrect configuration can cause PHP services not to be found. You can try modifying the php.ini file and making sure the following parameters are set correctly:

extension_dir = "path/to/php/extensions"
Copy after login

Make sure the path is set to the path where your PHP 7.1 extension is located.

Conclusion

If you encounter the "php7.1 service not found" error, don't worry, there are many solutions to this problem. You can manually activate PHP7.1, reinstall PHP7.1, or check the php.ini file configuration. If you are unfamiliar with these operations, please seek professional help. With effective methods to resolve this issue, you can easily continue running and managing your PHP website or application.

The above is the detailed content of In-depth discussion of the problem that the php7.1 service cannot be found. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!