PHP configuration steps

Source: Internet
Author: User

Background:

As a web front-end person, it is essential to have access to some server-side scripting languages, such as PHP. Because of the recent summary of the relevant knowledge, but also review the basic knowledge of PHP. This summary begins with PHP, that is, the configuration steps of PHP.

What is PHP?

 PHP, a nested abbreviated name, is an abbreviation for the English Super Text preprocessing language (Php:hypertext preprocessor). PHP is an embedded HTML language, PHP and Microsoft's ASP quite a bit similar, is a server-side execution of embedded HTML document scripting language.

PHP is a powerful server-side scripting language for creating dynamic, interactive sites.

Because of the PHP features, that is, running on the server side, if you want to run PHP files locally, you need to install the Web server software locally, I am more skilled Apache, this time to the main Apache configuration, run the system for Windows.

PHP Configuration directory:

1. Preparation-Install the operating environment VC11 or match PHP version (configure the operating environment)

2. Install and configure the Apache server

3. Install and configure the PHP runtime environment

4.PHP integration with Apache

5. Test Configuration Results

Specific steps:

  1th step: Getting ready to work-Install the runtime environment VC11 or match PHP version

1, vc11:https://www.microsoft.com/zh-cn/download/details.aspx?id=30679

2, note: 32-bit or 64-bit, according to the version of the system to choose (name with _x64 for the 64-bit system, _x86 32 for the system).

  2nd Step: Install and configure the Apache server

1,: https://www.apachelounge.com/download/VC11/(download version to be the same as the operating environment)

2. Unzip the file

3. Configure Apache

(generally for the convenience of management, I habitually unzip PHP and Apache into the same folder, the WWW folder is the php file running folder.) This is the custom for me to debug PHP files privately)

    

-config file: Apache installation directory conf->httpd.conf (open httpd.conf file under Conf)

-A configuration item
ServerRoot "Extracting directory"

      
Listen Port (default 80, port number can be set by itself)

      
DocumentRoot "Web root directory"

Directory ibid.

      

4. Registration Service
Enter the bin in the Apache installation directory, press SHIFT, right-click to select "Open Command Window Here"

-Registration Service httpd-k install-n "service Name"

    

-View service startup status: Service Name, services, management tools

5. Start or stop the service
Method 1 service Name, management tools, services
Method 2 Command prompt: NET Start|stop service Name
Method 3 Apache Comes with service tool: Apachemonite

Note: Each time you modify the configuration file, you need to restart the Apache server.

  3rd Step: Install and configure the PHP runtime environment

1. Download php:http://windows.php.net/download#php-5.6
Note:
Version One: Latest 7.0, download 5.6

Version two: Thread Safe (Apache) and Non-thread Safe (IIS)

2. Decompression
Note: Preferably with Apache in the same directory, easy to manage

3. Basic Configuration
-Modify config file name: php.ini-development or Php.ini-production to PHP.ini

(Php.ini-development corresponds to php.ini-dist suitable for development testing, such as a local test environment, with the advantage of error prompting,php.ini-production corresponds to php.ini-recommended Has a high security setting )

-Modify Common configuration items
Set up the Extension components directory: Extension_dir for PHP installation directory ext folder

    
Start Extension=php_mysql.dll
Extension=php_mysqli.dll
Extension=php_pdo_mysql.dll

(Search for three startup items in php.ini, and delete the semicolon before the start-up is started)

    

  4th Step: PHP and Apache Integration

1. Open Apache configuration file httpd.conf

2. Loading PHP Module
LoadModule php5_module "Php5apache2_4.dll Absolute path"

3. Set PHP initialization directory

Phpinidir PHP Extract Directory

   

4. Add MIME type
AddType application/x-httpd-php. php

  

5. Restart Service

  5th step: Test the configuration results

1. Create a file with a PHP extension in the Apache Web site Directory

2. Write the following code
<?php
Phpinfo ();

Then run the file and if you run the results like, then prove that the PHP configuration is successful.

  

PHP configuration steps

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.