Home >Backend Development >PHP7 >How to switch the php version in apache

How to switch the php version in apache

醉折花枝作酒筹
醉折花枝作酒筹forward
2021-07-06 09:17:442169browse

When we open apache, we can see that php has many version numbers. When we don’t want to use php5, how should we switch the version to php7? The editor will introduce to you the switching method below.

How to switch the php version in apache

1 Check the official website

Open the official website and find the FAQhttps://www.appserv.org/en/faq/

Question

to switch Version of PHP do?

Answer

to the Shortcut -> PHP Version Switch switch PHP Version needed immediately.

2 Change php version

Find the php version switch in the start menu of win10, click it, and the dialog box will flash and then disappear quickly.

How to switch the php version in apache

3 Check the version

Enter localhost/phpinfo.php in the browser address bar

In the PHP version under Core, php The version number remains unchanged (5.5.*)

4 Parameter modification

Open the AppServ/php5/extras/swver.php file, we found that

<?php
error_reporting(0);
$conf="D:/AppServ/Apache24/conf/httpd.conf";
$php5ini="D:/AppServ/php5/";
$php7ini="D:/AppServ/php7/";...

The following code is Judgment statements, etc., but we can see $conf and modify it according to the path

Open D:/AppServ/Apache24/conf/httpd.conf

Find the following code (about line 180)

LoadModule php5_module D:/AppServ/php5/php5apache2_4.dll<IfModule mod_php5.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps</IfModule><IfModule mod_php7.c>
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps</IfModule>PHPIniDir "D:/AppServ/php5/"

Copy the two pieces of code

LoadModule php5_module D:/AppServ/php5/php5apache2_4.dll

and

PHPIniDir "D:/AppServ/php5/"

and add # in front of the original code

Change the 5 in the pasted code to 7

Restart Appche and run localhost/phpinfo.php

Success!

How to switch the php version in apache

5 Failed to install laravel5.5

 The openssl extension is required for SSL/TLS protection but is not available. If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the &#39;disable-tls&#39; option to true.

Open php.ini and modify the configuration ssl, remove the comma ";" in front of extension=php_openssl.dll

Restart Appche!

Recommended learning: php video tutorial

The above is the detailed content of How to switch the php version in apache. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete