Text tutorial on installing PHP running environment on Windows system_PHP tutorial

WBOY
Release: 2016-07-21 15:35:18
Original
811 people have browsed it

1. Download related software

Software download address
httpd-2.2.15-win32-x86-no_ssl.msi http://httpd.apache.org/download.cgi
mysql-5.1. 46-win32.msi http://dev.mysql.com/downloads/
php-5.2.13-Win32.zip http://www.php.net/downloads.php
phpMyAdmin-3.3.3 -all-languages.zip http://www.phpmyadmin.net/home_page/downloads.php
ZendOptimizer-3.3.3-Windows-i386.exe http://www.zend.com/en/downloads/
Create a folder named lamp on the C drive of the Windows system as the installation location of the Web environment, and install all the software required by the environment into this folder.

2. Install Apache

1 The "Set System Information" dialog box requires the input of several basic configuration parameters. These three pieces of information can be filled in arbitrarily, even if they are invalid.
Enter the "lampbrother.net" domain name in the first input box.
Add www.lampbrother.net server name in the second input box.
The third one to add is the contact email address, which will be provided to visitors in the event of a system failure.
is the email address of the administrator of this web server. Enter lampteacher@gmail.com here.
Finally, select the port of the web server, use the default port 80, and start it automatically as a system service (the first item).
2 A dialog box for selecting the installation type pops up. "Typical" is the default installation, and "Custom" is the user-defined installation. We choose the "Typical" type here.
3 A dialog box for selecting the installation location will pop up, and set the installation location of Apache to "d:lampapache2".
4 A dialog box pops up to confirm the installation. If you need to check again, you can click the "5 The installation interface pops up. The installation wizard is successfully completed. At this time, the small green icon management tool of Apache should appear in the status bar in the lower right corner, indicating that the Apache service has started running.
6 After Apache is installed according to the above steps, its The installation directory is specified under "C:lampapache2".
The configuration file of Apache is the "C:lampapache2confhttpd.conf" file.
The place where Apache stores web pages is the "C:lampapache2htdocs" folder.
7 There are many ways to start and stop Apache in Windows systems, and the following examples can all be done.
Click Start Menu->All Programs->Apache HTTP Server 2.2->Control Apache Server under Stop, Start or Restart.
Click My Computer->Management->Services and Applications->Services->Apache2.2 option, click Stop, Start or Restart.
Start, stop or restart the Apache server through the small green icon management tool of Apache on the status bar in the lower right corner of the Windows system.
8 If Apache starts successfully, it can pass the browser test. Open the browser and enter the URL http://localhost/ in the address bar.
You can see It works! This means that Apache is successfully installed and can be used.

