Install apache2, PhP5, and mysql5 on Windows and implement multi-system integration with Resin

Source: Internet
Author: User
Tags root access

Who knows that there are many ups and downs, so I think it is necessary to record them. First, I hope it will be helpful to later users and avoid unnecessary detours. I would like to express my gratitude for the installation process based on the experience of many predecessors.

In addition, let's talk a few more questions before getting started. The following installation is integrated on apache2.2, PhP5, mysql5, and resin-3.1.10. However, considering the differences in the operating environment of each computer, it cannot be ensured that the installation and operation can be smoothly performed on various computers according to the procedures of the author. Therefore, if you have any problems with the installation process, use Google or Baidu. Because othersArticleThe installation was completed smoothly, but it was impossible to run on the author's computer. The problem was also strange and unreasonable. In the following process, I have gone through more than 10 times. During this process, I cannot help but lament the impact, re-engineering, loading, unloading, repair, and modification.ProgramEmployees are tired and trivial, and they want to do everything if they can do other things with the spirit of programmer's perseverance, tenacious will, and perseverance!

Now, let's go to the topic.

1. install Apache 2.2.14

1. Run the installer from "Next" to "Server Information". Fill in the domain name in the first two places, and enter localhost if there is no domain name in the first two places ), the rest will accept the default options, and press "Next" to continue.

2. Select the installation type. If you need to change the installation directory of the default program, select Custom for custom installation. Otherwise, select typical for default installation. Here, I select Custom and press "Next" to continue.

3. On the "Select installation option" page, click "change..." to specify the installation directory and press "Next" to continue.

4. After confirming that the installation options are correct, press "Install" to start installation. When the installation wizard is complete, a new small icon appears in the status bar in the lower right corner. Setting it to the "Start" status indicates that the apache service has started running and ended by "finish.

5. Enter http: // localhost/in the browser. If "It works!" is displayed !", Indicates that Apache is working properly. If it is not displayed, an error is prompted, or the green light of the Apache small icon is not displayed, port 80 of the system may be occupied. In this case, you need to find out the cause of the Error. Generally, software such as IIS and thunder occupy port 80 and close the software.

2. Install php-5.2.5

1. decompress the PHP compressed package to the specified folder and decompress it to D: \ Dev \ PHP.

2. Change the name of the php. ini-recommended file to PhP. ini, and modify the content as follows:
(1); default_charset = "iso-8859-1" to: default_charset = "UTF-8 ";
(2) extension_dir = "./" to extension_dir = "D:/dev/PHP/EXT ";
(3) locate memory_limit = 128 M. Modify the value to limit the maximum memory size occupied by PHP scripts;
(4) Select the module to be loaded as needed by removing the previous number. Generally, the following modules can be loaded:
Extension = php_gd2.dll
Extension = php_mbstring.dll
Extension = php_mhash.dll
Extension = php_mime_magic.dll
Extension = php_ming.dll
Extension = php_mysql.dll
Extension = php_xmlrpc.dll

3. Add the PHP installation path to the Windows system path by right-clicking "my computer" and selecting "properties ", click the "advanced" tab in the "System Properties" window, click "environment variables", find the "path" variable under "system variables", and set "; D: \ Dev \ PHP; d: \ Dev \ PHP \ Ext "is added to the end of the original value (the specific path is modified according to the actual installation path). The modification takes effect after restart.

4. modify the configuration file httpd. conf of Apache as follows:
(1) Find DocumentRoot "X:/XXX/htdocs" and <directory "X:/XXX/htdocs"> (enter the address in the quotation marks based on your installation path), and set "X: /XXX/htdocs is changed to the folder where the website is stored. Here I change it to DocumentRoot "D:/www" and <directory "D:/www">
(2) locate loadmodule and add
Loadmodule php5_module "D:/dev/PHP/php5apache2_2.dll"
Phpinidir "D:/dev/PHP"
(3) locate <ifmodule dir_module> directoryindex index.html </ifmodule> and change it:
<Ifmodule dir_module>
Directoryindex index. php index. phtml index.html index. jsp
</Ifmodule>
(4) Find "addtype application/X-gzip. GZ. tgz" and add it below:
Addtype application/X-httpd-PHP. php. phtml
Addtype application/X-httpd-PHP. html

5. Create the index. php file in D: \ www with the following content:
<? PHP
Phpinfo ();
?>
Restart Apache and enter http: // localhost/in the browser. If php information is displayed, Apache supports PHP.

3. Install mysql-5.0.41

1. Run the installer, select "Custom", change the MySQL installation path to "D: \ Dev \ mysql", and then "Next ".

