Apache + PHP + MySQL configuration strategy

Source: Internet
Author: User
Tags php server website server

I checked Apache + PhP configurations today and found on the internet that this article was not available at the beginning.

Later, I found out that I had to configure the version strictly according to the version mentioned in the article. I would not be able to configure the version because of the version problem !!!

Prepare the software first:

Apache official: apache_2.0.55-win32-x86-no_ssl.msi, more versions here;

PHP official: php-5.0.5-Win32.zip, more images, more Version Download;

MySQL official: mysql-4.1.14-win32.zip, more images, more Version Download.

1. install Apache. A common website server is successfully configured.

Run the downloaded "apache_2.0.55-win32-x86-no_ssl.msi", the following interface appears:

 

 

 

On the Installation Wizard Page of Apache HTTP Server 2.0.55, click "Next" to continue.

 

 

 

Confirm to agree to the software installation license Ordinance, select "I accept the terms in the license agreement", and click "Next" to continue

 

 

 

For instructions on installing Apache on windows, please read the instructions and press "Next" to continue

 

 

 

Set system information, enter your domain name (for example, goodwaiter.com) under network domain, and enter your server name (for example, www.goodwaiter.com, that is, the host name and domain name) under server name ), fill in the system administrator's contact email address (for example, yinpeng@xinhuanet.com) under administrator's email address, the above three information is for reference only, the contact email address will be provided to the visitor when the system fails. All three pieces of information can be filled in at will. The following two options are available: the image is installed for all users of the system, the default port 80 is used, and automatically started as the system service; the other is installed only for the current user, use port 8080 to manually start the instance. Generally. Press "Next" to continue.]

 

 

 

Select the installation type, typical is the default installation, and custom is the User-Defined installation. Here we select Custom for more options. Press "Next" to continue

 

 

 

The "Select installation option" page appears. Click "Apache HTTP Server 2.0.55" and select "this feature, and all subfeatures, will be installed on local hard drive. ", that is," This part and its sub-parts are all installed on the local hard disk ". Click "change..." to manually specify the installation directory.

 

 

 

I chose to install it on "D:/" here. You have chosen it by yourself. It is generally recommended not to install it on the disk where the operating system is located, so that the operating system will not be damaged, the restore operation also clears the Apache configuration file. Select "OK" to continue.

 

 

 

Return to the interface and select "Next" to continue.

 

 

 

Confirm that the installation options are correct. If you think you want to check again, click "back" to return to the check step by step. Click "Install" to start installation according to the preceding installation options.

 

 

 

Installing the interface. Please wait until the following figure is displayed.

 

 

 

The Installation Wizard is successful. The following green icon should appear in the status bar in the lower right corner, indicating that the apache service has started running. Press "finish" to complete the installation of Apache Software.

 

 

 

Let's get familiar with this icon, which is very convenient. You can click it on the icon and the following interface appears, including "start" and "stop) you can easily perform the preceding operations on the installed Apache server.

 

 

 

Now let's test the website interface that runs according to the default configuration. In the IE Address Bar, click "http: // 127.0.0.1" and click "go" to see the following page, indicates that the Apache server has been installed successfully.

 

 

 

Now, configure the Apache server to better serve us. In fact, if not configured, The apache2/htdocs folder under your installation directory is the default root directory of the website, put the file in it. Here we still need to configure. If there is any problem or modification, the configuration will always be met ,, click Start, all programs, Apache HTTP Server 2.0.55, configure Apache server, and edit the Apache httpd conf configuration file.

 

 

 

XP notepad has made some minor changes. A very practical function is to view the row and column positions of the file content, as shown in. Click "View" and select "status bar ", there is an additional tag in the lower right corner of the interface. "ln 78, Col 10" indicates "Row 78, column 10", which can be quickly located in the file for ease of explanation. Of course, you can also enter keywords in "edit" and "Search" to quickly locate the problem. Every time the configuration file changes, it must take effect after the Apache server is restarted. You can use the small icon mentioned above to conveniently control the server to "restart" at any time ".

 

 

 

Now, configure the Apache server, "ln 228", or search for the keyword "DocumentRoot" (that is, the root directory of the website) and find the location shown in, then, change the address in "" to the root directory of your website. Write the address format as shown in the figure. Generally, change the file address "/" to "/" in Apache.

 

 

 

"Ln 253", you can also find"

 

 

 

The specified parameter file name is arbitrary. It is not necessarily set to "index.html", such as "test. php.

 

 

 

Here is a configuration option, which may have to be configured in the past. Now it seems to be corrected. You don't need to configure it, that is, to force the language encoding of all output files. The HTML file contains the language tag (, this is also mandatory conversion when the document language is set to gb2312. If the webpage is garbled, check whether the above HTML language mark exists in the webpage. If not, it will be displayed normally after being added. Remove "#" in front of "# defaultlanguage nl" and change "NL" to the language you want to force the output. The Chinese name is "ZH-CN". Save and close the language.

 

 

 

Now, the simple Apache configuration is over. Now, with the restart of the previous small icon, all the configurations will take effect and your website will become a website server, if you have loaded the firewall, open port 80 or port 8080, or allow the Apache program to access the network. Otherwise, others will not be able to access the network. If you have a public IP (usually ADSL or dial-up Internet), you can invite all friends who can access the Internet to Use http: // your IP address (IP address query can access http://www.goodwaiter.com, the content in the query is) Your Website. If you do not have a public IP address, you can also tell other users in the LAN through http: // your intranet IP address, visit your website.

