I'm trying to create an app on Laravel 4 beta but I can't debug it because it doesn't show any error, display_errors is on, error_reporting is E_ALL and debug => true (config/app.php). When I try to do an error on public/index.php it shows a parse error, but when I do it on the router it just shows a blank page (White screen of death). How can I fix this?
Thank you
#Matanya - have you looked at your server logs to see WHAT the error 500 actually is? It could be any number of things
#Aladin - white screen of death (WSOD) can be diagnosed in three ways with Laravel 4.
Option 1: Go to your Laravel logs (app/storage/logs) and see if the error is contained in there.
Option 2: Go to you PHP server logs, and look for the PHP error that is causing the WSOD
Option 3: Good old debugging skills - add a die('hello') command at the start of your routes file - then keep moving it deeper and deeper into your application until you no longer see the 'hello' message. Using this you will be able to narrow down the line that is causing your WSOD and fix the problem.
I had a problem with the white screen after installing a new laravel instance. I couldn't find anything in the logs because (eventually I found out) that the reason for the white screen was that app/storage wasn't writable.
In order to get an error message on the screen I added the following to the public/index.php
try {
$app->run();
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
After that it was easy to solve the problem.
Go to
app/config/app.php
and
set 'debug' => true,
Following the good advice by #The Shift Exchange I looked at the error_log and indeed managed to solve to problem. it was simply a permissions issue:
Tue Feb 26 11:22:20 2013] [error] [client 127.0.0.1] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/Users/matanya/Sites/indgo/app/start/../storage/logs/log-apache2handler-2013-02-26.txt" could not be opened: failed to open stream: Permission denied' in /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:71\nStack trace:\n#0 /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(77): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php(37): Monolog\\Handler\\RotatingFileHandler->write(Array)\n#2 /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Logger.php(217): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Logger.php(281): Monolog\\Logger->addRecord(400, Object(ErrorException), Array)\n#4 [internal function]: Monolog\\Logger->addError(Object(ErrorException))\n#5 /Users/matanya/Sites/in in /Users/matanya/Sites/indgo/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 71
Once I used chmod to apply less stringent permissions, all went back to normal.
However, I'm not sure that it answers the OP's question, as he was getting a blank screen rather than a server error.
Inside config folder open app.php
Change
'debug' => false,
to
'debug' => true,
Further to #cw24's answer • as of Laravel 5.4 you would instead have the following amendment in public/index.php
try {
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
And in my case, I had forgotten to fire up MySQL.
Which, by the way, is usually mysql.server start in Terminal
In the Laravel root folder chmod the storage directory to 777
Maybe not on Laravel 4 this time, but on L5.2* I had similar issue:
I simply changed the ownership of the storage/logs directory to www-data with:
# chown -R www-data:www-data logs
PS: This is on Ubuntu 15 and with apache.
My logs directory now looks like:
drwxrwxr-x 2 www-data www-data 4096 jaan 23 09:39 logs/
https://github.com/loic-sharma/profiler this is good example for alternative to laravel3 debug bar.
Just go to your app/storage/logs there logs of error available. Go to filename of today's date time and you will find latest error in your application.
OR
Open app/config/app.php and change setting
'debug' => false,
To
'debug' => true,
OR
Go to .env file to your application and change the configuratuion
APP_LOG_LEVEL=debug
Related
I have recently installed laravel 5.7 on my machine but its giving me a 500 error but at tje same time i have anothe laravel 5.6 app which is working on the same server. What could be the problem. I am working on a windows machine
Did you see at your server logs to see what the error 500 actually is?
1) Go to your Laravel logs (app/storage/logs) and see if the error is contained in there.
2)Yo can just debugging add a die('hi') command at the start of your routes file and then find out where is the error
3) I added the following to the public/index.php on my cause it helped me
try {
$app->run();
} catch(\Exception $e) {
echo "<pre>";
echo $e;
echo "</pre>";
}
I am asking this question over here with the hope that it would be solved by somebody.I have a project in Codeigniter v3.1.3.In the assets/admin/uploads/photostory_img directory i have some image files which i am trying to delete using the 'unlink' method.My unlink code in the Controller is like :
unlink("assets/admin/uploads/photostory_img/".$ps_old_img);
However, i'm getting errors like:
A PHP Error was encountered
Severity: Warning
Message: unlink(assets/admin/uploads/photostory_img/): Permission denied
Filename: nautics/Pstory.php
Line Number: 293
Backtrace:
File: C:\wamp64\www\JSNCI\application\controllers\nautics\Pstory.php
Line: 293
Function: unlink
File: C:\wamp64\www\JSNCI\index.php
Line: 315
Function: require_once
I have searched all over the internet and SO also having similar question , but no success yet.Pleas help me.Its driving me crazy.
Seems you don't have anything in your $ps_old_image var so you are trying to delete directory with unlink. Check what's inside your variable.
Second problem may be your path. I use unlink in my projects and I delete files with something like:
unlink("./assets/admin/uploads/photostory_img/".$ps_old_img);
Of course it depends on your certain situation, where do you have your index.php.
I can't find solvation for this problem. Some products is OK, some return me 500 error (without timeout).
Debug mode gave me nothing interesting (identical errors on OK-pages and noOK-pages).
Logs are empty.
Magento 1.9.2.1.
500 is PHP error so please check view.phtml file find out error.
As advice: enable debug mode of your Magento system.
1)
In index.php uncomment this line:
#ini_set('display_errors', 1);
And add into your .htaccess
SetEnv MAGE_IS_DEVELOPER_MODE "true"
Then is a chance that you can see an errors
2)
In addition you can check your logs in /var/log folder
3) check your server logs. Error 500 usually logged in default server logs
500 is PHP error.
Check in template file, try to debug the php code (should in view.phtml file)
I got the same issue and i fixed it by debug in view.phtml file. The code calls a function in the module that i disabled.
Can someone help me?
On index.php/admin the following exception was thrown:
Fatal error: Call to a member function getBlockName() on a non-object in /home/ahorraen/public_html/app/code/core/Mage/Captcha/Block/Captcha.php on line 43
Delete var/cache and var/session
This works for me!
Clearing the cache works for me.
Just remove var/cache/All folders
Even after removing it may take few minutes to get refreshed.
Only cache/ and session/ don't work for me.
Set properly chmod write permissions of folders
var
var/cache
var/session
There are a few things that would cause this, such as incorrectly overwriting the admin/captcha/type field in a community or local module. However, this is most likely to be an issue with the cache as others suggested. Make sure that you clear all caches that you have, including Memcached, Redis and/or APC.
See my answer over here for more details: https://stackoverflow.com/a/25902858/1038564
Clearing the cache and session files did not do it for me, but I did find that the website ids were not set correctly for some reason in the core_website table. Once set correctly, all was fine.
Could be because of a module you recently disabled through XML. Was the case here:
/app/etc/modules
Or through the backend.
You can change to your magento directory and do the following in shell:
cd /yourdirectory/
find -type -f -mtime 1
Change 1 to 30 for last 30 days...
Yes. Those are the directories of the Magento installation.
I have a site that has been running fine for awhile. Ran an SVN update after making some changes in the development environment. Now the site keeps redirecting to the Installation Wizard (/downloader/) No matter what I do. Checked and double checked database settings - all seems good. Can anyone tell me what other problems could have this result? I just wish it would give me a freaking error so I could more easily troubleshoot the actual problem.
If you check the index.php file you will see the following...
$mageFilename = 'app/Mage.php';
$maintenanceFile = 'maintenance.flag';
if (!file_exists($mageFilename)) {
if (is_dir('downloader')) {
header("Location: downloader");
} else {
echo $mageFilename." was not found";
}
exit;
}
That is to say, if there is no app/Mage.php file and there is a downloader folder, it will redirect to it.
Check is your app/etc/local.xml file found and readable (644) by the webserver, this should solve the problem.
I deleted both the /var/cache and /var/session directories. It appears to have solved the problem.
wrong permissions may cause that. had this problem when updated magento core while under root, chown to www-data fixed the problem