2. After the installation is complete, the system prompts "configure the MySQL server now". Check it and press "finish ".

3. In the MySQL Configuration Wizard that is started, select the "detailed configuration" configuration method and press "Next" to continue.

4. Select the server type, "Developer machine (development and testing type, 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) ", according to your needs. I mainly want to test the program. Here I select "Developer Machine" and press "Next" to continue.

5. Select the MySQL database usage, "multifunctional database (Universal multi-function type)", and "transactional database only (dedicated to transaction processing type) "," non-transactional database only (non-transaction processing type) ", select according to your own purposes. Select "multifunctional database" and press "Next" to continue.

6. Configure InnoDB tablespace to select a storage space for the InnoDB database file. Here, we use the default position and press "Next" to continue.

7. Configure the approximate number of MySQL connections, including "demo-support (DSS)/OLAP (about 20)" and "online transaction processing (OLTP) (about 500) and manual setting )". The author selects "demo-support (DSS)/OLAP" here, which is only used for debugging programs. Press "Next" to continue.

8. Select enable TCP/IP connection. The default port is 3306. Press "Next" to continue.

9. Set the default encoding of the MySQL database. The first is the Spanish encoding, the second is the utf8 encoding, and the third is the manual configuration. Select the third character, select "GBK" at the character set, and press "Next" to continue.

10. Set MySQL to a Windows Service and specify the service name (service ID name ), add the bin directory of MySQL to the Windows path (after adding it, You can directly use the command in the bin directory in the DOS window without entering the complete address ). Check all the items here. The service name remains unchanged by default. Press "Next" to continue.

11. Set the root user password (blank by default) and enter the password in "New Root Password". (If the password is reinstalled and already set, changing the password may cause an error, leave it blank and remove the check box before "modify Security Settings". After the installation and configuration are complete, change the password separately ). In addition, you can select "enable root access from remote machines (whether root users are allowed to log on remotely)", and "Create an anonymous account (create an anonymous user. After setting, press "Next" to continue.

12. confirm that the settings are correct. Press execute to make the settings take effect. After setting, press "finish.

13. Create the testconn. php file in D: \ www with the following content: (** the root user password ):
<? PHP
Mysql_connect ("localhost", "root", "**") or die (mysql_error ());
Echo "connected to MySQL <br/> ";
?>
Enter http: // localhost/testconn. php In the browser. If connected to MySQL is displayed, the connection to MySQL is successful.

4. Install phpMyAdmin-3.2.5

1. decompress the phpMyAdmin package in the specified folder, decompress it to D: \ www \ phpMyAdmin, and set config. default. copy PHP to the phpMyAdmin directory and rename it config. inc. PHP.

2. Modify the config. Inc. php file as follows:
(1) Change $ cfg ['servers'] [$ I] ['auth _ type'] = 'config';:
$ Cfg ['servers'] [$ I] ['auth _ type'] = 'http ';
(2) Change $ cfg ['servers'] [$ I] ['Password'] = '':
$ Cfg ['servers'] [$ I] ['Password'] = '**' (** the MySQL password)

3. Open the Apache configuration file httpd. conf, find # Alias/webpath/full/filesystem/path, and add it belowCode(The specific path can be modified as needed ):
Alias/phpMyAdmin "D:/www/phpMyAdmin"Copy codeThe Code is as follows: <directory "D:/www/phpMyAdmin">
AllowOverride none
Options none
Order allow, deny
Allow from all
</Directory>

Restart Apache and open http: // localhost/phpMyAdmin in the browser. In the displayed dialog box, enter the Administrator account (Root) and password. If you log on successfully and open the phpMyAdmin interface, the installation is complete.

5. Install ZendOptimizer-3.3.3

Zendoptimizer is easy to install. You only need to follow the prompts to select the installation path, check apache2.x, and set the root directory of the project. After the installation is complete, enter http: // localhost/in the browser to view the Zend information.

6. Integrate Apache and resin and configure Virtual Hosts

The author's computer already has two projects in resin. Assume one of them is tieba and the other is Zhidao. Now we need to integrate the phpwind forum system, the following URLs can be used to access the corresponding systems: tieba.aaa.com, zhidao.aaa.com, and bbs.aaa.com.

1. Modify the hosts file in the c: \ windows \ system32 \ drivers \ etc directory and add:
127.0.0.1 tieba.aaa.com
127.0.0.1 zhidao.aaa.com
127.0.0.1 bbs.aaa.com