3. Install MySQL
Installing the MySQL database server can be divided into two parts:
One part is the installation of the program; the other part is using the MySQL configuration assistant to create the MySQL configuration file, some detailed configuration choices, and Set a password and other content for the MySQL server.
The MySQL Configuration Assistant is automatically run after the first part of the installation is completed, and can also be started manually after the MySQL installation is completed.
1 Install the "mysql-5.1.46-win32.msi" file.
2 The installation type selection dialog box pops up, with three options, namely Typical, Complete and Custom.
Select "Custom" here to get more options, allowing us to specify the installation location. Click the "Next>" button to proceed to the next step of installation.
3 The user-defined settings page pops up, left-click on the "Developer Components" option,
then select the second item "This feature, and all subfeatures, will be installed on local hard drive.",
That is, "This part, and the contents of its subordinate subparts, are all installed on the local hard disk."
4 Specify the installation location. Click the "Change..." button to change the installation location and specify it under the "C:lampmysql5" folder.
Not only does this option need to change the installation location, but the previous options include MySQL Server option (MySQL Server),
MySQL Client Programs option (Client Programs), and File option (Documentation). All of them need to change the installation location. Operation It's all the same.
Click the "Change..." button to manually change the installation location. You can point the installation locations of these options to the "C:lampmysql5" folder.
It is recommended that the server data file "MySQL Server Datafiles" option not be specified in the same partition as the operating system. This can prevent the data from being cleared when the system is backed up and restored.
Here it is assigned to the D:datafiles folder. After the settings are completed, click the "Next>" button to proceed to the next step of installation.
5 The installation location confirmation dialog box will pop up. You need to wait for a few seconds to install. At this point, the installation of the MySQL database software is completed, and the interface appears.
Check "Configure the MySQL Server now", click the "Finish" button to end the software installation and start the MySQL configuration wizard.
6 Then automatically run the MySQL Configuration Assistant, reaching the second part of the MySQL configuration phase of the installation.
7 A configuration type selection dialog box pops up, with two options: "Detailed Configuration" and "Standard Configuration". Select the first item "Detailed Configuration".
The next few configuration steps are all things that the MySQL Configuration Assistant needs to set when selecting this item. After selecting the type, click the "Next>" button to continue the next step of configuration.
8 The Server Type selection dialog box pops up, which determines how much main memory the MySQL server will try to reserve. The larger the main memory, the faster the server will be, but the impact on other programs will be greater.
There are three options here:
Developer Machine option is the development and testing type, MySQL takes up very few resources;
Server Machine option is the server type, MySQL takes up more resources;
Dedicated MySQL Server Machine option is A dedicated database server, MySQL consumes all available resources.
Choose different types. For web developers, the first Developer option is the best choice, and the other two are best for large databases. After selecting the type, click the "Next>" button to continue the next step of configuration.
9 The Database Usage dialog box pops up. They determine which data table types the MySQL server will support.
There are also three options here:
The "Multifunctional Database" option is a general multifunctional type, a better type, and is the default selected type;
The "Transactional Database Only" option is a server type, focusing on transactions Processing;
The "Non-Transactional Database Only" option is non-transactional, relatively simple, and mainly used for monitoring and counting.
Users can change it according to the actual use of the database. We use the default selection here and click the "Next>" button to continue with the next configuration.
10 The InnoDB Tablespace Setting dialog box pops up, where you should specify a storage location for the InnoDB database file. The default storage location is the MySQL installation directory.
The default storage location is used here. Click the "Next>" button to continue the next step of configuration.
11 The Concurrent Connections selection dialog box pops up. The options here determine the number of database connections opened at the same time.
There are three options:
The first "Decision Support (DSS)/OLAP" option can have 20 connections;
The second "Online Transaction Processing (OLTP)" option can have 500 connections ;
The third "Manual Setting" option manually sets a number of connections.
For a MySQL server running on a computer used for software development, which does not require too many connections, there should be no problem in selecting the first "Decision Support (DSS)/OLAP" at this time.
However, for MySQL servers working at full speed on some popular websites, the number of concurrent connections may be very large. In this case, the second "Online Transaction Processing (OLTP)" option should be selected.
Use the default first option here, click the "Next>" button to continue the next step of configuration.
12 The Enable TCP/IP Networking dialog box pops up. In the Windows system environment, there are two ways to communicate between the MySQL server and the application:
One is through named pipes;
The other is through the network protocol TCP/IP.
The recommended configuration given by the MySQL Configuration Assistant is to activate TCP/IP and use port 3306. Select the multi-check box (join the firewall and do not block this port) and use the default recommended configuration. Click the "Next>" button to continue the next step of configuration.
13 The Default Character Set dialog box pops up. When saving text data to the database, MySQL supports various existing character sets.
Here we choose the third item. In order to better handle the Chinese character set, select or fill in "utf8" in the Character Set and click the "Next>" button to continue the next configuration.
14 The Install as Windows Service dialog box pops up. Here you can choose whether to install the MySQL service as a Windows system service.
In this way, you can manage the MySQL server through Windows system service management. You can also specify the Service Name (service identification name).
Another option is to choose whether to add the MySQL bin directory to the Windows PATH (after adding it, you can directly use the files in the bin directory without specifying the directory name. ). (Please select)
Accept the default settings recommended by the MySQL Configuration Assistant here, and click the "Next>" button to continue the next step of configuration.
15 The Security Options dialog box pops up. This is the most important configuration. You need to decide who is allowed to connect to the MySQL server and whether you must enter a password to establish a connection.
Set to the most secure setting, because root is the only user and the MySQL system administrator user, so the root user should be allowed to enter the correct password to connect to the database, and only allow him to log in locally.
Do not check the second option. No anonymous accounts will be created here. The so-called anonymous accounts refer to accounts that can connect to the database without a password. Click the "Next>" button to continue the next step of configuration.
16 A confirmation dialog box will pop up. Confirm whether the configuration settings made are correct. If they are incorrect, click the "17 MySQL post-installation environment. After installation and configuration are completed according to the above steps, the installation directory of MySQl is under "C:lampmysql5";
MySQL configuration file is the "C:lampmysql5my.ini" file; MySQL data file The storage location is the "D:datafilesdata" folder.
18 To start and stop MySQL in Windows system, right-click My Computer->Management->Services and Applications->Service->MySQL option, click Stop, Start or Restart.
19 To test whether the MySQL database installation is successful, you can open a MySQL client to log in to the MySQL server for testing.
Use Start Menu->All Programs->MySQL->MySQL Server 5.1->MySQL Command Line Client to start MySQL’s command line interpreter program mysql.exe,
Then enter the input when configuring MySQL password. If all goes well, you should see the MySQL input prompt in the input window. Next, execute the status command. The result indicates that the MySQL server is successfully installed.

