win php installation method: first download php; then copy a copy of "php.ini-development" and rename it to "php.ini" and put it in the installation path; then load PHP in Apache; finally configure mysql is enough.
The operating environment of this tutorial: Windows 7 system, PHP 7 version. This article is applicable to all brands of computers.
Recommended: "PHP Video Tutorial"
windows php installation
1. Download address
https://windows.php.net/download
2. Install and configure php
In the installation directory, copy a copy of php.ini-development and rename it to php.ini and put it in the installation path
Add
extension_dir = "c:\php\ext"
c:\php is the php installation path
3. Load PHP in Apache
Open httpd.conf under conf in the apache installation directory
Add
LoadModule php7_module C:/php/php7apache2_4.dll AddType application/x-httpd-php .php .html PHPIniDir "c:\php"
Create a new file under the Apache installation path\htdocs: test.php and edit it:
<?php phpinfo(); ?>
Open the apache service and type http://localhost/test.php in the browser. The page can display apache information
4. Configure mysql
Add a line in the php.ini extension section
extension=php_mysqli.dll
Edit in test.php:
<?php $mysqli = mysqli_connect("localhost","root","pwd") or die("cannt connet"); ?>
apache service opens the mysql service and opens the browser Type http://localhost/test.php
and the password is correct. No information should be displayed. Fill in the wrong password
Warning: mysqli_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in C:\httpd-2.4.34-win64-VC15\Apache24\htdocs\test.php on line 1 can not connet
The above is the detailed content of win php installation tutorial. For more information, please follow other related articles on the PHP Chinese website!