Configure Apache + Mysql + PHP in Windows

Source: Internet
Author: User
Tags apache windows mysql host php windows vc9 root access
I haven't written a blog for a long time. I am learning php recently. So I 'd like to share with you the environment configuration. Software preparation: shows the prepared software. Apache has found 64-bit drops in the official wooden tree. A specific address is provided. It has been tested and can run normally. Other 32and64 bits can be found on the official website. Www. blackdot. be? Incapache

I haven't written a blog for a long time. I am learning php recently. So I 'd like to share with you the environment configuration. Software preparation: shows the prepared software. Apache has found 64-bit drops in the official wooden tree. A specific address is provided. It has been tested and can run normally. Other 32-and 64-bit instances can be found on the official website. Http://www.blackdot.be /? Inc = apache/

I haven't written a blog for a long time. I am learning php recently. So I 'd like to share with you the environment configuration.

Software preparation:

Shows the prepared software.

Apache has found 64-bit drops in the official wooden tree. A specific address is provided. It has been tested and can run normally.

Other 32-and 64-bit instances can be found on the official website.

Http://www.blackdot.be /? Inc = apache/binaries apache 64 bit

ApacheInstallation:

Note: In this example, you only need to note that the screenshot is not displayed by default.

1. The server information can be configured by default if port 80 of the server is not occupied by other server programs. Optional values: "for All Users, on Port 80, as a Service-Recommended. "If it is only used by the Current User, use Port 8080 and start it Manually. Select" only for the Current User, on Port 8080, when started Manually. ". The port number can be modified through the configuration file.

2. "Typical" is the default installation, and "Custom" is the Custom installation.

3. Click "Build Headers and libraries" and select "This feature will be installed on local dirive ."

4. You can select "Change" to Change the default installation path. In this example, the default installation path is used.

5. After the installation is complete, the apache service manager will appear.

The Service Management list contains service projects that can be started now.

NOTE: If no apache service item is displayed in the Service Management list after installation, it indicates that an error occurs during the installation process. You can manually install the service.

Run cmd to enter C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ bin. This is the directory installed on my local machine and runs the httpd-k install command, after the prompt is successful, you can see the apache service in the Service Management list.

Because my machine has installed this service normally, an error occurred while executing this command. You can search for the httpd-related command.

6. Now you can test whether apache is successfully installed. Enter localhost or 127.0.0.1 in the browser. If port 80 is not selected during installation, add the port number to access the address.

7. Well, I have to admit that this is a magical website. The reason is that the service is not started after apache is installed.

8. As you can see, he is working.

Apache installation is now complete.

Certificate ------------------------------------------------------------------------------------------------------------------------------------------

MysqlInstallation:

1. Select User-Defined configuration here

2. You can change the installation directory of mysql. In this example, the default directory is used.

3. Check "Launch the MySql instance Configuration Wizard" to configure MySql.

4. Select "Detailed Configuration", "Standard Configuration", and "Detailed Configuration ",

5. 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) ", generally select" Server Machine ". You can select one based on the actual situation. This example uses the development test Type drop.

6. 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 MySAM data types is limited to Non-transactional )", select "Transactional Database Only". In this example, the general multi-function type is selected.

7. 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. Use the default location.

8. select half of the site's mysql traffic and the number of connections at the same time, "demo-support (DSS)/OLAP (about 20)", "Online Transaction Processing (OLTP) (about 500) "," Manual Setting (Manual Setting, input a number by yourself) ", and select" Online Transaction Processing (OLTP )". In this example, select the first item, because only the local machine is used for development and testing.

9. whether to Enable TCP/IP connection and set the port. If it is not enabled, you can only access the mysql database on your own machine and select "Enable TCP/IP Networking" to Enable TCP/IP connection, set the port. If it is not enabled, you can only access the mysql database on your machine and select "Enable TCP/IP Networking ".

10. set database language encoding, "Standard Character Set" is Spanish encoding, "Best Support For Multilingualism" is RTF-8 encoding, "Manual Selected Default Character Set/Collation" is Manual encoding, gbk and gb2312 are Chinese encoded. Select "Best Support For Multilingualism ".

11. Select "Install As Windows Service" to Install the MySql Service. You can customize the Service name.

"Include Bin Directory in Windows PATH" is an environment variable for adding MySql to a machine.

12. Select "Modify Security Settings". You can check "Enable root access from remote machines" as required to allow access from other machines.

13. After completing the configuration, click "Execute" to Execute the configuration.

MySql installation is complete.

Test MySql

Certificate ------------------------------------------------------------------------------------------------------------------------------------------

PhpInstallation:

Extract the php-compressed package to the corresponding directory. In this example, I placed it in the E: \ Program Files \ PHP folder.

PhpConfiguration:

1. Copy PHP. ini-dist from E: \ Program Files \ php to php. ini.

If you do not have a php. ini-dist file, use the php. ini-development file and change the name to php. ini (keep a backup. Good practice)

Php. ini-development for development

Php. ini-produciton

2. Open E: \ Program Files \ PHP \ php. ini and modify the following statement lines:

3. extension_dir = "E: \ Program Files \ PHP \ ext"

4. default_charset = "UTF-8"

