php setting (php.ini)

最後更新: 2017-06-06

介紹

 


Execution Time

 

Troubleshoot

Fatal error: Maximum execution time of 120 seconds exceeded in /home/vhosts/...

方法1

<?php
set_time_limit(120);
...
?>

方法2

<?php
ini_set('max_execution_time', 2*60);
...
?>

方法3

.htaccess

php_value max_execution_time 120

 


error_reporting

 

 * 如果 program 寫不好, E_WARNING 很易食盡系統空間

error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_WARNING & ~E_NOTICE

 


expose_php

 

在沒有 phpinfo() 的情況下也知 php 存在及是什麼 Version

Default: On

Exposes to the world that PHP is installed on the server, which includes the PHP version within the HTTP header (Response Headers)

# Server 載入了 mod_php 就有, 即使是透問 txt 檔
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.0.33
# 頁面有執行過 php 就有它
X-Powered-By: PHP/7.3.4

 


session cookies

 

session.use_only_cookies (Defaults to 1)

# Enabling this setting prevents attacks involved passing session ids in URLs

session.cookie_secure

# cookies should only be sent over secure connections (https)

session.cookie_httponly

# Marks the cookie as accessible only through the HTTP protocol.

session.cookie_lifetime

# The value 0 means "until the browser is closed." Defaults to 0.

session.cookie_path

session.cookie_domain

 

 

Creative Commons license icon Creative Commons license icon