Php+apache+mysql Environment Construction Tutorial _php Example

Source: Internet
Author: User
Tags apache download mysql download php download php website
Php+apache+mysql Download
php Download:Http://www.php.net Enter the PHP website and click Download to enter the following interface. The above shows the different versions I chose is the php5.6.19 version, this is more stable, if there is no version of the requirements, it is recommended to use this version. Develop PHP in a Windows environment, so continue to click on Windows downloads in the picture to download the zip package.


In the interface can be seen in the main VC11 X64 thread safe,vc11 X64 None thread safe and other versions, I chose VC11 X64 thread safe thread Security Zip compression package.


After the download is directly extracted to the directory you want to place, remember that the next Apache installation package must be in the same directory, open the folder can see the file, Where ext is stored to use all the dynamic link library files (. dll) because it is a compressed package, we also need to manually set up, there is no php.ini file in the original folder, you need to copy the Php.ini-development file in the package renamed, because we need to php.ini to do our set of P HP initialization.


Apache Download:http://www.apachehaus.com/cgi-bin/download.plx This link to the download interface Apache can be directly on the latest version, for compatibility considerations recommended to choose VC9 version, The specific differences on the page are explained on this is not to repeat.


Click Download in the Red border to install the package, and then follow the prompts to install the line, Remember to install in the same directory as the PHP decompression package

Next you need to configure the master service to install Apache, and with it, Apache can start:

Open the cmd window, enter : "D:studytools\apache\bin\httpd.exe"-K install-n Apache where d:studytools\apache\bin\ Httpd.exe is my own path, everyone needs to change according to their own path.

Remember to include quotation marks. The command means installing the Apache service and naming the service name Apache (you can also change to another), enter.

Service installation completed, after completion, will be automatically tested, if there is a problem, the window will prompt the error, at this time, please self-troubleshooting according to the error.

Among them, Errors reported here must is corrected before the service can be started. This means that if there is an error message behind the sentence, the service installation fails and the error needs to be corrected first. If not, then success.

MySQL download install too many steps, the online tutorial is very detailed, omitted in this ....

But small series for everyone to share a few articles for your reference:

MySQL 5.7.12 winx64 Installation configuration method Graphic Tutorial

MySQL 5.7.13 installation configuration method graphic Tutorial (Linux)

MySQL 5.7.13 winx64 Installation configuration method Graphic Tutorial

Special topic Sharing: MySQL different version installation tutorial

Now start building the three environments:
1. In order for PHP to be able to connect with MySQL, Apache can parse PHP, we need to make some changes to Php,apache.

(1) Change the php.ini-development file to php.ini and put it in the original folder.

(2) Open php.ini file to find ; extension=php_mysql.dll; extension=php_mysqli.dll Remove the front ";" As


After you remove the preceding semicolon, you can then connect to the database in MySQL or mysqli mode. In the future to use other such as PDO connection database, you can follow the tutorial to the next few about PDO number to cancel out. Next to find "extension_dir=" in the back to fill in their own Dynamic link Library folder path, that is,/php/ext such as my PHP under the Ext package path is D:\studytools\php\ext so set as red box. This gives us the path to the dynamic link library contained in PHP, and it is recommended that you add the path of ext in the path of your computer's environment variable.


After that, there's no problem between PHP and the database.

Next solve the problem of Apache parsing PHP
1. Open the httpd.conf file of the Conf folder under the Apache installation package to find the Define srvroot "" In the code to write the Apache path, and then add the following snippet to save the line

LoadModule php5_module "E:/wamp/php-5.6/php5apache2_4.dll"

Phpinidir "e:/wamp/php-5.6/"

AddType application/x-httpd-php. php

AddType Application/x-httpd-php-source. Phps

Whether the test was successful
Finally, under Apache under the Htdocs folder to start writing their own PHP files, you can write a test.php file, content:

<?php  phpinof ();?>

Save, open the ApacheMonitor.exe in the bin file under Apache, click Start, and then on the website input localhost/test.php environment, the following interface will appear. In the interface there will be PHP information, if MySQL is connected, will also appear in the following MySQL information.


The above is the whole content of this article, I hope that everyone's learning has helped, but also hope that we support the script home.

  • 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.