Troubleshooting of PHP errors: Difference between revisions

Jump to navigation Jump to search
Line 24: Line 24:


=== 執行PHP時顯示原始碼的錯誤 ===
=== 執行PHP時顯示原始碼的錯誤 ===
* 確認伺服器是否能執行 PHP。驗證方式: [http://php.net/manual/en/function.phpinfo.php phpinfo]/ [http://www.commandlinefu.com/commands/view/818/phpinfo-from-the-command-line phpinfo from the command line | commandlinefu.com]
* 確認伺服器是否能執行 PHP。驗證方式:  
* 如果 PHP 使用 short tag語法撰寫,但是沒有啟用 short_open_tag ,會造成顯示原始碼的錯誤。解法: php.ini 檔案 需要開啟 short_open_tag = Off -> On
** 網頁伺服器放置 [http://php.net/manual/en/function.phpinfo.php phpinfo]/ [http://www.commandlinefu.com/commands/view/818/phpinfo-from-the-command-line phpinfo from the command line | commandlinefu.com]
** {{kbd | key = <nowiki>php -v</nowiki>}} 如果可以顯示 PHP 版本,代表有安裝 PHP
* 如果 PHP 使用 short tag語法撰寫,但是沒有啟用 short_open_tag ,會造成顯示原始碼的錯誤。驗證方式:  
** (1) 輸入指令 {{kbd | key = <nowiki>php -i | grep short_open_tag</nowiki>}} (2) php.ini 檔案 需要開啟 short_open_tag = Off -> On (3) 重新啟動網頁伺服器服務,讓 php.ini 修改生效


=== 錯誤訊息: ERROR: 00000:: ===
=== 錯誤訊息: ERROR: 00000:: ===

Navigation menu