mohdajami
mohdajami

Reputation: 9680

Where is the errors console?

I'm new to PHP, started with Code Igniter and MAMP. I start the server from the MAMP application, and write PHP in the text editor.

When errors occur in the code, the page doesn't display anything! Is there anyway to see the errors on console? or PHP just doesn't show errors?

I'm used to Eclipses console when developing Java, is there anything similar?

Upvotes: 0

Views: 8192

Answers (3)

Tom Hallam
Tom Hallam

Reputation: 1950

The errors should be displayed, looks like a supression issue which the others have covered. Something to look into is the application/config/config.php file that contains run-time configuration for the CodeIgniter framework:

(starting line number 166:)

166 |    0 = Disables logging, Error logging TURNED OFF
167 |    1 = Error Messages (including PHP errors)
168 |    2 = Debug Messages
169 |    3 = Informational Messages
170 |    4 = All Messages
171 |
172 | For a live site you'll usually only enable Errors (1) to be logged otherwise
173 | your log files will fill up very fast.
174 |
175 */
176 $config['log_threshold'] = 4;

This throws all errors, even if they aren't displayed into the Codeigniter logs folder (refer to your documentation for the location of this in your installed version.)

Hope that helped!

Upvotes: 1

Your Common Sense
Your Common Sense

Reputation: 157864

There are many fancy ways, similar to your eclipse console, but only 2 that works everythere.

First of all you have to decide, where you want to see your errors - online or in the log file. Usually we set online for developers machine and log for the public server. Unix-way for log is often used - tail -f /path/error_log

To set bullet-proof settings use either php config or apache config. So, to display errors online,
set display_errors = on in the php.ini file (be sure you edit working one)
or set php_value display_errors = 1 in the httpd.conf/.htaccess

For the public server on the shared hosting I usually add these lines into .htaccess:

php_value display_errors = 0
php_value log_errors = 1
php_value error_log = "/path/to/log.file" #if I want to have it separate from webserver's error log

Reporting level always remain the same and set in the config php file with

 error_reporting(E_ALL);   

Upvotes: 0

Layke
Layke

Reputation: 53146

Error Reporting


In your code add :

 error_reporting(E_ALL);
 // I don't know if you need to wrap the 1 inside of double quotes.
 ini_set("display_startup_errors",1);
 ini_set("display_errors",1);

or you can do it from your php.ini file.

http://php.net/manual/en/errorfunc.configuration.php


I'm used to Eclipses console when developing Java, is there anything similar?

Yes, there is Zend Studio - Eclipse, and also PHP IDE by Eclipse.

ZS - http://www.zend.com/en/products/studio/

Eclipse - http://www.eclipse.org/downloads/

Upvotes: 4

Related Questions