Welcome Guest, Not a member yet? Register   Sign In
How do I enable CI error log
#1

[eluser]datactrl[/eluser]
I've got an error 500: server internal error. And tried to locate where caused the error form log file. But there is nothing in my log folder. How do I enable CI log file? Thank you in advance!
#2

[eluser]danmontgomery[/eluser]
Internal Server Error is an apache error, it happens before CI is ever looked at. You have a configuration error in your httpd.conf or .htaccess
#3

[eluser]datactrl[/eluser]
Thank you Research Assistant. I spent a while searching from internet about internal server error. Have done some fix on apache conf files. Such as enable rewirte_module, change <directory>. Unfortuntely, my problem is still there! I tried a every simple Class just echo a word and it works. Is that means CI stating initialing is ok? Have any idea about this problem? Please advise. Thank you!
#4

[eluser]datactrl[/eluser]
I found my controller stoped at
Code:
require(substr(APPPATH, 0, strrpos(APPPATH, '/', -2)) . '/inc/temp1_helper.inc');

And the path will "C:/cij/www/quals/application/inc/temp1_helper.inc". The folder of C:/cij/www/quals/application/inc is what I created for saving inc files. The same application works fine on Linux with CI 1.7.1 and PHP 5.2. Now after I post the application to WIndows 7 with CI 1.7.2 and PHP 5.3, it got the internal server error.
#5

[eluser]pickupman[/eluser]
[quote author="datactrl" date="1279092023"]
Code:
require(substr(APPPATH, 0, strrpos(APPPATH, '/', -2)) . '/inc/temp1_helper.inc');
[/quote]

Seems there should be a better traversing file system than this. APPPATH should be getting it done if you have it properly set in index.php. Also note that sometimes in windows you need to use \\ for folder structures.

Since you are on PHP 5.3, you could also get current folder with
Code:
dirname(__FILE__) .'../inc';

You should be able /inc to your folder from a controller.
#6

[eluser]WanWizard[/eluser]
In the category "stupid questions":

Why make it to difficult? Why not store this file in the helpers directory (where it should be), and simply use $this->load->helper()?

If you work cross-platform you have to be extremely careful with path manipulations like this. Paths on Windows use a backslash, not a forward slash. Sometimes, PHP converts them on the fly, sometimes not. And hardcoding a '/' is hardly ever a good idea.
If you insist, use the constant DIRECTORY_SEPARATOR instead of hardcoding the slash.
#7

[eluser]datactrl[/eluser]
Thank you everyone. I tried to change the inc file name. And it responded something like "file not found". So I know it's not path problem. Finally, I found I created a function called "date_diff()" in inc file which works fine with PHP 5.2. While with PHP 5.3 they create a new function exactly the same name with my date_diff(). Then that caused the internal server error. After change function name to days_diff(), I still got internal server error. Then I found ereg()is deprecated in PHP 5.3. After I change that, it works fine now. I just wonder why won't PHP point which statement made the trouble since I didn't change error_reporting() which CI's default is E_ALL. Or is there something I can set to make it to report exact error message in stead of just internal server error?

Thank you for the opinions provided. I will adjust my coding to fit the best. The reason I create inc folder is I try to collect all my private inc'c and some common controllers in one folder in order to take care easily. I have some controllers include a common controller at first and extends from it rather than CI controller. Of course, every common controller is extended from CI controller.
#8

[eluser]pickupman[/eluser]
Glad you got it all worked out. If you want to create common controller constructors, see the link in my signature for Base Controllers. This is exactly the kind of thing Phil has posted on his blog. I find it helpful, like shown in blog, to create a public controller, and a admin controller. Then you have place to cover all global code for each side of your site.




Theme © iAndrew 2016 - Forum software by © MyBB