Solve ThinkPHP errors reported when the debug mode is disabled.

Source: Internet
Author: User
Tags parse error

Solve ThinkPHP errors reported when the debug mode is disabled.

Solve ThinkPHP errors reported when the debug mode is disabled.

This article summarizes several situations that I encountered when I disabled the ThinkPHP debugging mode in my project and the final solution. It is very simple and practical. I will share it with you here, if you have any need, refer.

Case 1:

I recently used ThinkPHP to develop a project. After the local development test is complete and uploaded to the server, the first time I open the project normally, and then refresh the page, the following error occurs: "Page debugging error, unable to open the page, please try again.

I'm so depressed. It's okay to set define ('app _ debug', false) locally. How can I put it on the server and there is an error?

Baidu, Google still did not find a solution, and suddenly found that the project APP_Name/Runtime/Cache directory and APP_Name/Runtime/Logs directory do not have the write permission, decisive change, F5, alas okay, mom no longer needs to worry about error messages!

Case 2:

ThinkPHP sets the APP_DEBUG constant to false, and the following problems occur:

The Code is as follows:

Parse error: syntax error, unexpected T_STRING in E: \ PHPnow \ htdocs \ ojbak \ Runtime \~ App. php on line 1

Or directly report "server error". What should I do?

This is related to PHP. modify the configuration in php. ini.

The Code is as follows:

Short_open_tag = On

Because the build method in app. class. php is as follows:

After the debug mode is enabled, the content of the relevant file will be obtained and then combined into a file. This will be automatically added.

That's what you see ~ App. php file

However, if you do not enable the debugging mode, the relevant files will be loaded every time. In this way, your errors will be exposed.

Case 3:

When APP_DEBUG is set to false in thinkphp, Data Query (select, find, etc.) always displays the first one .. However, after you set APP_DEBUG to true, it will be normal .. Why? Is there any solution?

Normally, APP_DEBUG is the debugging mode. Put it in the online environment and set it to false whenever possible ..

Find a select query by yourself. When debug is disabled, debug the SQL statement generated after the query by writing files.

The above is all the content of this article. I hope you will like it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.