Rey*_*rPM 5 php linux configuration php-5.5
Let's said that I have installed PHP 5.5.x in Ubuntu and it comes with a default configuration. I would like to overwrite a few configurations but I do not want to (this is how I know it's possible):
php.ini file.php file to overwrite them.htaccess files and directivesI would like to create a file named custom-php.ini with the following lines (as an example):
; Basic configuration override
expose_php = Off
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 128M
date.timezone = UTC
max_execution_time = 120
; Error reporting
display_errors = stderr
display_startup_errors = Off
error_reporting = E_ALL
; A bit of performance tuning
realpath_cache_size = 128k
; OpCache tuning
opcache.max_accelerated_files = 32000
; Temporarily disable using HUGE PAGES by OpCache.
; This should improve performance, but requires appropriate OS configuration
; and for now it often results with some weird PHP warning:
; PHP Warning: Zend OPcache huge_code_pages: madvise(HUGEPAGE) failed: Invalid argument (22) in Unknown on line 0
opcache.huge_code_pages=0
; Xdebug
[Xdebug]
xdebug.remote_enable = true
xdebug.remote_host = "192.168.3.1" // this IP should be the host IP
xdebug.remote_port = "9001"
xdebug.idekey = "XDEBUG_PHPSTORM"
Run Code Online (Sandbox Code Playgroud)
Is there any place where I can write this file and default PHP values gets overwrited by the ones on custom-php.ini?
是的,应该是可以的。首先,在您的文档根目录中的某处创建一个 PHP 文件info.php并将其放入<?php phpinfo() ?>。然后从浏览器调用它并查找Scan this dir for additional .ini files. 在 Ubuntu 上,它可能类似于/etc/php5/apache2/conf.d.
在该目录中,您可以放置自己的自定义 ini 文件(将其命名为99.overrides.php.ini),以便最后对其进行解析。
在该文件中,添加您想要的任何其他配置,重新启动 Apache 或 Web 服务器,更改将生效。