5,

5. Remove the Semicolon ";" before extension = php_exif.dll, php_gd2.dll, php_imap.dll, php_mbstring.dll, php_mcrypt.dll, connector, php_mysql.dll, connector, and php_pdf.dll.

6. Add the following values to Path of environment variable:; E: \ Program Files \ PHP \ ext.

7. Other configurations

1. Sometimes the following Warning occurs when writing a php program: PHP Warning: date (): It is not safe to rely on the system's timezone settings. you are * required * to use the date. timezone setting or the date_default_timezone_set () function. in case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. we selected 'utc' for '8. 0/no DST 'Instead in D: \ xxx. php on line 1 0. This is because the time taken by PHP is Greenwich mean time, so there will be a difference between the GMT Standard Time and the Beijing time by about eight hours. We can solve this problem as follows: 1. Use date_default_timezone_set () in the page header to set my default time zone to Beijing time, that is You can. 2. in php. set date in ini. the value of timezone is PRC, and the value after setting is date. timezone = PRC, cancel the comments of this line of code at the same time, that is, remove the semicolon above.

Httpd. conf configuration:

Location of the httpd. conf file: C: \ Program Files \ Apache Software Foundation \ Apache2.2 \ conf.

This is my local installation directory. Note: There are many tutorials on the internet saying that you need to copy the XX dll file under the php Directory to system32. In fact, this is not necessary. You only need to load the php module in httpd. conf.

Add and modify the following statement line: LoadModule php5_module "E:/PHP/php5apache2_2.dll" (you need to add a "" number, otherwise apache cannot start)

[Ps:

If php5apache2_2.dll is not found in the php installation directory, the downloaded version must be incorrect.

There are several texts on the left of the official website:

Which version do I choose?

If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP ....

So you download V6C versions of PHP

VC6 x86 Non Thread Safe

VC6 x86 Thread Safe

One is Thread Safe and the other is Non Thread Safe,

As a result, php of Non-Thread Safe version does not have the Apache option during installation:

Select the web server you wish to setup

IIS FastCGI

Other CGI

Do not setup a web server

The installation of Thread Safe version includes the Apache 2.2.x Module option:

Select the web server you wish to setup

Apache 2.2.x Module

Apaceh CGI

IIS FastCGI

IIS CGI

NSAPI

Xitami

NetServe Web Server

Other CGI

Do not setup a web server]

Bytes ------------------------------------------------------------------------------------------------------

Several PHP versions are available for download. That is, VC6 X86 and VC9 X86.

First, let me answer:

What is VC6?

VC6 is compiled by the legacy Visual Studio 6 compiler.

What is VC9?

VC9 is the Visual Studio 2008 compiler, which is compiled by Microsoft VS editor.

So how do we choose which PHP version to download?

If you are using Apache + PHP in windows, select VC6;

If you are using IIS + PHP in windows, select VC9;

What is Non Thread Safe?

Non-Thread Safe is Non-Thread security;

What is Thread Safe?

Non Thread Safe is Thread security;

We do not recommend that you use Non-Thread Safe in the production environment. Therefore, we use PHP of Thread Safe.

PHPIniDir "E:/Program Files/PHP"

[

If you see

Fatal error: Call to undefined function mysql_connect () in C: \ xxxxx. php

This is because you have not added this attribute.

]

The default storage path of DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs" project can be modified according to the actual situation. Note: in this way, the Directory of the corresponding Directory node also needs to be modified.

AddType application/x-httpd-php. php

DirectoryIndex index. php index.html

Note: The Apache Windows configuration file httpd. the directory separator required in conf is the slash "/", while the PHP Windows configuration file php. when writing a directory in ini, it requires a backslash "\". Do not mix it up.

Configuration test: Create index. php In the directory specified by the DocumentRoot node to print the php configuration information.

You know.

Certificate ------------------------------------------------------------------------------------------------------------------------------------------

1. Download

First download phpMyAdmin on the Internet, you can also go to phpMyAdmin official website download, address: http://www.phpmyadmin.net/home_page/downloads.php and then decompress to the web can access the directory, if it is a virtual space, you can decompress the package and upload it to the web directory using the ftp tool. You can also modify the name of the extracted file.

Ii. Configuration

Open the config. default. php file under the libraries directory, find the following items in sequence, and configure them according to the instructions.

1. Visit the website

2. MySQL host information

Enter the ip address of the localhost or MySQL server. If MySQL and phpMyAdmin are on the same server, press the default localhost

MySQL port. The default value is 3306. leave it blank. If you use another port during MySQL installation, enter it here.

3. MySQL user name and password

4. Authentication Method

There are four modes available here: cookie, http, HTTP, config;
In config mode, you can directly access the phpMyAdmin access URL without entering the user name and password. It is insecure and is not recommended.
When this option is set to cookie, http, or HTTP, You need to verify the data username and password to log on to phpMyAdmin. The details are as follows:
The PHP installation mode is Apache, and http and cookie can be used;
The PHP installation mode is CGI. You can use cookies.

5. Set blowfish_secret

6. Modify the interface language

Modify this attribute to zh [Simplified Chinese]

7. Test PhpMyAdmin

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.