Home > Backend Development > PHP7 > body text

How to switch the php version in apache

醉折花枝作酒筹
Release: 2023-02-18 07:02:01
forward
2113 people have browsed it

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/";...
Copy after login

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 after login

Copy the two pieces of code

LoadModule php5_module D:/AppServ/php5/php5apache2_4.dll
Copy after login

and

PHPIniDir "D:/AppServ/php5/"
Copy after login

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.
Copy after login

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!

Related labels:
source:csdn.net
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