Installation and configuration of apache + php + mysql (windows)

Source: Internet
Author: User

 

I have been studying PHP for just a few months. In the past, I would like to summarize some of the basic installation and configuration I have learned as follows:

 

 

1. download the relevant installation package:

1. Download apache installation package: http://httpd.apache.org/download.cgi (to download 2.2.1 and above...) directly download
(Delete: C: \ Documents ents and Settings \ All Users \ Application Data, there will be folders to be deleted)
2. Download the php installation package: http://windows.php.net/download/
3. Download the mysql installation package: http://download.mysql.cn/

Ii. Check whether the installation is successful and related configurations:

1. (1 ),Apache Verification:

Run http: // localhost/

(2 ),Apache configuration:

First, go to the apache installation directory and find the httpd. conf file in the conf folder. Add the following three sentences:

 

LoadModule php5_module D:/php5.4.12/php5apache2_2.dll # This is the PHP script to load; LoadModule php5_module is the fixed mode; D:/php5.4.12 is the directory for your PHP installation
PHPIniDir "d:/php5.4.12" # This is the directory for configuring PHP. ini.
AddType application/x-httpd-php. php. phtml # This supports parsing PHP extensions (. php. phtml extensions, you can add other ones you need)

When we successfully add these three statements to apache, We will modify PHP in php. ini file to enable related components (see the following php configuration)

2. (1 ),Php Verification:

Download the related compressed package;

(2 ),Php configuration:

First find the file php. ini-development (for development) and php. ini-production (this is for servers); in fact, they are all php. ini file. Here we use php. ini-production: copy a copy to name it php. ini file;
Then open php. INI file --> set the path of the component (search for the path of extension_dir) --> Find extension_dir = ". /"turn it on (remove the # sign above), --> ". /"here, the path of the component is: extension_dir =" d:/php5.4.12/ext "(d:/php5.4.12/ext is the position of the component when you install PHP );
At this time, we choose to save it, restart apache, and see if we can support our PHP. Then, in the installation directory where apache is located, hit the directory htdocs to which it points, then write an index. the PHP file content is <? Php phpinfo ();?> Open http: // localhost/index. php. If you can see the php environment, it means it is successful!
When the installation is complete, many components are not enabled. Next we can enable common components (remove the semicolon ):

Extension = php_bz2.dll
Extension = php_gd2.dll; gd library
Extension = php_mysql.dll
Extension = php_mysqli.dll
Extension = php_pdo_mysql.dll; required if Mysql database is used;
You can also enable it as needed...

3,Mysql Verification:

Open the command cmd --> enter mysql-u root-p and press enter --> if you want to enter the password, it will be successful if you can log on!

 

Attachment: Virtual Machine Configuration:

1. First open the file httpd. conf in conf under the apache installation directory; then find # Include conf/extra/httpd-vhosts.conf to remove the previous # Include conf/extra/httpd-vhosts.conf
2. Configure the file httpd-vhosts.conf in conf \ extra under the apache installation directory;
Add a VM as follows:

<VirtualHost *: 80>
DocumentRoot "F:/site" # DocumentRoot is used to find the page to be displayed with the service name. The file name suffix cannot be HTML (this is currently found)
ServerName ff.dd.localhost.com # ff.dd.localhost.com is the domain name opened
<Directory "F:/site"> # F:/site is the Directory where the file is located.
Options Indexes FollowSymLinks
AllowOverride All
Order allow, deny
Allow from all
</Directory>
</VirtualHost>

3. Find the hosts file under C: \ WINDOWS \ system32 \ drivers \ etc;

Add a specified item to the file:
127.0.0.1 ff.dd.localhost.com

Save and restart apache;

4. Run ff.dd.localhost.com in the browser. OK !!

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.