A summary of some problems about php.ini

Source: Internet
Author: User

"① time zone Problem"PHP Use Date function

Such as:

Strtotime (' 2014-01-05 ');d ate (' y-m-d h:i ', Time ());
There will be an inexplicable increase of 8 hours or minus eight hours after the result
So what?
This is a time zone problem and you can modify the time zone.

Solution One:
Ini_set (' Date.timezone ', ' Asia/shanghai '); This sentence must be placed in the first line of the document//or Date_default_timezone_set (' Asia/shanghai '); This sentence can be placed anywhere

Solution Two:
Modify the php.ini file directly

Data.timezone = ' Asia/shanghai ';

"② upload Problem"

A lot of times, when uploading larger files, you will find that prompts to upload more than the limit and so on
How to solve?
Uploading large files mainly involves configuring Upload_max_filesize and post_max_size two options
Locate php.ini File:

Upload_max_filesize = 1024M Post_max_size = 1024M

This allows you to upload a single file to 1G, of course, you can set the size you want to set.

[Note:] The issue of uploading temporary file permissions may be involved under Linux.
such as configuration

Upload_tmp_dir = '/temp/upload '; You need to use commands to increase read and write permissions for this directory

"③ page Execution Timeout issue"


Sometimes the page data volume is large, the short time execution is complete, will appear the time-out phenomenon
How to solve?
Way One:
Setting up the php.ini file

Max_execution_time = 60*60*10; #表示允许执行的最大时间为10分钟                                  #当值为0的时候 means no limit (not recommended)

Way two:
Modify in the program
Modify Maximum execution Time


"④ Magic quotes Open and close"


About preventing SQL injection, malicious submission of forms, introduction of Magic quotes, how to turn off?
How to solve?
Way One:
Set PHP.ini

MAGIC_QUOTES_GPC = off/on; Magic_quotes_runtime = off/on; Magic_quotes_sybase = off/on;
Way Two:
At the head file of each program, add:
<?phpif (GET_MAGIC_QUOTES_GPC ()) {function Stripslashes_deep ($value) {$value = Is_array ($value)? Array_map (' Stripslashes_deep ', $value): Stripslashes ($value); return $value;} $_post = Array_map (' Stripslashes_deep ', $_post); $_get = Array_map (' Stripslashes_deep ', $_get); $_cookie = Array_map (' Stripslashes_deep ', $_cookie); $_request = Array_map (' Stripslashes_deep ', $_request);}  

"⑤ Install extensions"


Let's take the Debug tool Xbug as an example
Download the corresponding version of the Xdebug file into the PHP installation directory
Add the following code to the php.ini and restart the Apache/nginx

Zend_extension = "E:/wamps/php/myext/php_xdebug-2.2.6-5.3-vc9.dll";  [Xdebug] xdebug.remote_enable = OFF; xdebug.profiler_enable = OFF; Xdebug.profiler_enable_trigger = on; Xdebug.profiler_output_name = cachegrind.out.%t.%p;  Xdebug.profiler_output_dir = "E:/wamps/tmp"
of course, for different plug-ins specifically to add what, depending on the circumstances.

"⑥ Open the Extender library"


For example, we want to use MySQL's library of functions, we want to open the following: (Remove the previous '; ') To

Extension=php_mysql.dll Extension=php_mysqli.dll





A summary of some problems about php.ini

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.