Apache PHP Environment Configuration method in Windows (php.ini configuration)

Source: Internet
Author: User
Tags apache download apache php install php php code blank page

First, we go to php.net to download a version of PHP, remember if Windows Oh, but also need to be a thread version.

We first extract PHP to the c:/php directory, and then find the configuration file in PHP.ini (to the award php.ini-development to php.ini)


1 Setting the extension path

Find Extension_dir there's a line

The code is as follows Copy Code
Extension_dir = "./"

Change this row to

The code is as follows Copy Code

Extension_dir = "C:phpext"

Where c:php is the path where you install PHP. Incorrect path will not load DLL

(Note: some PHP versions are; extension_dir = "./" To remove the preceding semicolon)

2 Find

The code is as follows Copy Code

; Extension=php_curl.dll
; Extension=php_gd2.dll
; Extension=php_mbstring.dll
; Extension=php_exif.dll
; Extension=php_mysql.dll
; Extension=php_mysqli.dll
; Extension=php_sockets.dll
; Extension=php_xmlrpc.dll
; Extension=php_zip.dll

Remove the semicolon before the above items so that you can load the DLLs
When installing PHP with IIS, you need to copy these DLL files to C:windowssystem32

3 Set Session Save path
Find Session.save_path there's a line
; Session.save_path = "N;/path"
Add a line after this row (note that you are adding a line, not to the back),
Session.save_path = "C:temp"
If you use a level two catalog to store sessions, you need to modify to:
Session.save_path = "2; C:temp "
Save to your temp directory, where you set your own path, note Modify folder permissions

How to set up level two directory tiered storage see:
Hierarchical storage and periodic deletion of PHP temporary file session

4 There are more noteworthy is short_open_tag. Some PHP versions are off by default.
This means that PHP cannot use short tags if you must use
Because the short mark is easy to use, and many programs also use a short mark to write, such as Discuz
If you do not change the Short_open_tag to on will appear the symptom will be difficult to judge is the above reason, here proposes modifies
Find
Short_open_tag = Off
To
Short_open_tag = On

5 whether to display errors Display_errors
For security reasons, some versions of display_errors also default to OFF.
That is, when debugging, if the PHP code is wrong, only a blank page appears. The cause of the error and the number of rows are not displayed.
This will be very inconvenient to debug, the proposal according to their own needs to modify
Find
Display_errors = off (note not; –display_errors = off [security])
Change into
Display_errors = On

6 Show notice Warning tips
The fifth step opens the error prompt, but the error report is also controlled by error_reporting.
PHP5 The default shutdown notice warning prompt, if it is in the local debugging, it is recommended to open notice warning prompt.
Find
error_reporting = E_all & ~e_notice
Change into
error_reporting = E_all
Another hint, in the program can also through the error_reporting () control error report output, specific how to use everyone to refer to the manual.

7 register_globals

It defaults to off for security reasons
When Register_globals=off, the next program should be received with $_post[' user_name ' and $_post[' User_pass ')
When Register_globals=on, the next program can accept values directly using $user_name and $user_pass.

8 PHP5 jet lag problem

Time difference Eight hours
Why, then? The PHP5 series has new time zone settings, the default is GMT, and China's East 8 area is exactly 8 hours
Find Date.timezone there's a line
;d Ate.timezone =
Remove, change
Date.timezone = PRC
of which Prc:people ' s Republic of China,


After configuration, but let's configure Apache,apache. We can also go to apache.org to download a x86 Apache download and install it in the computer, and then we open the Apache installation directory of httpd.conf in the final join

The code is as follows Copy Code

LoadModule php5_module "C:/php/php5apache2_2.dll"
Phpinidir "c:/php/"
AddType application/x-httpd-php. php. phtml

You can restart Apache, OH.

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.