Apache+php+mysql installation and configuration diagram in Windows Well, it's also a classic novice. See Skilled Bypass

Source: Internet
Author: User
Tags mysql client php server website server root access

Configuration text for PHP environment

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 versions to download .

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

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

The installation Wizard interface for Apache HTTP Server 2.0.55 appears, click "Next" to continue

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

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

Set up system information, fill in your domain name under network domain (for example: goodwaiter.com), in the server Name (e.g. www.goodwaiter.com, hostname plus domain name), fill in the contact e-mail address of the system administrator under Administrator ' s email (for example: [email Protected]), the above three information is for reference only, where the contact e-mail address will be provided to visitors when the system fails, three information can be arbitrarily filled out, invalid also line. Here are two options, the image is selected for all users of the system installation, using the default 80 port, and as a system service automatically start, the other is to install only for the current user, using port 8080, manually started. General choice. Press "Next" to continue. ]

Choose the installation type, typical as the default installation, custom for user-defined installation, we choose custom here, there are more options available. Press "Next" to continue

The Select installation Options screen appears, left-click on "Apache HTTP Server 2.0.55", select "This feature, and all subfeatures, would be installed on the local hard drive." , that is, "This section, and sub-sections of subordinate content, all installed on the local hard disk." Click "Change ..." To manually specify the installation directory.

I choose to install in the "D:\", you choose, generally recommended not installed in the operating system disk, lest the operating system is broken, the restore operation to the Apache configuration file also cleared. Select "OK" to continue.

Go back to the interface and select "Next" to continue.

Confirm that the installation options are correct, if you think you want to check again, you can click "Back" step-by-step to return to the check. Click "Install" to start the installation as set by the previous setup option.

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

The installation Wizard completed successfully, the lower right corner of the status bar should appear below the green icon, indicating that the Apache service has started to run, press "Finish" to end Apache software Installation

We are familiar with this icon, very convenient, left-click on the icon, the following interface, there are "start", "Stop", "Restart (restart)" Three options, it is convenient for the installation of Apache server to do this.

Okay, now let's test the Web interface that runs by default configuration, hit "http://127.0.0.1" in the IE Address bar, 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 default root directory of the site, put files on it can be. Here we still have to configure, what problems or modifications, configuration is always going 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 few changes, very useful one function is to see the file content of the row, column location, as shown, click "View", tick "status bar", the interface in the lower right corner of more than a mark, "Ln, Col 10" means "row 78, Column 10", so you can quickly locate in the file, Convenient commentary. Of course, you can also use "edit", "find" to enter keywords to quickly locate. Each configuration file changes, after saving, must be in the Apache server restart after the effective, you can use the small icon in front of the convenient control server at any time "restart."

Now formally start to configure the Apache server, "Ln 228", or find the keyword "DocumentRoot" (that is, the Web site root), find the place as shown, and then the "" in the address to your website root directory, address format please follow the picture, mainly the general file address of the "\" Change to "/" in Apache.

"Ln 253", again, you can also find "

"Ln321", DirectoryIndex (directory index, that is, in the case of a directory only, the default display of the file name), you can add a lot, the system will be based on the left-to-right order of precedence display, separated by a single half-width space, For example, some of the site's homepage is index.htm, in the cursor there with "index.htm" filename is arbitrary, not necessarily "index.html", such as "test.php", etc., can be.

Here is a selection of configuration options, which may have been configured, now seems to be fixed, not configured, is to force all output file language encoding, HTML file has a language tag (this is the setting document language is gb2312) will also be cast. If you open a Web page garbled, please check the Web page there is no above HTML language tag, if not, add it can be displayed normally. "# DefaultLanguage NL" Before the "#" removed, "NL" to the language you want to force the output, Chinese is "ZH-CN", save, close.

OK, the simple Apache configuration is over, now with the previous small icon restart, all the configuration will take effect, your site becomes a Web server, if you load the firewall, open 80 or 8080 ports, or allow 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 Internet friends access to use HTTP.//Your IP address (IP address query can access the http://www.goodwaiter.com, Query content within that is) your site; If you do not have a public IP, you can also tell the intranet IP address to other users in the LAN, let them through http://Your intranet IP address, access to your website.

Second, the installation of PHP, module mode, PHP and Apache combined to make your website server support PHP Server script program

Unzip the downloaded PHP installation file php-5.0.5-win32.zip right-click.

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

View the contents of the extracted folder, find 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, which is used to open the global variable, For example, the value of the form sent over, if the value is set to "off", you can only use "$_post[' variable name '", $_get[' variable name '] "and so on to get the value sent, if set to" on ", you can directly use" $ variable name "to get the value sent, of course, set to" off " It is more secure and will not allow people to easily intercept data that is transmitted between pages. Does this value change to "on" to see oneself feel, is safety important or convenience important?

There is also a place to edit, the function is to enable PHP to directly invoke other modules, such as access to MySQL, as shown, Ln563, select the module to be loaded, remove the previous ";", it means to load this module, load more, occupy a little more resources, but also not much where to go, For example, I want to use MySQL, will be "; extension= Php_mysql.dll" before the ";" Remove. All the module files are placed in the PHP decompression directory under the "ext", I am here to load all the modules loaded up, the front ";" Did not remove, because the "ext" directory is not the default module, loading will be prompted to find the file and error. Here is just a reference, generally do not need to load so much, need to load on on it, edit well after saving, close.

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

Now start to combine PHP with Apache in module mode, so that PHP into Apache, as the previous method to open the Apache configuration file, Ln 173, find here, add the two selected lines, the first line "LoadModule Php5_module d:/ Php/php5apache2.dll "refers to the loading of PHP by module, the second line" Phpinidir "d:/php" "is the location of the specified PHP configuration file php.ini, of course, wherein the" d:/php " To be changed to the directory of the PHP decompression you selected earlier.

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, for example, if you add a line of "AddType application/x-httpd-php. htm", then the. htm file can also execute the PHP program, you can even add the previous line "AddType application/x-httpd-php. txt "allows normal text file formats to run PHP programs as well.

