Method: 1. Execute the "find / -name" command to find the path of the upgraded "php.ini" file; 2. Add "PHPIniDir space new php.ini path" to the "httpd.conf" file , change the php version; 4. Execute the "service" command to restart the service.
The operating environment of this tutorial: windows7 system, PHP5.5&&PHP5.6 version, DELL G3 computer
1. Check what PHP is used by Apache Version
Create a new document, name it info.php, and upload it to the root directory of the website (such as: /var/www/html/)
info.php document content:
<?php phpinfo(); ?>
Visit http://domain name or IP/info.php, you can check the current Apache version (I have already configured it, so it is version 5.6)
2. Use the find command to find the path to the upgraded PHP configuration file php.ini (such as: /etc/php.ini)
find / -name php.ini
3. Find the httpd.conf file and add the following code at the end (if you don’t know the path, you can use the find / -name command to find it. )
PHPIniDir 空格 php.ini路径
For example:
PHPIniDir /etc/php.ini
4. Restart the http service, visit http://domain name or IP/info.php and check whether it is successful
service httpd restart
Recommended: "2021 PHP Interview Questions Summary (Collection)" " php video tutorial》
The above is the detailed content of How Apache changes PHP version information. For more information, please follow other related articles on the PHP Chinese website!