Home > Article > Backend Development > PHP environment (apache, PHP, Mysql) detailed configuration method_PHP tutorial
Preparation before installation: Download PHP, apache, and mysql installation packages. You can download them from the relevant official websites. The following are the installation steps
1. Install Apache, just run the installation directly. We will install it to the D:/PHP/Apache/ directory
2. Place the decompressed contents of the PHP compressed package into the specified PHP directory (specify this to be D:/PHP/ and rename it to PHP5)
3. Modify the Apache configuration file
1. Load the PHP module and add
in the Apache configuration file
LoadModule php5_module "D:/PHP/PHP5/php5apache2_2.dll" //D:/PHP/PHP5/ is the php installation directory
2. Add AddTypeapplication/x-httpd-php .php .phtml //Set apache solution file type
//Specify the php configuration file path
Add phpinidir "D:/PHP/PHP5" to set the php configuration file directory (first rename PHP.iniDevelopment in the PHP installation directory to php.ini)
4. Restart Apache
5. Verify whether PHP is installed successfully
Here we create a phpinfo.php file in the D:PHPApachehtdocs directory and enter the following content
[php] view plaincopy
phpinfo();
?>
Then open the browser and enter http://localhost/phpinfo.php. The default is port 80. If it is not port 80, the port number must be added after localhost. If the installation is successful, open the PHP related information page, otherwise check whether the relevant directories are installed correctly.
6. Install the mysql service, run the mysql installation file directly, and follow the prompts to perform the installation step by step
5Add Mysql module
1. Find libMysql.dll or phpmysql.dll and phpmysqli.dll in the PHP installation directory and copy them to the Windows directory on the C drive
2. Open the PHP configuration file
1. Cancel extension=php_mysql.dll and extension=php_mysqli.dll and remove the semicolon
2. Set the extension path extension_dir="D:/PHP/PHP5/ext"
in php.ini
3. Restart Apache
4. Visit the phpinfo.php page again in the browser. If the page information has more mysql and mysqli columns, it means the module was added successfully. Otherwise, recheck the above steps
Verify whether mysql is
Excerpted from jt521xlg’s column