Ubuntu Server系列各項服務的安裝和維護 PHP的配置

1PHP配置文件php

文件所在目錄 /etc/php5/apache2/php.ini apache

Php.ini 中「資源限制」 Resource Limits須要調整的可能性比較大。ide

;;;;;;;;;;;;;;;;;;;測試

; Resource Limits ;網站

;;;;;;;;;;;;;;;;;;;this

 

; Maximum execution time of each script, in secondsidea

; http://php.net/max-execution-timespa

; Note: This directive is hardcoded to 0 for the CLI SAPI.net

max_execution_time = 30 //單個PHP文件的最大運行時間,單位是秒rest

 

; idea to limit this time on productions servers in order to eliminate unexpect$

; long running scripts.

; Note: This directive is hardcoded to -1 for the CLI SAPI

; Default Value: -1 (Unlimited)

; Development Value: 60 (60 seconds)

; Production Value: 60 (60 seconds)

; http://php.net/max-input-time

max_input_time = 60 //單個PHP文件接收數據花費的最大時間

 

; Maximum amount of memory a script may consume (128MB)

; http://php.net/memory-limit

memory_limit = 128M //單個PHP文件能夠佔用的最大內存

 

二、 測試PHP是否已經運行

進入網站所在目錄,創建info.php文件,輸出php信息。


三、 PHP排錯

phpinfo沒有正常顯示時,可能出現如下問題:

第1、  沒有重啓APACE,從新啓動下

第2、  查看APACHE是否啓用了PHP模塊,啓用並從新啓動APACHE

Sudo a2enmod php5

Sudo apache2ct1 restart

第3、若是 sudo a2enmod php5命令返回錯誤,則須要刪除libapache2-mod-php5軟件包,並從新安裝

相關文章
相關標籤/搜索