Although many blogs have already introduced how to set up the php environment, I tried it today and found it quite difficult. Many of the articles on the Internet are not comprehensive. I will record the process of setting up the environment today, to facilitate future generations. Step 2: Install the Apache server version 0th that I use. During installation, You must select the port number 80 or 2.2.
Although many blogs have already introduced how to set up the php environment, I tried it today and found it quite difficult. Many of the articles on the Internet are not comprehensive. I will record the process of setting up the environment today, to facilitate future generations. Step 2: Install the Apache server version 0th that I use. During installation, You must select the port number 80 or 2.2.
Although many blogs have introduced how to build phpEnvironmentBut I tried it today and thought it was quite difficult. Many of the online versions are not comprehensive.EnvironmentTo facilitate future generations.
Step 2: Install the Apache server
In my version 2.2, You must select port number 80 or 8080 during installation. If both ports are in use, you can modify them in the configuration file after installation, configuration file httpd. conf is located in \ Apache2.2 \ conf. After installation, there will be a small icon in the lower right corner of the taskbar. Click the icon to open Apache Service Monitor as follows:
The Start, Stop, and Restart buttons are used to enable, Stop, and Restart services. After installation, there is no default apache service. These three buttons are the executable files of the supervisor, use the httpd-h command to view how to use it. Here we use the command httpd-k install to install a windows service. Note that if the prompt "failed to open the winNT service manager" is displayed after the command is executedControl Panel-User Account and home security-User Account Change User Account Control settingsClick OK to restart the computer and run the httpd-k install command again. A Windows service named Apache2.2 will be generated. In Apache Service Monitor, click the Start button to Start the Service, and then enter http: // localhost: [port] in the browser. If everything works properly, the string "It works!" is displayed !".
Step 2: Install the mysql server
The version 5.5 is used here. This version is quite good and also comes with a database management tool: MySQL Workbench 5.2 CE
Step 2: install and configure php
The version used here is 5.3.5. Copy the php. ini-development file in the php Directory and rename it as php. ini. Open php. ini in a text editor and modify the following content:
- ; Extension = php_mysql.dll remove comments
- Set the extension library path extension_dir = "D:/Program Files/php/ext" (depending on the php installation path)
If you want to use phpmyadmin, you also need to remove the comments of the sentence extension = php_mysqli.dll. There are many other settings. I don't know whether to list them here.
Step 2: Configure Apache to support php
Open the configuration file httpd. conf and add the following content:
LoadModule php5_module "D:/Program Files/php/php5apache2_2.dll" (depending on the php installation directory)
PHPIniDir "D:/Program Files/php" (depending on the location of php. ini)
AddType application/x-httpd-php. php
AddType application/x-httpd-php. htm
AddType application/x-httpd-php. html
Write the test code as follows:
test
Save as test. php, which is placed under D: \ Program Files \ Apache Software Foundation \ Apache2.2 \ htdocs (depending on the apache installation directory). This location can be found in httpd. conf configuration file.
Start the Apache service and enter http: // localhost: [port]/test. php in the address bar of the browser to test whether the configuration is correct.
Step 2: Test whether the database can be connected
Write the following code:
test
The first parameter of the mysql_connect method is the database server, the second parameter is the user name, and the third parameter is the password. If the port is not 3306, enter mysql_connect ("ip: Port", "root", "psd ")
You can see "OK.
Postscript
I have not eaten for a day. I want to learn web development. I chose php, but this configuration is really annoying.