2. Enter the win32subdirectory of the resininstallation directory and run setup.exe. Select the Apache check box in the "resin setup" window, enter the Apache installation directory in the input box, and click "OK.
3. modify the configuration file httpd. conf of Apache as follows:
(1) loadmodule caucho_module "D:/dev/resin-3.1.10/Win32/Apache-2.0/mod_caucho.dll"
Modify it:
Loadmodule caucho_module "D:/dev/resin-3.1.10/Win32/Apache-2.2/mod_caucho.dll"

(2) Remove # Before # servername localhost: 80.

(3) Modify <directory "D:/www"> to <directory/>.

(4) Remove indexes from options indexes followsymlinks without displaying the directory list.

(5) Remove the # sign before # include CONF/extra/httpd-vhosts.conf to open the VM configuration.

4. Modify the httpd-vhosts.conf file in D: \ Dev \ apache2.2 \ conf \ extra as follows:
(1) Change namevirtualhost *: 80 to namevirtualhost localhost: 80. If Internet service is enabled, replace localhost with the IP address of the server.

(2) start to configure the VM. a domain name corresponds to one <virtualhost>:Copy codeThe Code is as follows: <virtualhost bbs.aaa.com: 80>
Servername bbs.aaa.com
DocumentRoot D:/www/phpwind
</Virtualhost>

<Virtualhost tieba.aaa.com: 80>
Servername tieba.aaa.com
DocumentRoot D:/dev/resin-3.1.10/webapps/tieba
Resinconfigserver 127.0.0.1 6800
</Virtualhost>

<Virtualhost zhidao.aaa.com: 80>
Servername zhidao.aaa.com
DocumentRoot D:/dev/resin-3.1.10/webapps/Zhidao
Resinconfigserver 127.0.0.1 6800
</Virtualhost>

5. Modify the resin. conf configuration file of resin as follows:

(1) Because resin is no longer required to directly provide web services, you can comment out

(2) configure the host as follows:Copy codeThe Code is as follows: <Web-app id = "/" Root-directory = "D:/dev/resin-3.1.10/webapps/tieba"/>
<Stderr-Log Path = 'd:/dev/resin-3.1.10/logs/stderr. Log 'rolover-period = '1w'/>
<Stdout-Log Path = 'd:/dev/resin-3.1.10/logs/stdout. Log 'rolover-period = '1w'/>
</Host>
<Host ID = "zhidao.aaa.com" Root-directory = ".">
<Web-app id = "/" Root-directory = "D:/dev/resin-3.1.10/webapps/Zhidao"/>
<Stderr-Log Path = 'd:/dev/resin-3.1.10/logs/stderr. Log 'rolover-period = '1w'/>
<Stdout-Log Path = 'd:/dev/resin-3.1.10/logs/stdout. Log 'rolover-period = '1w'/>
</Host>

Restart Apache and resin. Now, you can use the tieba.aaa.com, zhidao.aaa.com, and bbs.aaa.com domain names to access the corresponding project.

VII. Use Apache rewrite rules to implement URL pseudo-static

After the integration of Apache and resin, Apache preferentially blocks URLs with HTML, this may cause the pseudo-static settings in the resin system to be invalid for optimizing the website URL. In this case, you need to reset the settings through the Apache rewrite rule. Here, the URL in the tieba project is used as an example. The procedure is as follows:

1. in httpd. conf, find # loadmodule rewrite_module modules/mod_rewrite.so and remove the previous.

2. In the httpd-vhosts.conf, locate <virtualhost tieba.aaa.com: 80> and change it:Copy codeThe Code is as follows: <virtualhost tieba.aaa.com: 80>
Servername tieba.aaa.com
DocumentRoot D:/dev/resin-3.1.10/webapps/tieba
Resinconfigserver 127.0.0.1 6800
<Ifmodule mod_rewrite.c>
Rewriteengine on
Rewriterule ^/tie/(\ d000000000000.html $/do/viewthread? Id = $1 [L, pt]
</Ifmodule>
</Virtualhost>

So you can implement will be similar to http://tieba.aaa.com/do/viewthread? The pseudo-static website id = 77 is http://tieba.aaa.com/tie/77.html. Note that the rule must be followed by [L, pt]. Otherwise, the/do/viewthread? Id = $1 is regarded as a directory structure for access without being parsed by resin. The author has been entangled for a long time here, and will be remembered later.

Well, from top to bottom, this process completes the installation and configuration of apache2, PhP5, mysql5, phpMyAdmin, and zendoptimizer in windows, apache and resin integration, virtual host configuration, and URL pseudo-static processing are implemented. Next, I will summarize how to import data from Oracle to MySQL quickly and conveniently, and how to integrate the existing JSP website with the phpwind forum for Synchronous login and exit.

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.