How to modify php.ini on mac: 1. Execute the "sudo cp /private/etc/php.ini.default /private/etc/php.ini" command; 2. Directly modify the php.ini configuration file That’s it.
The operating environment of this article: macOS10.15 system, PHP7.1 version, MacBook Air 2019 computer
##1. Configure php.ini# in the PHP environment that comes with Mac
## There is no default php.ini file in Mac OS X, but there is a corresponding template file php.ini.default, located at /private/etc/php.ini.default or /etc/php.ini/default , you can make a copy for modification.
2. Modify the php.ini configuration file in XAMPP For Mac
Modify the php.ini configuration file during installation Directory/Applications/XAMPP/xamppfiles/etc/php.ini
file_uploads=on/off
Whether it is allowed to upload files via http
max_execution_time=30
The maximum execution time allowed for the script, if it exceeds this time, an error will be reported
memory_limit=50M
Set the maximum amount of memory that a script can allocate to prevent runaway scripts from occupying too much memory. This instruction only takes effect when the –enable-memory-limit flag is set during compilation.
upload_max_filesize=20M
The maximum size of files allowed to be uploaded, this command must be smaller than post_max_size
upload_tmp_dir
The temporary storage directory for uploaded files
post_max_size=30M
Allow the post method to accept the maximum size
$_FILES array content is as follows:
$_FILES['myFile']['name']
The original name of the client's last file
$_FILES['myFile']['type']
The MIME type of the file, the browser needs to provide support for this information, such as "image/gif"
$_FILES['myFile']['size']
The size of the uploaded file in bytes
$_FILES['myFile'] ['tmp_name']
The temporary file name stored on the server after the file is uploaded, usually the system default. It can be specified in upload_tmp_dir of php.ini, but setting it with the putenv() function will not work
$_FILES['myFile']['error']
Status code related to the file upload
$_FILES['myFile']['error']
Status code related to the file upload . [‘error’] was added in PHP version 4.2.0. The following is its description: (They became constants after PHP3.0)
UPLOAD_ERR_OK Value: 0
No error occurred, the file was uploaded successfully
UPLOAD_ERR_INI_SIZE value: 1
The uploaded file exceeds the value limited by the upload_max_filesize option in php.ini
UPLOAD_ERR_FORM_SIZE value: 2
The size of the uploaded file exceeds the value specified by the MAX_FILE_SIZE option in the HTML form
The above is the detailed content of How to modify php.ini on mac. For more information, please follow other related articles on the PHP Chinese 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