The previously mentioned directory default index file can also be changed, because now add PHP, some files are stored directly as. PHP, we can also set the "index.php" as the default index file, priority order on their own platoon, mine is the first place. Edit complete, save, close.

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

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

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

MySQL Setup Wizard starts, press "Next" to continue

Choose the installation type, there are "typical (default)", "Complete", "Custom (User Defined)" Three options, we choose "Custom", there are more options, but also easy to familiarize with the installation process

Left-click on the Developer Components (Developer section) and select "This feature, and all subfeatures, will is installed on the local hard drive.", that is, "this section, and the next belong to the sub-section, all installed on the local hard disk. The above "MySQL server", "Client Programs (MySQL client program)", "Documentation (documentation)" are also doing so to ensure that all files are installed. Click "Change ..." To manually specify the installation directory.

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

Go back to the interface and press "Next" to continue.

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

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 feature, Mysql Configuration Wizard, not to the same as before, their own manual mess configuration My.ini, will "Configure the Mysql Server now" 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 press "Next" to continue.

Choose the configuration method, "Detailed configuration (manual precise configuration)", "Standard Configuration", we select "Detailed Configuration", easy to familiarize with the configuration process.

Select the server type, "Developer Machine (Development test class, MySQL occupies very little resources)", "Server machine (server type, MySQL takes up more resources)", "dedicated MySQL server Machine (dedicated database server, MySQL occupies all available resources) ", people choose according to their own type, generally choose" Server machine ", not too little, will not be full.

Choose the general purpose of MySQL database, "Multifunctional database (Universal multifunction, good)", "Transactional database only (server type, focus on transaction processing, general)", " Non-transactional Database only (non-transactional, simpler, mainly to do some monitoring, counting, MyISAM data type support is limited to non-transactional), with their own use and choose, I choose " Transactional Database Only ", press" Next "to continue.

To InnoDB tablespace configuration, is to select a storage space for InnoDB database files, if modified, to remember the location, re-install the time to choose the same place, otherwise it may cause database corruption, of course, do a backup of the database is no problem, here is not detailed. I have no changes here, use the default location, press "Next" to continue

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

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

This is more important, is to set the MySQL default database language encoding, the first is the Latin code, the second is a multi-byte universal UTF8 encoding, is not our universal encoding, select a third here, and then character set there to select or fill in "GBK", of course, can also use " gb2312 ", the difference is that the GBK font capacity, including all the characters of gb2312, and the addition of 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 with other values, depending on the settings here), you can normally use Chinese characters (or other text), otherwise it will not be normal display of Chinese characters. Press "Next" to continue.

Choose whether to install MySQL as a Windows service, you can also specify the service name, or whether to add the MySQL bin directory to Windows PATH (after joining, you can directly use the file under Bin without indicating the directory name, such as connection, "Mysql.exe-uusername-ppassword;" You can, do not point out the full address of the 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 empty), "New root password" If you want to modify, fill in the new password here (if it is a reload, and have already set a password here, change the password here may be error, please leave blank, and will "Modify Security Settings "in front of the hook removed, the installation configuration after the completion of a separate password)," Confirm (again lost) "filled again, to prevent the wrong. "Enable root access from remote machines (whether to allow root users to log on to other machines, if it is safe, do not tick, if it is convenient, tick it)". Finally "Create an Anonymous account (create a new anonymous user, anonymous users can connect to the database, unable to manipulate data, including queries)", generally do not check, set up, press "Next" to continue.

Confirm that the settings are correct, and if wrong, press "back" to return to the check. Press "Execute" to make the settings effective.

Setup finished, press "Finish" to end the installation and configuration of MySQL--here is a more common error, is not "Start service", generally appear in the previous installation of MySQL server, the solution, first to ensure that the previously installed MySQL server completely uninstalled , if not, check whether the previous password has been modified, according to the above, if not, the MySQL installation directory of the Data folder backup, and then delete, after the installation is complete, will install the generated Data folder to remove, the backup Data folder back, Restart the MySQL service again, in which case you might need to check the database and fix it once to prevent data errors.

Combined with Apache and PHP, previously mentioned, here again, in the PHP installation directory, find the previously renamed and edited PHP.ini, as shown, Ln563, "; Extension=php_mysql.dll" before the ";" Remove and load the MySQL module. Save, shut down, restart Apache on the go. It is also possible to select other modules to be loaded, remove the ";" from the front, which means that the module is loaded, the more loaded, the more resources it takes, but the more it is. All the module files are placed in the PHP decompression directory under the "ext", I am here to load all the modules loaded up, the front ";" Did not remove, because the "ext" directory is not the default module, loading will be prompted to find the file and error. Here is just a reference, generally do not need to load so much, need to load on on it, edit well after saving, close.

Similarly, after loading the module, it is necessary to indicate the location of the module, or restart Apache will prompt "No specific module found" error, here is the simplest way to direct the PHP installation path, the inside of the ext path is assigned to the Windows system path-on "My Computer" right-click, " Properties, select the Advanced tab, click Environment variables, find the Path variable under System variables, select, double-click or tap Edit, add ";D: \php;d:\php\ext" to the previous value, of course, "D:\php" is my installation directory, You will change it to your own PHP installation directory, as shown in, OK. When the system path is added, reboot the computer to take effect, restart now, or restart after all software is installed or configured.

Apache+php+mysql installation and configuration diagram in Windows Well, it's also a classic novice. See Skilled Bypass

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.