Home Backend Development PHP Tutorial php.ini environment configuration reference plan_PHP tutorial

php.ini environment configuration reference plan_PHP tutorial

Jul 13, 2016 pm 05:08 PM
php.ini about right article plan friend environment Configuration

This article introduces the reference plan for php.ini environment configuration, which will be helpful to many friends. I know that many times, including me, php.ini is the default. Please refer to this article today to deal with it.

The full guide is actually an exaggeration. We will only discuss some configurations that will have an impact on our general development period. Leave other issues to the server managers - we are not network administrators, so we don’t need to Worrying about them should always add some content to their work, right?

 代码如下 复制代码
extension_dir = “/path/to/php”

The directory where extension libraries (modules) are stored, which is the directory used by PHP to find dynamic extension modules. This is usually in the ext directory under the PHP installation directory (the file name may be different before PHP5). This directory is in the Windows version. PHP stores many .dll files such as php_gd2.dll, php_mysql.dll, etc. This is very important to us. Modify it according to the correct path. Generally write an absolute path, for example: d:php5ext

 代码如下 复制代码
error_reporting = E_ALL & ~E_NOTICE

Set the level of error reporting. It is recommended to use E_ALL | E_STRICT, which includes all errors warned by code standards. This will help the code we write at the beginning to be standardized code, haha...

There is one more thing to note about bug reporting

 代码如下 复制代码
display_errors = On

If set to On, the page will display error reports. If set to Off, you will not see error messages even if the level of error reporting is set. As a programmer, there is nothing more troublesome than knowing that there is a problem with the program but not knowing what the problem is.

 代码如下 复制代码
max_execution_time = 30

The maximum time a single program script is allowed to occupy the server, in seconds, can avoid inadvertently writing an infinite loop or other programs that occupy the server for a long time and tire the server to death. If the value is set to 0, the running time is not limited.

 代码如下 复制代码
memory_limit = 16M

The maximum amount of memory that a single program script can occupy, set to -1 to indicate no limit

 代码如下 复制代码
max_input_time = -1

The maximum allowed time (seconds) for a single script to parse input data (POST, GET, upload), set to -1 to indicate no limit.

 代码如下 复制代码
post_max_size = 8M

Maximum byte length allowed for POST data. This setting also affects file uploads. To upload large files, this value must be greater than the value of the upload_max_filesize directive.
If memory limit is enabled, this value should be less than the value of the memory_limit directive.

The code is as follows Copy code
upload_max_filesize = 2M
 代码如下 复制代码
upload_max_filesize = 2M

The size of the files allowed to be uploaded is two megabytes by default. If you need to upload files larger than 2M, you need to modify this. Of course, you need to modify the values ​​​​of memory_limit and post_max_size in association.

The code is as follows Copy code
upload_tmp_dir =
 代码如下 复制代码
upload_tmp_dir =

The temporary directory where files are stored when uploading files. This directory must be writable by the PHP process. If not specified, PHP will use the system default temporary directory

The code is as follows Copy code
magic_quotes_gpc = On
 代码如下 复制代码
magic_quotes_gpc = On

Whether to use automatic string escaping ( ' ” NULL ) for input GET/POST/Cookie data, generally set to On, but in the actual programming environment, do not rely on this setting. Generally, it is necessary to judge the data after Process, look at the code
……

The code is as follows Copy code
 代码如下 复制代码

if (!get_magic_quotes_gpc()) { //判断该设置是否为On
$lastname = addslashes($_POST['lastname']);//不为On手工转义
} else {
$lastname = $_POST['lastname'];//否则直接使用
}
……

register_globals = Off

if (!get_magic_quotes_gpc()) { //Determine whether the setting is On

$lastname = addslashes($_POST['lastname']);//Do not manually escape for On

} else {

$lastname = $_POST['lastname'];//Otherwise use

directly }

……

 代码如下 复制代码
mbstring.language = “neutral”
register_globals = Off
I won’t go into details about this setting that has been deleted in PHP6. It must be set to Off! [mbstring] module This module is an extension for Chinese, Korean, Japanese and other double-byte characters. The following settings are usually turned off. If you want to enable these extensions, please remove the preceding ";". However, these settings are a bit too personalized. It is recommended not to set them. If you encounter Chinese interception or length measurement, just go to the Internet to find a program written by someone.
The code is as follows Copy code
mbstring.language = “neutral”

The default value "neutral" means neutral, equivalent to unknown, "zh-cn" or "Simplified Chinese" means simplified Chinese, "zh-tw" or "Traditional Chinese" means traditional Chinese

I don’t want to talk about the rest. If you really need it, let’s talk about it. You can contact me or ask in the group number posted on the top right of the homepage.

Enable extension module instance

extension=php_gd2.dll, enable the gd library extension, which is used to generate images
The code is as follows
 代码如下 复制代码

extension=php_gd2.dll,启用gd库扩展,这个用于生成图片的

extension=php_mysql.dll

Copy code

extension=php_mysql.dll

, enable the Mysql database extension. Only by enabling this PHP can it be possible to connect to the Mysql database. Remove the semicolon in front of these two lines (or directly add these two lines to the ini settings), which means it is enabled. http://www.bkjia.com/PHPjc/629838.htmlwww.bkjia.com
true
http: //www.bkjia.com/PHPjc/629838.html
TechArticleThis article introduces the reference plan for php.ini environment configuration, which will be helpful to many friends. I know that includes I leave php.ini as the default most of the time. Please refer to this article today...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! How can I make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! Mar 15, 2024 pm 04:13 PM

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps The perfect combination of PyCharm and PyTorch: detailed installation and configuration steps Feb 21, 2024 pm 12:00 PM

PyCharm is a powerful integrated development environment (IDE), and PyTorch is a popular open source framework in the field of deep learning. In the field of machine learning and deep learning, using PyCharm and PyTorch for development can greatly improve development efficiency and code quality. This article will introduce in detail how to install and configure PyTorch in PyCharm, and attach specific code examples to help readers better utilize the powerful functions of these two. Step 1: Install PyCharm and Python

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

What is the difference between TikTok fans and friends? How to increase fans? What is the difference between TikTok fans and friends? How to increase fans? Mar 07, 2024 pm 09:52 PM

As one of the most popular short video platforms in China, Douyin has attracted a large number of users and fans. On TikTok, we often hear about fans and friends, but do you know what the difference is between TikTok fans and friends? This question will be answered in detail below. 1. What is the difference between Douyin fans and friends? On TikTok, fans are people who are interested in your content and choose to follow you. They will interact with you through likes, comments, etc. to establish a virtual connection. Friends, on the other hand, are people who know each other in real life and have real social relationships with each other. On social platforms like Douyin, the methods and depth of interactions between fans and friends may vary, but they are all important elements in building and maintaining a social network. The number of fans refers to those who follow your account

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

Flask installation and configuration tutorial: a tool to easily build Python web applications Flask installation and configuration tutorial: a tool to easily build Python web applications Feb 20, 2024 pm 11:12 PM

Flask installation and configuration tutorial: A tool to easily build Python Web applications, specific code examples are required. Introduction: With the increasing popularity of Python, Web development has become one of the necessary skills for Python programmers. To carry out web development in Python, we need to choose a suitable web framework. Among the many Python Web frameworks, Flask is a simple, easy-to-use and flexible framework that is favored by developers. This article will introduce the installation of Flask framework,

See all articles