Troubleshooting thinkphp off debug mode times wrong Problem summary

Source: Internet
Author: User
Tags parse error php error php framework vars

Troubleshooting thinkphp off debug mode times wrong Problem summary

Case one:

Recently developed a project with thinkphp, the local development test completed upload to the server, the first time to open the normal, and then refresh the page when the "page debugging error, cannot find the page, please retry" error.

Obviously local settings define (' App_debug ', false) run no problem, how to put on the server on the error?

Baidu,google still did not find the solution, suddenly found that the project App_name/runtime/cache directory and app_name/runtime/logs directory without writable permissions, decisive change!

Case TWO:

Thinkphp a problem similar to the following occurs when the App_debug constant is set to false:

Copy CodeThe 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 has something to do with PHP, to modify the configuration in php.ini.

Copy CodeThe code is as follows: Short_open_tag = On

Because the build method inside the app.class.php:
When debug mode is turned on, the contents of the relevant file are retrieved and then re-assembled into a file, which is automatically added.
That's the ~app.php file you saw.
However, when you do not turn on debug mode, the relevant files will be loaded every time, this way, your error will be exposed.

Case THREE:

After you set App_debug to False in thinkphp, the data query (select, find, and so on) always displays the first one: But after setting the App_debug to true, it's normal. Why is this? Do you have any solutions?

Normally, App_debug is the debug mode, put to the online environment, as far as possible to set to false:

Find a select query by yourself, and in the case of debug shutdown, debug the SQL generated after the query by writing the file.

The above mentioned is the whole content of this article, I hope you can like.

Load Address: http://www.jb51.net/article/64552.htm

ThinkPHP3.2.2 Debug Mode normal access, turn off debug mode, deployment occurs when the cache is deleted the first time Yes, the second start error.

The error I encountered was as follows:

ThinkPHP3.2.2 {Fast & simple OOP PHP Framework}-[WE CAN do IT JUST THINK]

See the Internet most people have met, but not very good solution, really very headache, no way to read the source code only. With the help of colleagues, it is enjoyable to turn to the source and see the framework execution process:

1. Start from the entry file: index.php There is this sentence (require './thinkphp/thinkphp.php ';), jump to thinkphp.php;

2.thinkphp.php inside the 96 lines: Think\think::start (); You can see, run this function inside go, jump to Think.class.php;

3.think.class.php because it is a deployment mode, it executes to the inside of the 42 rows of storage::load ($runtimefile); Go directly to thinkphp/library/storage.class.php;

4.storage.class.php; Source: Static public function connect ($type = ' File ', $options =array ()) {
$class = ' think\\storage\\driver\\ '. Ucwords ($type);
Self:: $handler = new $class ($options);
}

We saw that it went to fetch a file called "Flie", looked for it under the thinkphp/library/storage/file.class.php found it, opened it to see.

5.file.class.php there is a 3rd step in the Load method, in code 75 line. Public function Load ($_filename, $vars =null) {
if (!is_null ($vars))
Extract ($vars, extr_overwrite);
Include $_filename;
}

Finally locked, the error is occurring in this code.

6. The following results can be tested: (1).

Public function Load ($_filename, $vars =null) {
if (!is_null ($vars))
Extract ($vars, extr_overwrite);

Echo $_filename;
Die ();
Include $_filename;
}

The results are as follows:

(2) Delete the slow Runtime storage and re-test.

Public function Load ($_filename, $vars =null) {
if (!is_null ($vars))
Extract ($vars, extr_overwrite);

Include $_filename;

Echo $_filename;
Die ();
}

The results are as follows:

7. The 6th step results can be seen, the problem is in the include this file./application/runtime/common~runtime.php error. Why is it?

The file is as follows:

8. With the help of colleagues, finally know the reason, because I Common/common folder function.php introduced a user.function.php path has a problem.

If you use require_once ' user.function.php ' directly, so that in the deployment situation common~runtime.php will not be able to parse correctly, before debugging mode is not a problem.

Finally, we can add the correct path when importing the file: Change to require_once app_path. ' common/common/' user.function.php '; the problem is solved here.

The last point: Remember to close the debug mode, to delete the runtime folder, the test successfully passed.

Reprint Address: http://blog.csdn.net/u012728971/article/details/47152745

Troubleshooting thinkphp off debug mode times wrong Problem summary

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.