Apache+php+mysql installation and configuration in Windows (latest edition) _php basics

Source: Internet
Author: User
Tags anonymous documentation mysql client php server php and win32 root access

Prepare the software first:

Apache Official Download Address:apache_2.0.55-win32-x86-no_ssl.msi, more versions here ;

PHP Official Download Address:php-5.0.5-win32.zip, more mirror download address , more versions to download ;

MySQL official download address:mysql-4.1.14-win32.zip, more mirror download address , more versions to download .

First, install Apache, configure the success of a common Web server

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

The Apache HTTP Server 2.0.55 Installation Wizard interface appears, and point "Next" continues

Confirm consent to the Software Installation license regulation, select "I accept the terms in the License Agreement", click "Next" to continue

For instructions on how to install Apache on Windows, please press "Next" to continue after reading.

Set up system information, fill in your domain name under network domain (for example: goodwaiter.com), in the server Name below your server (e.g. www.goodwaiter.com, host name plus domain name), in the administrator ' s Email Address to fill in the system administrator's contact e-mail addresses (such as: yinpeng@xinhuanet.com), the above three information for reference only, which contact e-mail address in the system when the failure to provide visitors, three of information can be arbitrarily filled out, invalid also line. There are two options for installing all users of the system, using the default 80 ports, and automatically starting as system services, and installing only for the current user, using port 8080, and manually booting. The general selection is shown in the figure. Press "Next" to continue. ]

Choose the installation type, typical for the default installation, custom for users to customize the installation, we choose custom here, there are more options available. Press "Next" to continue

The Select installation options interface appears, as shown, with the left-click "Apache HTTP Server 2.0.55" selected, "This feature, and all subfeatures, would be installed on the local hard Driv E. "", that is, "this section, and subordinate parts, all installed on the local hard drive." Click Change ... to manually specify the installation directory.

I choose to install in the "D:\", you selected, the general recommendation not to install the operating system on the disk, so that the operating system does not work, restore operation of the Apache configuration file also cleared. Select "OK" to continue.

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

Confirm the installation option is correct, if you think you want to check again, you can point "back" step-by-step return check. Point "Install" starts with the installation option set earlier.

The interface is being installed, please wait until the screen below appears.

When the Setup Wizard completes successfully, the status bar in the lower right corner should appear with this green icon, indicating that the Apache service has started running and that the Apache software installation is finished by clicking Finish

Let's get acquainted with this icon, very convenient, on the icon left-click, the following interface appears, there are "start", "Stop", "Restart (reboot)" Three options, you can easily install the Apache server to do the above operation.

Okay, now let's test it. The web interface that runs by default configuration, in IE Address bar "http://127.0.0.1", click "Go", you can see the following page, indicating that the Apache server has been installed successfully.

Now start to configure the Apache server, so that it better serve us, in fact, if not configured, your installation directory under the Apache2\htdocs folder is the site's default root directory, in which to put files on it. Here we still have to configure, what problems or changes, the configuration is always to be, as shown in the figure, "Start", "All Programs", "Apache HTTP server 2.0.55", "Configure Apache Server", "Edit the Apache HTTPD conf Configuration file ", click Open.

XP Notepad has a little change, a useful function is to see the contents of the file line, column position, as shown in the following figure, point "view", tick "status bar", the interface in the lower right corner is more than a mark, "Ln, Col 10" means "row 78, Column 10", so that you can quickly locate in the file, Easy to explain. Of course, you can also use the "edit", "find" input keyword to quickly locate. Every time the configuration file changes, save, must be in the Apache server reboot after the effective, you can use the small icon in front of the convenient control of the server at any time "restart."

Now it's time to start configuring the Apache server, "Ln 228", or find the keyword "DocumentRoot" (that is, the site root), locate the following figure, and then change the address in the "" to your site root directory, address format according to the map, mainly the general file address "\ "Change to"/"in Apache.

"Ln 253", again, you can also find "<>< p=""><>

"Ln321", DirectoryIndex (directory index, that is, in the case of only specified directory, the default display of the file name), you can add a lot, the system will be based on the order from left to right to display precedence, separated by a single half-width space, For example, some of the site's home page is index.htm, at the cursor where the "index.htm" file name is arbitrary, does not necessarily have to "index.html", such as "test.php" and so on, can be.

Here is a SELECT configuration option, may be configured before, now seems to be fixed, do not configure, is to force all the output file language encoding, HTML files have language tags (, this is to set the document language gb2312) will also be forced to convert. If the open page appears garbled, please check the page has the above HTML language tags, if not, add up can be normal display. Remove "#" in front of "# DefaultLanguage NL" and change "NL" to the language you want to force the output, Chinese is "ZH-CN", save, close.

OK, so the simple Apache configuration is over, now use the previous small icon reboot, all the configuration is effective, your site becomes a Web server, if you load the firewall, please open 80 or 8080 ports, or allow the Apache program access to the network, otherwise people can not access. If you have a public network IP (General ADSL or telephone dial-up Internet is all), you can invite all the Internet friends to access the use of http://your IP address (IP address query can access http://www.goodwaiter.com, Query content is your site, if you do not have a public network IP, you can also give the intranet IP address to other users within the LAN, let them through http://your intranet IP address, visit your website.