Solution:
Problems and solutions when installing MYSQL: When installing MySQL, the system prompts: Cannot create windows service for mysql.error:0
The reason is that there is old mysql in the system The service exists. The solution is as follows:
To permanently delete the old mysql service, the user needs to execute the following command on the command line with administrative rights:
C:>sc delete mysql
[SC] DeleteService SUCCESS
When installing a service, if a similar situation occurs, check whether there are any leftover service programs in the service. The solution is to delete the old service and then install the new service.

3. Install PHP
When installing the PHP server, there are two tasks that must be completed.
PHP is a module of the Apache server. It needs to be plugged into Apache to help it process PHP files, so the first task is to load the PHP module in Apache.
During development, you also need to use PHP programs to connect to the database and operate the database, so the second task is to configure PHP's MySQL extension interface.
(1) Install PHP as an extension module of the Apache server.
Step 1: "php-5.2.13-Win32.zip" file. Just decompress the contents of this ZIP file into a selected subdirectory. Here we will decompress it into the "C:lampphp5" directory.
Step 2: Load PHP into Apache as a module.
The loading method is to write three lines in the Apache configuration file httpd.conf: the first line loads the PHP module;
the second line tells the Apache server that the suffix is ​​.php or specifies the use of files with other suffixes. PHP parsing; the third line specifies the location of the PHP configuration file.
We just insert the following three lines into a certain location in the Apache configuration file C:lampapache2confhttpd.conf.

LoadModule php5_module "C:/lamp/php5/php5apache2_2.dll" #Load PHP module
AddType application/x-httpd-php .php .phtml #What kind of suffix file does the PHP module parse
PHPIniDir "C:/lamp/php5" #Specify the location of the PHP configuration file
Note:
The first line refers to loading PHP 5 in module mode. Insert this line into the Apache configuration file httpd.conf Just below the line "#LoadModule vhost_alias_module modules/mod_vhost_alias.so". Among them, C:/lamp/php5/php5apache2_2.dll is the file in the corresponding path for installing PHP. Be careful not to confuse php5apache2_2.dll, php5apache2.dll and php5apache.dll. php5apache.dll is only applicable to versions before Apache 2.0. The php5apache2.dll in the PHP 5 compressed package is only applicable to apache2.0.* version. If it is 2.2 .*For versions above, php5apache2_2.dll must be used. Otherwise some loading errors may occur.
The second line is to add PHP support. Tell Apache which suffixes to parse as PHP. For example, let Apache parse files with .php or .phtml suffix into PHP. Find the "AddType application/x-gzip .gz .tgz" item in the Apache configuration file and add the "Addtype application/x-httpd-php .php .phtml" line below it. Files with any suffix can be parsed into PHP, as long as they are added to the added statement and separated by spaces. Here is an example of adding one more .phtml.
The third line specifies the location of the PHP configuration file php.ini. Just add it under the second line "Addtype application/x-httpd-php .php .phtml", where "C:/lamp/php5 "Specifies the previously selected PHP decompression directory.

