Editing
Troubleshooting of PHP errors
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Error Handling and Debugging == === 錯誤訊息: ERROR: 00000:: === * 原因: 想要刪除的資料不在 MySQL 資料庫內,進行刪除時,會發生的錯誤。 * 解決方法: 先檢查該資料是否存在,再進行刪除。 === 錯誤訊息: PHP syntax error “unexpected $end” === 解決方法 * 檢查括弧是否封閉: 使用 [http://notepad-plus-plus.org/ Notepad++]{{kbd | key=ctrl}} + {{kbd | key=b}} 檢查括弧是否封閉 或 使用 [http://www.sublimetext.com/ Sublime Text]{{kbd | key=ctrl}} + {{kbd | key=m}} 檢查括弧是否封閉 * {{kbd | key=<nowiki><?php</nowiki>}} 是否簡寫為 shorttag {{kbd | key=<nowiki><?</nowiki>}} === 錯誤訊息: SMTP Error: Could not connect to SMTP host. === 錯誤訊息: Invalid address: SMTP -> ERROR: Failed to connect to server: Permission denied (13) SMTP Error: Could not connect to SMTP host. Mailer Error: SMTP Error: Could not connect to SMTP host. 解決方法 * 檢查 PHP 模組是否安裝 OpenSSL {{kbd | key =<nowiki> php -r "phpinfo();" | grep -i "OpenSSL support"</nowiki> }} 或 {{kbd | key =<nowiki> php -i | grep -i OpenSSL</nowiki> }} for {{Linux}} 預期結果: <pre> OpenSSL support => enabled </pre> * SELinux設定 [http://www.lahory.com/phpmailer-smtp-error-failed-to-connect-to-server-permission-denied-13/ PHPMailer SMTP -> ERROR: Failed to connect to server: Permission denied (13) | Lahory] 預期結果: <pre> # getsebool httpd_can_sendmail httpd_can_sendmail --> on # getsebool httpd_can_network_connect httpd_can_network_connect --> on </pre> 非預期結果: <pre> # getsebool httpd_can_sendmail httpd_can_sendmail --> off # getsebool httpd_can_network_connect httpd_can_network_connect --> off </pre> 需要輸入指令: <pre> # setsebool -P httpd_can_sendmail 1 # setsebool -P httpd_can_network_connect 1 </pre> 相關頁面: [[Email testing]] === COMPOSER 升級 PHPUNIT 版本 6 到 7 遇到問題 YOUR REQUIREMENTS COULD NOT BE RESOLVED TO AN INSTALLABLE SET OF PACKAGES === [https://errerrors.blogspot.com/2018/04/resolve-use-composer-upgrade-phpunit-version-from-6-to-7.html 解決 Composer 升級 PHPUnit 版本 6 到 7 遇到問題 Your requirements could not be resolved to an installable set of packages] === 停止無限迴圈 === [https://stackoverflow.com/questions/9468332/how-can-i-find-out-which-php-script-a-process-is-running-in-linux How can I find out which PHP script a process is running in Linux? - Stack Overflow] <pre> ps aux | grep php </pre> [https://superuser.com/questions/800207/how-do-i-find-and-kill-a-php-loop-process command line - How do I find and kill a php loop (process)? - Super User] <pre> pkill -9 php </pre> [https://www.geeksforgeeks.org/php-shell_exec-vs-exec-function/ PHP | shell_exec() vs exec() Function - GeeksforGeeks] Or input the {{kbd | key=kill}} command to stop the process if you have the permission. See details on [[Linux_commands#Show_the_process_list_.26_kill_the_process]] === Json errors === [[Resolve PHP json decode error]] === phpgrid: Couldn't execute query === [http://www.phpgrid.org/ PHP Grid Framework] 錯誤訊息: Couldn't execute query. You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ... * 解法: 查詢語法中包含複雜的 sub query 雖然可以順利呈現查詢結果,但是搜尋篩選時出現查詢錯誤。如果要使用 phpgrid ,建議降低查詢的複雜度。
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information