Second, the installation of PHP, module mode, PHP and Apache combined to enable your Web server to support PHP server script program

php-5.0.5-win32.zip The downloaded PHP installation file to the right key.

Specify the location of the decompression, my settings are "D:\php"

Look at the Unpacked folder contents, locate the "php.ini-dist" file, rename it to "PHP.ini", open the edit, find the place in the figure below, Ln385, there is a "register_globals = off" value that is used to open the global variable. such as the value of the form sent, if this value is set to "off", you can only use "$_post[' variable name '], $_get[' variable name '", etc. to obtain the value sent, if set to "on", you can directly use "$ variable name" to get the value sent, of course, set to "off" is more secure and does not allow people to easily intercept data that is transmitted between pages. Whether this value is changed to "on" depends on what you feel, is security important or convenience important?

Here's another place to edit, and the function is to enable PHP to call other modules directly, for example, access to MySQL, as shown in the following figure, Ln563, select the module to load, remove the front of the ";", which means to load the module, the more loaded, the use of more resources, but not much more, For example, I want to use MySQL, "extension= php_mysql.dll" before ";" Remove. All module files are placed in the PHP extract directory "ext", my screenshot here is to load all the modules are loaded up, the front of the ";" Not removed, because the "ext" Directory does not have this module by default, load will be prompted to find the file error. Here is only reference, generally do not need to load so much, need to load on on it, edited well after save, close.

If the other modules were loaded in the previous step, to indicate the location of the module, otherwise restart Apache will be prompted to "find the specified module" error, here is the simplest way to direct the PHP installation path, inside the ext path specified to the Windows system path--in "My Computer" Right, "Properties", select "Advanced" tab, click "Environment variable", find "Path" variable under "System variable", select, double-click or click "Edit", add ";D: \php;d:\php\ext" to the back of the original value, of course, "D:\php" is my installation directory , you will change it to your PHP installation directory, as shown in the following figure, all determined. The system path is added to restart the computer to take effect, you can reboot now, or you can reboot after all software is installed or configured.

Now start using PHP in module mode with Apache, so PHP into Apache, according to the previous method to open the Apache configuration file, Ln 173, found here, add to the two selected lines as shown in the picture, the first line of "LoadModule Php5_module D:/php/php5apache2.dll "refers to the loading of PHP in module mode, the second line of" Phpinidir "d:/php" "is the location of the specified PHP configuration file php.ini, of course, where the" d:/php " To change to the previously selected PHP uncompressed directory.

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 a file type that can execute PHP, such as adding a line of "AddType application/x-httpd-php. htm", the. htm file can also execute the PHP program, and you can even add the previous line "AddType application/x-httpd-php. txt ", so that the normal text file format can also run the PHP program.

The previous directory default index file can also be changed, because now add PHP, some files are directly saved as. PHP, we can also make "index.php" as the default index file, the priority of their own platoon, I was placed in the first place. Edit complete, save, close.

Now, the installation of PHP, with the combination of Apache has been completed, with the screen in the lower right corner of the small icon restart Apache, your Apache server support PHP.

Third, the installation of MySQL, with PHP, Apache combination

Open the download MySQL installation file mysql-4.1.14-win32.zip, double-click Decompression, run "Setup.exe", the following interface appears

The MySQL Setup Wizard starts, press "Next" to continue

Choose the installation type, there are "typical (default)", "Complete (Full)", "Custom (user-defined)" Three options, we choose "Custom", there are more options, but also easy to familiarize yourself with the installation process

Left-click on the "Developer components (developer part)", select "This feature, and all subfeatures, will is installed on the local hard drive.", that is, "this part, and the next Sub-part content, all installed on local hard drive. This is done on the MySQL server (MySQL servers), client Programs (MySQL client), and documentation (documentation) to ensure that all files are installed. Click Change ... to manually specify the installation directory.

Fill in the installation directory, my "D:\mysql" is also recommended not to be placed in the same partition as the operating system, so as to prevent the system backup restore time, the data is emptied. Press "OK" to continue.

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

Confirm the previous settings and, if wrong, press "back" to redo. Press "Install" to start the installation.

is in the installation, please wait until the following interface appears

Here is to ask if you want to register a mysql.com account, or use the existing account login mysql.com, generally do not need, click "Skip Sign-up", press "Next" skip this step.

Now the software installation is complete, the above interface, there is a good function, the Mysql Configuration Wizard, not to the same as before, their own manual mess configuration My.ini, will "Configure the Mysql Server now" in front of the tick, point "Finish "End the installation of the software and start the MySQL Configuration Wizard."

The MySQL Configuration Wizard starts the interface and presses "Next" to continue.

Select the configuration mode, "Detailed Configuration (Manual precise configuration)", "Standard Configuration (Standard configuration)", we choose "Detailed Configuration" to facilitate familiarity with the configuration process.

