PHP.ini performance optimization

Source: Internet
Author: User
Keywords Network programming PHP tutorial
Tags added caching change code content copy directory error.log

Code:

ctrl + y Find: disable_functions

After found in the = added

(Here are the functions that are prohibited in php) Code:

Copy the contents to the clipboard

exec, system, passthru, error_log, ini_alter, dl, openlog, syslog, readlink,

symlink, link, leak, fsockopen, proc_open, popepassthru, chroot, scandir,

chgrp, chown, escapeshellcmd, escapeshellarg, shell_exec, proc_get_status, popen

Put the contents of the above into his party. Because of the overall effect of keeping the post made a wrap

General background only plus:

Copy the contents to the clipboard

disable_functions = system, passthru, shell_exec, com, exec, shell

Find: display_errors

If it is On, change to Off

Find: magic_quotes_gpc

If Off is changed to On

Find: register_globals

If it is On, change to Off

Find: open_basedir

Behind to increase

/ www /: / tmp /

Here is the limit php can access the directory, the back must be added /, otherwise / wwwabcd this directory will be accessed

Multiple directories in English: separated. If you do not add / tmp / Discuz! Upload function can not be used

Note: The above content will be set at the beginning of the php.ini tips, press ctrl + x to find the next one, do not directly modify the above

------------------------------

Optimize php.ini

GD library support

; extension = php_gd2.dll

Remove the front colon

output_buffering = Off

The output cache allows you to send headers (headers, including cookies) even after outputting the body content at the expense of the output layer slowing down a bit. You can use output caching to turn on output caching at run time, or set the directive to On to enable the output caching of all files open at this point.

output_handler =; You can redirect all the output of your script to a function,

That might be useful for handling or logging it.

For example, if you set this output_handler to ob_gzhandler, the output will be transparently compressed for browsers that support gzip or deflate encoding.

Set an output processor to automatically turn on the output buffer.

Find this

output_buffering = Off

change into

On

Note that do not set the value, just set to On.

Accordingly, you can also open your gzip support in your discuz background, but also an optimization of the content.

Some friends for security, but also enabled the php security model, this is also a way

In addition, some friends need to use the global variables and MAGIC, which is a prerequisite for some php programs, discuz2.0 also need

Can be opened, but the safety performance will be reduced, the method is very simple.

register_globals = Off;

Change it to On.

Some friends often reflect the large files can not be uploaded or the background backup data often time-out

max_execution_time = 30; This is the maximum time each script runs, you can modify the longer, in seconds

max_input_time = 60; This is the time that each script can consume, in seconds

memory_limit = 8M; This is the largest memory running script, you can also increase

upload_max_filesize = 2M; upload the file's maximum allowable size, change it yourself, some picture forums need this larger value

in case:

php error shows PHP has encountered an Access Violation at XXXXXX solution

Many people say that it is a php version of the problem, it is not, from four places to see this issue

1, whether the zend required dll file directory to the permissions is not enough, there must be read and run permissions

2, whether the use of 2003, set the application pool, such as what the pool limit what, adjust and try again, is it good, huh, huh

Php.ini There are two places not set, but some programs must be used

Upload_tmp_dir The line comment, making the line work in the php.ini document.

upload_tmp_dir is used to define the temporary path to store the uploaded file, where you can also define an absolute path,

For example: upload_tmp_dir = d: upload Of course, this time your d: upload directory must have read and write permissions.

Here I set it to

upload_tmp_dir = c: temp

This error statement is generally because of your php.ini session.save_path not set a good,

The solution is to set session.save_path and session.cookie_path to

session.save_path = c: temp

session.cookie_path = c: temp (I did not modify this, I found that the revised verification Ma can not be used)

Then create a temp directory in the c: directory

Related Article

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.