How to install and configure php mysql in win7

藏色散人
Release: 2023-03-04 10:14:01
Original
1861 people have browsed it

How to install and configure php mysql in win7: first download php and extract the php compressed package to a directory; then add "PHP_HOME" to the PATH variable; then configure Apache and install mysql; finally restart httpd and Just test it.

How to install and configure php mysql in win7

Recommendation: "PHP Video Tutorial"

Description:

Author's The hardware environment is: Windows 7 64-bit

1. Download php

Select: VC15 x86 Thread Safe, the downloaded file name is: php-7.3.0-Win32-VC15 -x86.zip

1.1 Unzip the compressed package to a directory

For this installation, unzip it to: F:\ApatchInstallWorkspace\dev\servers\php Down.

1.2 Configure environment variables

1.3 Add PHP_HOME to the PATH variable

1.4 Development dos command line, enter: php -version, monitor whether the configuration is successful

2. Running PHP requires a server, here Use Apache web server

Download address: https://www.apachelounge.com/download/ and select Apache 2.3.37 win32. (Needs to correspond to the version of php)

2. Configure Apache

2.1 Unzip httpd-2.4.37-win32-VC15.zip

For this installation, extract it to the author's customized directory: F:\ApatchInstallWorkspace\dev\servers\httpd

##2.2 Configure Apache24/bin/httpd.conf File

2.3 Open the command line, cd to the Apache24\bin directory, run httpd.exe

The cursor stays at the bottom and flashes continuously

At this time, the error message "AH00558: httpd.exe..." appears because ServerName is not configured. Open Apache24/conf/httpd.conf and configure "ServerName localhost:80" as shown below:

After entering "httpd.exe" in the command line again, press Press Enter and there will be no error message. At this time, the cursor stops on the next line and flashes continuously, as shown below:

Open the browser and enter in the navigation bar: http:// localhost/ , you will see the following page (proof that Apache is already running):

Return to the command line, press ctrl c (there may be a delay) to stop apache

2.4 Let apache be installed as a service under window

As an administrator, run the command line and navigate to: Apache24\bin directory, as shown below:

Run: httpd.exe -k install

Can be started or stopped in the "Services" of Windows apache service:

Enter: service.msc in the command line, a pop-up box will appear containing:

If duplicate services are added, You can use: sc delete service name to delete, as follows:

2.5 Double-click ApacheMonitor.exe, or add it to the startup directory

Right-click the apache cursor, you will see a pop-up box, click start in the pop-up box You can start the service. Click stop to close the service.

If the service is started, enter: http://localhost/ in the navigation bar of the browser, and it will See the content below, otherwise you will not be able to access the page.

3. Install a mysql

The author has installed it before, the version is as follows:

4. Configure Apache and PHP

4.1 You need to configure apache’s httpd.conf file:

In F:\ApatchInstallWorkspace\dev\servers\httpd\Apache24\ conf directory, open the httpd.conf file, move to the end of the file (or anywhere in the file), and write the following content:

LoadModule php7_module "F:/ApatchInstallWorkspace/dev/servers/php/php7apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir F:/ApatchInstallWorkspace/dev/servers/php
Copy after login

The version of the component must match the version of apache (here, the Version is 2_4)

4.2 Continue to configure DirectoryIndex in the httpd.conf file

Find DirectoryIndex in the file and configure the following content:

4.3 Navigate to the F:\ApatchInstallWorkspace\dev\servers\php directory and configure php.ini

Copy the php.ini-development file and copy it Name it: php.ini

Find and modify the following parameters:

##4.4 In php.ini, find the 'Dynamic Extensions' section and modify the following extension (open the comment and add the correct path):

extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_curl.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_gd2.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_intl.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_mbstring.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_mysqli.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_openssl.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_soap.dll
extension=F:/ApatchInstallWorkspace/dev/servers/php/ext/php_xmlrpc.dll
Copy after login

4.5 Restart httpd

An error occurred As follows:

After inquiry, it was found that it was due to the problem of downloading the wrong php package (the first download was: php-7.3.0-Win32-VC15-x64.zip) , re-download, download the php-7.3.0-Win32-VC15-x86.zip package

At this time, there will be no problem if you execute httpd -k restart

5. Test installation

Add a text file: test.php in the Apache24\htdocs directory, enter the following content in this file:

<?php phpinfo();
Copy after login

Enter: http://localhost/test.php in the navigation bar of the browser, the following page will appear:

(Note: Apache2.4 needs to be started successfully)

At this point, php is installed successfully.

The above is the detailed content of How to install and configure php mysql in win7. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
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!