2. PHP installation and module-based integration of PHP and Apache enables your website server to support PHP server script programs

Right-click and decompress the downloaded PHP installation file php-5.0.5-win32.zip.

 

 

 

Specifies the decompression location. I set it to "D:/PHP"

 

 

 

View the decompressed folder and find "php. ini-Dist file, rename it as "php. INI, open edit, find the place in the figure below, ln385, there is a "register_globals = OFF" value, this value is used to open global variables, such as the value sent from the form, if this value is set to "off", you can only use "$ _ post ['variable name'], $ _ Get ['variable name']" to obtain the sent value, if it is set to "on", you can directly use "$ variable name" to obtain the sent value. Of course, it is safer to set it to "off, it is not easy to intercept data transmitted between webpages. If this value is changed to "on", it depends on your own feeling. Is it important for security or convenience?

 

 

 

There is another area to edit. The function is to enable PHP to directly call other modules, such as accessing MySQL, as shown in ln563. Select the module to be loaded and remove the previous ";", it indicates that the module is to be loaded. The more loaded the module, the more resources it occupies, but there is not much to load. For example, if I want to use MySQL, I need to "; remove ";" before "extension = php_mysql.dll. All the module files are placed under the "Ext" of the PHP decompression directory. Here I load all the modules that can be loaded, and the previous ";" is not removed, this module is not found in the "Ext" directory by default. An error occurs when the file cannot be found during loading. This is just a reference. Generally, you do not need to load so much data. You can load the data as needed. Save the edited data and close it.

 

 

 

If other modules are loaded in the previous step, you must specify the module location. Otherwise, the system prompts the error "the specified module cannot be found" when you restart Apache. Here is the simplest method, directly specify the PHP installation path and the ext path to the Windows system path -- Right-click "my computer", select "properties", and select the "advanced" tab, click "environment variables", find the "path" variable under "system variables", select, double-click or click "edit", and set "; D:/PHP; D: add/PHP/EXT to the original value. Of course, "d:/PHP" is my installation directory. Change it to your PHP installation directory, as shown in, confirm all. After the system path is added, it takes effect after the computer is restarted. You can restart the system now, or restart the system after all software is installed or configured.

 

 

 

Now we can combine PHP with Apache in the module mode to integrate PHP into Apache. Open the configuration file of Apache in the previous method, ln 173. Locate here and add the two lines in the selection, the first line is "loadmodule php5_module D:/PHP/php5apache2. DLL is used to load PHP in module mode. The second line "phpinidir" D:/PHP "indicates the PHP configuration file. the INI location is, of course, where "D:/PHP" should be changed to the directory you have previously selected for PHP decompression.

 

 

 

Or Apache configuration file, ln 757, add "addtype application/X-httpd-PHP. PHP "," addtype application/X-httpd-PHP. html "two lines, you can also add more, the essence is to add file types that can execute PHP, for example, if you add a line "addtype application/X-httpd-PHP .htm.pdf", the .htm file can also execute the PHP program. You can even add the last line "addtype application/X-httpd-PHP. TXT, so that the common text file format can also run php programs.

 

 

 

The default index file of the directory mentioned above can also be changed. Because PHP is added, some files are saved directly. PHP, we can also set "index. PHP "is set as the default index file, which is ranked first in priority. Edited, saved, and closed.

 

 

 

Now, PHP installation and integration with Apache have all been completed. Restart Apache with a small icon in the lower right corner of the screen, and your Apache server supports PHP.

 

Iii. MySQL installation, combined with PHP and Apache

Open the mysqlinstallation file mysql-4.1.14-win32.zip, decompress the file, and run “setup.exe. The following interface is displayed:

 

 

 

Start the MySQL Installation Wizard and press "Next" to continue

 

 

 

Select the installation type, which has three options: "typical (default)", "complete (complete)", and "Custom (custom)". Select "Custom ", with more options, you can familiarize yourself with the installation process.

 

 

 

Click "Developer components (developer part)" and select "this feature, and all subfeatures, will be installed on local hard drive. ", that is," This part and its sub-parts are all installed on the local hard disk ". The preceding operations include "MySQL Server", "client programs (MYSQL client program)", and "documentation (document)" to ensure that all files are installed. Click "change..." to manually specify the installation directory.

 

 

 

Enter the installation directory "D:/MySQL" and do not place it in the same partition as the operating system. This prevents data from being cleared during system backup and restoration. Press "OK" to continue.

 

 

 

Return to the interface and press "Next" to continue.

 

 

 

Confirm the previous settings. If there is an error, press "back" to return the redo. Click "Install" to start installation.

 

 

 

Installing. Please wait until the following interface appears

 

 

 

This is to ask if you want to register an account for mysql.com or use an existing account to log on to mysql.com. Generally, this is not required. Click "Skip sign-up ", click "Next" to skip this step.

 

 

 

Now that the software has been installed, the above interface appears. Here is a good function. MySQL Configuration Wizard does not need to be configured in a mess like before. INI. Check the "configure the MySQL server now" and click "finish" to finish the software installation and start the MySQL Configuration Wizard.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.