Step 3: Create PHP configuration file. Simply rename the php.ini-recommended file under the PHP decompression directory C:/lamp/php5 to php.ini.
You can also rename the file php.ini-dist in the C:/lamp/php5 directory to php.ini, but the configuration file automatically adds "//" to all added content to increase security and also increase Trouble; if you rename php.ini-recommended to php.ini, the configuration file will not add "//" to the added content, which reduces security but is more convenient. Here, rename the php.ini-recommended file to the php.ini file.
Step 4: Restart the Apache server. As long as changes are made to the Apache configuration file httpd.conf or the PHP configuration file php.ini, the Apache server should be restarted. The Apache server loads the configuration file httpd.conf when it starts, so that changes in the configuration file take effect.
As a working module of the Apache server, PHP also loads the configuration file php.ini when Apache starts to make the modifications effective.
Step 5: Test whether the PHP installation is successful. The above steps have installed PHP as an extension module of Apache and started it with the Apache server.
If you want to check whether PHP is installed successfully, you can use a text editor to create a file named test.php in the folder C:lampapache2htdocs where the Apache server stores web pages

phpinfo(); //PHP internal function, used to print PHP status information
?> //PHP script end tag

Then use a web browser to open http ://localhost/test.php page. A PHP test page appears indicating that PHP is successfully installed.
(2) Configure PHP's MySQL extension interface
Step 1: After the above configuration, PHP5 has been successfully installed. But PHP is not yet able to access the MySQL database server, so PHP must find two MySQL-related DLL files installed with PHP.
Before this, you must first copy the libmysql.dll file in the PHP installation directory C:lampphp5 to the Windows installation directory.
This directory is usually C:Windows. Some Windows server versions are C:Winnt directory. You can also set the environment variable of the Windows system and add the PHP decompression directory C:lampphp5 to the PATH environment variable.
Here we copy the C:lampphp5libmysql.dll file to C:Windows.
Step 2: Enable the MySQL function in the PHP configuration file. Use a text editor to open the PHP configuration file C:lampphp5php.ini.
Insert the following three items to enable the mysql and mysqli extension interfaces. You can also find the following three lines in the PHP configuration file and remove the semicolons used for comments.

extension_dir="c:/lamp/php5/ext" #Specify the PHP extension interface directory, the directory separator is "/"
extension=php_mysql.dll #Open the MySQL extension interface
extension =php_mysqli.dll #Open the MySQLi extension interface

Step 3: Restart the Apache server, and the modifications made using the PHP configuration file will take effect.
Step 4: View the content in the PHP test page and check whether there is description information for the mysql and mysqli interface parameters. If you see the information shown in Figure 2-46, it means that PHP's mysql and mysqli extension interfaces are loaded successfully. Also open a web browser and visit the http://localhost/test.php page for testing.
After the above configuration, we have completed the configuration of PHP's MySQL and MySQLi extension interfaces. If you need to configure other extension interfaces, the same method is used.

4. Install Zend accelerator
Step 1: "ZendOptimizer-3.3.3-Windows-i386.exe" file. This is directly an installation file, and you can start the installation program by double-clicking it.
Step 2: After the installation in the previous step, the following interface will appear. Confirm that you agree to the software installation and use license terms, select "I accept the terms in the license agreement", and click the "Next>" button to continue.
Step 3: The Select Installation Location dialog box pops up. Here you can choose the location you like. Here we set the Zend Optimizer installation location to "C:lampZendOptimizer" and click the "Next>" button to continue the installation.
Step 4: The following screen for selecting the type of web server pops up, select the Apache2.x option. Click the "Next>" button to continue the installation.
Step 5: A dialog box for selecting the location of the PHP configuration file php.ini will pop up. When installing PHP, we assigned php.ini to the PHP installation directory C:lampphp5, so the location selected here is also the C:lampphp5 folder.
Step 6: The following dialog box for selecting the root directory of the website will pop up, and select the root directory path of the website content. When installing Apache, we assigned the website root directory to the Apache installation directory C:lampapache2.
So the location selected here is also the C:lampapache2 folder. Click the "Next>" button to continue the installation.
Step 7: A dialog box pops up to confirm the installation. If you need to check again, you can click the "Step 8: If the following prompt pops up, shut down the web server first, and then click the "OK" button to continue the installation.
Step 9: If everything is installed successfully, the following dialog box to end the installation will pop up. Click the "Finish" button to end the installation. The installation is now complete.
Step 10: Check the installation results. Start the Apache server, open the web browser to access the http://localhost/test.php page, and test through the phpinfo() function. If the following content appears, the installation is successful.
This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007 , by Zend Technologies
with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

