Codeigniter white screen of death on models - php

If there is an error in my model codeigniter will just show a blank page. I have error reporting set to E_ALL and DB debugging turned on.
Is there any way I can get the errors to show up?

check the .htaccess file the root of your site:
# enable PHP error logging
php_flag log_errors on
php_value error_log /home/path/public_html/domain/PHP_errors.log
i can recommend downloading the uhoh error exception library for codeigniter (taken from kohana) it is very helpful:
https://github.com/dhrrgn/codeigniter-uhoh
you can also check php.ini:
error_reporting = E_ALL
display_errors = On

I remember getting no error reported if I didn't have the php_mysql module installed and configured for PHP. Maybe check check the output of the phpinfo function to see if the mysql module for PHP is installed.
Thats my best guess.

For linux users: ensure you set mysqli
$db['default']['dbdriver'] = 'mysqli';
in your database.php file

Related

Gocart codeigniter Installation issues

I have a problem with installing go cart on Linux live server cpanel
When i install go cart on Linux server the empty page occurred and nothing happens
Please can someone help me?
Turn on error reporting in php.ini.
In ubuntu php.ini is here: /etc/php5/apache2/php.ini
Try to search lines like this
; error_reporting
error_reporting = XXXXXXXXX
and replace to :
error_reporting = E_ALL & E_NOTICE & E_STRICT
See also http://pl1.php.net/function.error_reporting
#edit
You can also add following code to script:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
This might be because you don't have the php_intl extension enabled on your server, which gocart requires (from version 2.3 I believe). Without error reporting on, all you will get is a white screen.
If you have access to your php.ini file, make sure this line is uncommented;
extension=php_intl.dll
If you don't have access to the php.ini file, then you will need to ask your hosts if they can enable this for you.

Why isn't PHP displaying errors under IIS7?

I get a blank white page when running a script that I'm migrating from a Linux Apache server to IIS.
Following advice elsewhere on SO, I checked that the correct php.ini is being loaded. From phpinfo():
Loaded Configuration File C:\php\php.ini
In that php.ini file, I have the following:
error_reporting = E_ALL
display_errors = On
log_errors = On
error_log = "C:\Windows\Temp\php_errors.log"
For good measure, I have also added
ini_set( 'display_errors', 1 );
error_reporting(E_ALL);
in the script itself.
I'm getting no errors output to the screen, and the file C:\Windows\Temp\php_errors.log doesn't exist.
I'm obviously missing something; what is it? :)

Why does $some_array['an-undefined-key'] throw an error on Mac but not Wamp?

For some reason my Mac is displaying the error message "Undefined index: an-undefined-key" whereas on Windows with WAMP it gracefully ignores the exception.
Example of usage:
if ($some_array['an-undefined-key']) {
// ...
}
Is there a PHP configuration which changes this behaviour?
I realise that I can do the following, but I would rather use the above technique if possible:
if (isset($some_array['an-undefined-key']) && $some_array['an-undefined-key']) {
// ...
}
Yes, you need to adjust the error_reporting and display_errors settings which sounds like they are different between your two different environments.
Here are links
error_reporting
PHP ini_set - look at first example for display_errors
The difference between the PHP on your Mac using the installed repo and your WAMP server is the php.ini, try editing your script and append the following lines to the top:
ini_set('display_errors', '1');
error_reporting(E_ALL);
This should be on your scripts. If this is not the problem, then please comment back and I will change accordingly.
You should not add unnecessary line to your script as you will have to change them when you go live.
Edit you php.ini ( using the wampmanager menus so you get the correct file )
left click wampmanager -> PHP -> php.ini
Look for these parameters and change to these values
error_reporting = E_ALL
This one makes error show on the web page
display_errors = On
error_log = "c:/wamp/logs/php_error.log"
this one will make the errors log into the file specified by error_log even if they dont show on the screen
log_errors = On
WAMP comes with XDEBUG configured so you should now see big orange errors in the web page
Check the bottom of the php.ini file for this line. Numbers for versions may differ on your system
; XDEBUG Extension
zend_extension = "c:/wamp/bin/php/php5.X.Y/zend_ext/php_xdebug-2.2.0-5.3-vc9.dll"

PHP errors make page inaccessible

Every time I have an error within my code and try to run it, the page becomes inaccessible. This is clearly very frustrating as it's hard debugging code with no feedback.
Relevant information from cPanel:
Apache version 2.2.22
PHP version 5.3.14
MySQL version 5.1.68-cll
Architecture x86_64
Operating system linux
If more information is required then please ask, I'm sorry I cannot provide any more information but frankly I am stumped.
Thanks.
Enable error reporting to see what error PHP had, if it had one.
There are several places you can look, firstly try checking your Apache error log. In many cases this is located in /var/log/apache2/error.log . Another way to debug a page like this is to enable error logging.
The simplest way of doing this being adding these lines to your php file:
ini_set('display_errors',1);
error_reporting(E_ALL);
In addition to this, you can also clean up the errors formatting by adding:
ini_set('html_errors', 'On');
In addition to this method of enabling error reporting, you may also enable them from you configuration file by adding the following line:
error_reporting = E_ALL
You need to update your php.ini to display errors. There are a couple settings.
Search your php.ini for display_errors and error_reporting. The file is usually commented very well on the options for error reporting, but error_reporting = E_ALL is a typical setting. Sometimes people want to suppress notices and set error_reporting to E_ALL & ~E_NOTICE.
display_errors = On is the config to print the errors to the screen.
After changing your php.ini, Apache usually needs to be restarted. I'm not sure how much control you have over your server, so if you can't restart Apache but you have a php.ini available, your host probably has it configured so you don't need to restart.

Error logging with WAMP server in PHP

I have a WAMP 2.2 server running on a Windows 7 box and cannot get PHP error logging working at all.
The file is always blank even after I explicitly trigger USER_ERROR errors, or cause normal ERROR errors.
I'm including the error relevant sections of the php.ini file - hopefully you can find something:
error_reporting = E_ALL
error_log = "c:/wamp32/logs/php_error.log" ;(UNCOMMENTED BY ME)
log_errors = On
display_errors = On
The line ; log_errors is just a comment for the following block, for the purpose of showing you what the settings are in dev vs production. You uncommented four lines which aren't meant to control anything, and I'm surprised your Apache service doesn't have problems starting up because of it.
What you need to do is look for the line:
log_errors = Off
And change the value to On
That said, once you restart the Apache service, the settings should take effect. However, I was unable to get WampServer to properly log php errors despite these settings. Apache will not start up when I specify the error_log parameter.
For me it turned out to be a permissions error. I ended up giving EVERYONE full control of the error log file and it seemed to fix my issue. Best of luck.
Did you try adding these lines to your php file?
ini_set("display_errors", "1");
ini_set("log_errors", "1");
ini_set("error_log", "/wamp64/logs/php_error.log");

Categories