Select server Type, "Developer Machine (Development test class, MySQL takes very little resources)", "Server Machine (server type, MySQL takes up more resources)", "dedicated MySQL server Machine (dedicated database server, MySQL occupies all available resources) ", we choose according to their own type, the general election of" server Machine ", not too little, will not fill.

Choose the approximate use of MySQL database, "Multifunctional db (Universal multi-function, good)", "Transactional database only (server type, focus on transaction, General)", " Non-transactional Database only (non-transactional processing type, simpler, mainly do some monitoring, counting, MyISAM data types of support limited to non-transactional), with their own use and chose, I choose here " Transactional Database only, press "Next" to continue.

InnoDB tablespace configuration, is to InnoDB database files to choose a storage space, if modified, to remember the location, when reloading to choose the same place, otherwise it may cause database damage, of course, to do a backup of the database is no problem, here is not detailed. I have not modified here, use the default location, press "Next" to continue

Select the general MySQL traffic for your site, the number of simultaneous connections, "Decision Support (DSS)/olap (20 or so)", "Online Transaction Processing (OLTP) (500 or so)", " Manual Setting (manually set, lose a number) ", I choose" Online Transaction Processing (OLTP), your own server, should be enough, press "Next" to continue

Whether to enable TCP/IP connections, set the port, if not enabled, you can only access the MySQL database on their own machine, I am enabled here, the front of the tick, Port number:3306, press "Next" to continue

This is more important, is the MySQL default database language encoding settings, the first is the western code, the second is multibyte universal UTF8 encoding, is not our common code, here Select the third, and then in character set there to select or fill in "GBK", of course, can also use " gb2312 ", the difference is that GBK's font size, including the gb2312 of all Chinese characters, and add traditional characters, and other messy words-when using MySQL, run the data Operation command before the" SET NAMES GBK; " (Run once on the line, GBK can be replaced by other values, depending on the settings here), you can normally use Chinese characters (or other text), otherwise can not display Chinese characters normally. Press "Next" to continue.

Choose whether to install MySQL as a Windows service, or you can specify the service name (Services identity name) and whether to add MySQL's Bin directory to Windows PATH (after joining, you can use the file directly under bin without having to indicate a directory name, such as a connection, "Mysql.exe-uusername-ppassword;" On it, do not point out the full address of mysql.exe, very convenient, I have all ticked here, Service name unchanged. Press "Next" to continue.

This step asks if you want to modify the default root user (super Admin) password (default is null). New root Password "If you want to modify it, fill in this password (if it's a reload, and you've already set a password, you may have an error changing the password here, leave it blank, and" Modify Security Settings "in front of the check out, the installation configuration is completed after a separate change password)," Confirm (again) "to fill in again, to prevent the wrong. "Enable root access from remote machines (whether or not to allow root users to log on to other machines, if you want to be safe, do not hook, if it is convenient to hook it up)". Finally "Create a Anonymous account (a new anonymous user, anonymous users can connect to the database, cannot manipulate data, including queries)", generally do not have to tick, set up, press "Next" to continue.

Verify that the settings are correct, and if so, press "back" to return to check. Press ' Execute ' to make the settings effective.

Set up, press "Finish" to end the installation and configuration of MySQL--here is a more common mistake, is not "Start service", generally appear in the previous installation of MySQL server, the solution, first of all, to ensure that the MySQL server installed before the total uninstall off the , if not, check to see if the previous password has been modified according to the above, the operation above; if still not, the MySQL installation directory of the Data folder backup, and then deleted, after the installation is completed, will install the generated Data folder deleted, the backup of the data folder to move back, Restart the MySQL service, in which case you may need to check the database and fix it once to prevent data errors.

Combined with Apache and PHP, mentioned above, here again, in the PHP installation directory, to find the previously renamed and edited PHP.ini, as shown in the figure below, Ln563, "; Extension=php_mysql.dll" before ";" Remove and load the MySQL module. Save, shut down, restart Apache on it. Here you can also select other modules to load, remove the front of the ";", means to load the module, the more loaded, the use of more resources, but not much more. All module files are placed in the PHP extract directory "ext", my screenshot here is to load all the modules are loaded up, the front of the ";" Not removed, because the "ext" Directory does not have this module by default, load will be prompted to find the file error. Here is only reference, generally do not need to load so much, need to load on on it, edited well after save, close.

Also, after loading the module, you need to indicate the location of the module, otherwise, you will be prompted to "not find the specified module" error, here is the simplest way to direct the PHP installation path, inside the ext path specified to the Windows system path--on "My Computer" right button, " Properties, select the Advanced tab, click "Environment variable", find "Path" variable under "System variable", select, double-click or click "Edit", add ";D: \php;d:\php\ext" to the back of the original value, of course, the "D:\php" is my installation directory, You will change it to your own PHP installation directory, as shown in the following figure, all determined. The system path is added to restart the computer to take effect, you can reboot now, or you can reboot after all software is installed or configured.

-->

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.