5. phpMyAdmin installation
Step 1: Put phpMyAdmin-3.3.3-all -Extract languages.zip to /apache2/htdocs/, and create a folder called phpmyadmin. Put the compressed files into it and the installation is complete.
Step 2: Configure config.inc.php in the top-level directory of phpMyAdmin. The config.inc.php file does not exist by default. We need to create one manually. You can also copy the config.sample.inc.php template to get the minimum configuration. document.
The following example is a configuration of the config.inc.php file. Only the parts that must be modified are given. Depending on the actual situation, some other options may need to be modified.
We can have two configuration options through the authentication mode requirements, one is HTTP and cookie authentication mode.
In these two modes, users must first enter a valid username and password for the MySQL database in a login window before they can use the phpMyAdmin program.
This approach has two obvious benefits: first, because the password for the MySQL database does not appear in the config.inc.php file, the authentication process is more secure;
Second, it allows logging in as different users Manage your own database. These two authentication modes are especially suitable for situations where there are multiple user accounts in the database.
The second option is to configure authentication mode. In this mode, the password is stored in clear text in the config.inc.php file. Just write the MySQL username and password directly to the config.inc.php file.
In this way, you will not be prompted to enter the username and password when logging in to phpMyAdmin, but will only log in directly with the user written in the config.inc.php file.
If you are only using phpMyAdmin on a local test system, you can use this mode.
(1) HTTP authentication mode
If you want phpMyAdmin to use HTTP authentication mode, you first need to make the following changes in the bold part of the config.inc.php file. The specific content is as follows:
$cfg['Servers'][$i]['auth_type'] = 'http' ; //Just modify this line to HTTP authentication mode
After completing the settings, When we start phpMyAdmin, a web browser dialog box will pop up on the screen. You need to enter the MySQL user name and password in this dialog box to enter the phpMyAdmin operation interface. Use the IE browser on the Windows client to access the index.php file in the phpMyAdmin directory of the web server, which starts phpMyAdmin.
(2) Cookie authentication mode
Cookie authentication mode is a supplement to HTTP authentication mode and can be used in situations where HTTP authentication mode cannot be used. Cookie authentication mode requires that users must allow cookies from phpMyAdmin to enter their computers. That is, the user needs to enable the client's cookie function in the browser.
If you want phpMyAdmin to use cookie authentication mode, in addition to modifying the auth_type statement in the config.inc.php file, you must also provide a string to the blowfish_secret parameter. This string can be arbitrary, the purpose is that the system will use this string to encrypt the user and password used when logging in before storing them in a cookie on the client computer. The modified content in config.inc.php is as follows:
$cfg['blowfish_secret'] = ''xxxxxxx''; //An arbitrary string is required here
$cfg['Servers'][$ i]['auth_type'] = 'cookie' ; //Change this to cookie authentication mode
In the same way as above to start phpMyAdmin, we use the IE browser on the Windows client to access the phpMyAdmin directory on the web server In the index.php file under, you need to provide your MySQL username and password to log in.
(3)config authentication mode
If you want phpMyAdmin to use config authentication mode, you first need to make the following changes in the config.inc.php file. Write the username and password of the MySQL database in clear text. The specific modifications are as follows:
$cfg['Servers'][$i]['auth_type'] = 'config' ; //Change this to config Authentication mode
$cfg['Servers'][$i]['user'] = 'root'; //Use your MySQL database username
$cfg['Servers'][$i] ['password'] = '111111'; //Use the password of your MySQL database
In the same way as starting phpMyAdmin above, we use IE browser on the Windows client to access the index in the phpMyAdmin directory on the Web server. php file. But you can log in without providing the MySQL username and password. It uses the username and password written in clear text in config.inc.php to log in.

Note: phpmyadmin must be lowercase

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/322242.htmlTechArticle1. Download related software Software download address httpd-2.2.15-win32-x86-no_ssl.msi http:/ /httpd.apache.org/download.cgi mysql-5.1.46-win32.msi http://dev.mysql.com/downloads/ php-5.2.13-W...
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!