1. 程式人生 > >Linux-LNMP-PHP相關配置

Linux-LNMP-PHP相關配置

檢視php配置檔案位置

/usr/local/php/bin/php -i|grep -i "loaded configuration file"
需要檢視那個站點的配置檔案,去站點的目錄下,建立phpinfo();
具體:
<?php
phpinfo();

date.timezone #定義時區,Asia/Shanghai
disable_functions #安全函式
eval,assert,popen,passthru,escapeshellarg,escapeshellcmd,passthru,exec,system,chroot,scandir,chgrp,chown,escapeshellcmd,escapeshellarg,shell_exec,proc_get_status,ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,readlink,symlink,leak,popepassthru,stream_socket_server,popen,proc_open,proc_close
error_log, log_errors, display_errors, error_reporting #危險的函式,以逗號隔開,生產中,就禁止phpinfo
Linux-LNMP-PHP相關配置

這種提示,代表被禁掉
Linux-LNMP-PHP相關配置
會將錯誤資訊,顯示在頁面上,如上圖所示,會暴露目錄,需要改成off,頁面會變成空白
Linux-LNMP-PHP相關配置

是否開啟錯誤日誌
Linux-LNMP-PHP相關配置
定義錯誤日誌生成路徑![
Linux-LNMP-PHP相關配置
定義error_log級別,生產中,一般使用E_ALL & ~ E_NOTICE
Linux-LNMP-PHP相關配置
open_basedir #安全選項,各個網站目錄的隔離
Linux-LNMP-PHP相關配置
php_admin_value open_basedir "/data/wwwroot/111.com:/tmp/" #虛擬主機配置檔案。可以針對不同的虛擬主機進行配置