Setup and configuration of php + SQL Server Apache + php + mysql in windows

Source: Internet
Author: User
Tags php server website server root access
Setup and configuration of php + SQL Server Apache + php + mysql in windows

Setup and configuration of php + SQL Server Apache + php + mysql in windows

Php is fast and secure because of its high execution speed (compared with asp, it cannot be better than jsp. ICBC uses jsp or Microsoft to help it ).

Because iis requires a system CD and is prone to errors (I installed it for 2 hours and debugging fails. We strongly recommend that you use apache for more convenience)
The introduction of text and text is very detailed. I 've made a whole night to get this done.

Installation and configuration of Apache + php + mysql in windows
Prepare the software first:

Apache official: apache_2.0.55-win32-x86-no_ssl.msi, http://mirror.vmmatrix.net/apache/httpd/binaries/win32/apache_2.0.55-win32-x86-no_ssl.msi with shunlei download

Php official: php-5.0.5-Win32.zip, http://cn2.php.net/get/php-5.0.5-Win32.zip/from/cn.php.net/mirror download is also used shun lei

Official mysql: mysql-4.1.14-win32.zip,
Http://dev.mysql.com/get/Downloads/MySQL-4.1/mysql-4.1.14-win32.zip/from/http://download.softagency.net/MySQL/

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 selected it by yourself. Generally, we recommend that you do not 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 just now 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 is successfully installed.

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

.

[This post was last edited by the user who wants to fly de higher]
Want to fly de higher drink saliva next
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, which is set 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: \ php \ ext is appended to the original value. Of course, "D: \ php" is my installation directory. You need to 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 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.
-8-28 I want to install mysql on Apsara, which is a combination of 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.

Start the mysql Configuration Wizard and press "Next" to continue.

Select the Configuration method, "Detailed Configuration (manual precise Configuration)", and "Standard Configuration". Select "Detailed Configuration" to familiarize yourself with the Configuration process.

Select the Server type, "Developer Machine (development and testing class, mysql occupies a small amount of resources)", "Server Machine (Server type, mysql occupies a large amount of resources) "," Dedicated MySQL Server Machine (Dedicated database Server, mysql occupies all available resources) ", you choose according to your own type, generally choose" Server Machine ", not too little, it will not be full.

Select the general purpose of the mysql Database, "Multifunctional Database (Universal multi-function type, good)", "Transactional Database Only (server type, dedicated to transaction processing, General) "," Non-Transactional Database Only (non-transaction processing type, relatively simple, mainly used for monitoring and recording, the support for MyISAM data types is limited to Non-transactional ), I chose it with my own purpose. Here I select "Transactional Database Only" and press "Next" to continue.

Configure InnoDB Tablespace to select a bucket for the InnoDB database file. If you modify the bucket, remember the location and select the same place for the reinstallation. Otherwise, the database may be damaged, of course, it is okay to back up the database. We will not detail it here. I have not modified it here. Use the default position and press "Next" to continue.

Select the average mysql access volume of your website and the number of connections at the same time. For example, "demo-support (DSS)/OLAP (about 20 connections)" and "Online Transaction Processing (OLTP) (about 500) "and" Manual Setting (manually set, enter a number by yourself) ". Here I select" Online Transaction Processing (OLTP) "and my server, enough. Press "Next" to continue.

Whether to enable the TCP/IP connection and set the Port. If the Port is not enabled, you can only access the mysql database on your machine. I enable it here and tick the Port Number: 3306. Press "Next" to continue

This is very important. It is to set the default mysql database language encoding. The first is the Spanish encoding, and the second is the multi-byte General utf8 encoding, which is not our general encoding, select the third Character here, and then select or fill in "gbk" in the Character Set. Of course, you can also use "gb2312". The difference is that the gbk font size is large, including all the Chinese characters of gb2312, and added traditional Chinese characters and other messy words-when using mysql, Run "set names gbk;" before executing the data operation command (just run it once, GBK can be replaced with other values, depending on the settings here), you can use Chinese characters (or other texts) normally, otherwise the Chinese characters cannot be displayed normally. Press "Next" to continue

Select whether to install mysql as a windows Service. You can also specify the Service Name (Service ID Name) and add the mysql bin directory to the Windows Kernel-uusername-ppassword##directory. Then, the complete address of mysql.exe is displayed, it is very convenient), I have checked all of them here, and the Service Name remains unchanged. Press "Next" to continue.

This step asks if you want to change the default root user (Super Management) password (blank by default). If you want to change the "New root password", enter the New password here (if re-installed, you have already set a password. Changing the password may cause errors. leave it blank and remove the check box before "Modify Security Settings". After the installation and configuration are complete, change the password separately ), "Confirm (re-enter)" is entered again to prevent errors. "Enable root access from remote machines (whether to allow root users to log on to other machines. If you want security, do not check it. If you want convenience, check it )". Finally, "Create An Anonymous Account (Create An Anonymous user, and the Anonymous user can connect to the database, and cannot operate data, including queries)" is not checked. The settings are complete, press "Next" to continue.

Confirm that the settings are correct. If any error occurs, press "Back" to return for the check. Press Execute to make the settings take effect.

After the configuration is complete, press "Finish" to end mysql installation and configuration. Here is a common error, that is, the "Start service" is not allowed, which usually appears on a server where mysql was previously installed, to solve this problem, first ensure that the previously installed mysql server is completely uninstalled. If not, check whether the previous password has been modified as mentioned above; if not, back up the data folder under the mysql installation directory and delete it. After the installation is complete, delete the data folder generated by the installation and remove the backed up data folder, restart the mysql service. In this case, you may need to check the database and fix it once to prevent data errors.

 

From: http://www.phpwind.net/read-htm-tid-575193.html

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.