My laravel site was working before, I recently upgraded to Apache 2.4 and PHP 5.5.7.
Now I'm getting a white blank screen when I go to laravel.mydomain.com, nothing in apache error logs, routes and etc. should be fine as it worked before.
.htaccess is loading as I get a 500 when I insert an invalid line to /var/sites/laravel/public/.htaccess.
Heres my .htaccess:
$ cat /var/sites/laravel/public/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Heres my virtual host directive:
DocumentRoot "/var/sites/laravel/public"
ServerName laravel.mydomain.com
<Directory "/var/sites/laravel/public">
AllowOverride All
allow from all
Options +Indexes
Require all granted
</Directory>
And apachectl -S
$ /usr/local/apache2/bin/apachectl -S
VirtualHost configuration:
*:* is a NameVirtualHost
default server mydomain.com (/usr/local/apache2/conf/extra/httpd-vhosts.conf:25)
port * namevhost mydomain.com (/usr/local/apache2/conf/extra/httpd-vhosts.conf:25)
port * namevhost laravel.mydomain.com (/usr/local/apache2/conf/extra/httpd- vhosts.conf:34)
ServerRoot: "/usr/local/apache2"
Main DocumentRoot: "/var/www"
Main ErrorLog: "/usr/local/apache2/logs/error_log"
Mutex rewrite-map: using_defaults
Mutex default: dir="/usr/local/apache2/logs/" mechanism=default
PidFile: "/usr/local/apache2/logs/httpd.pid"
Define: DUMP_VHOSTS
Define: DUMP_RUN_CFG
User: name="daemon" id=1 not_used
Group: name="daemon" id=1 not_used
This question is related to
php
apache
frameworks
laravel
laravel-4
This changes works for my localhost Ubuntu server 14.xx setting
# Apply all permission to the laravel 5.x site folders
$ sudo chmod -R 777 mysite
Also made changes on site-available httpd setting Apache2 settings
Add settings:
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
Strange for me, but in my case I had to clear the laravel's cache to solve the issue.
Reason can be Middleware
if you forget to put following code to the end of handle
function
return $next($request);
On normal cases errors should be logged Unless
Script can't write to log file
Or error occurred on higher level check app server logs like Appache || Nginx
Or it's resources limits Like PHP ini settings
memory_limit
max_input_time
max_execution_time
Or OS limit's and so on
When I was new to Linux.I usually found this error with my Laravel Project. White errors means error, It may have some permission issue or error.
You just have to follow two steps, and will work like champ :)
(1) Give the permission. Run these command from root directory of your project
(a) sudo chmod 777 -R storage
(b) sudo chmod bootstrap/cache
(2) If you cloned the project or pulled from github then run
composer install
(3) Configure your .env file properly, and your project will work.
In my case, restarting apache fixed the problem. for Ubuntu / Debian:
sudo service apache2 restart
Another thing that may cause the WSOD is missing the 'return' keyword, as in:
return View::make('yourview');
as opposed to
View::make('yourview');
Running this command solved it for me:
php artisan view:clear
I guess a blank error page was some how cached. Had to clear the caches.
The following steps solved blank white screen problem on my Laravel 5.
bootstrap/cache
and storage
directoriessudo chmod -R 777 bootstrap/cache storage
.env.example
to .env
php artisan key:generate
This will generate the encryption key and update the value of APP_KEY
in .env
file
This should solve the problem.
If the problem still exists, then update config/app.php
with the new key generated from the above artisan key generate command:
'key' => env('APP_KEY', 'SomeRandomString'),
to
'key' => env('APP_KEY', 'KEY_GENERATED_FROM_ABOVE_COMMAND'),
Facing the blank screen in Laravel 5.8. Every thing seems fine with both storage and bootstrap folder given 777 rights. On
php artisan cache:clear
It shows the problem it was the White spaces in App Name of .env file
I also faced same issue after doing composer update
I tried installing composer required monolog/monolog
too but didn't work.
Then I removed the /vendor directory and ran composer install
and worked as per normal.
basically it must have reverted my monolog and other stable packages version back to previous. so better not to composer update
what I noticed comparing both the /vendor folders and found those classes
files under /vendor/monolog/monolog/src/Handler
were missing after composer updated.
Other problem with the same behavior is use Laravel 3 with PHP 5.5.x. You have to change some laravel function's name "yield() because is a reserved word in php 5.5
Make sure that there are no typos in your .env file. This was the cause of a blank screen with me.
Nothing got logged to screen nor logfiles or nginx logs. Just a blank screen.
Sometimes in route.php you may have
Route::get('/{id}', 'Controller@show'..
written before
Route::get('/add', 'Controller@add'..
It can be empty method Controller::show()
when you begin to develop your controller from scratch. In this case you will get empty blank page when requesting /add
url. It happens because the request was handled by /{id}
route, and its method returns nothing.
Just try to place /add
route before /{id}
I was also getting same error when I start first time on laravel + Ubuntu 14.04 I just right click on bootstrap and storage folder >>> properties >>>permission>> Others Access >>> change it to "Create and delete files" Change permission for enclosed files
Thank you
In addition to Permission problems in storage and cache folder and php version issues, there could be another reasons to display blank page without any error message.
For example, I had a redeclare error message without any log and with blank white page. There was a conflict between my own helper function and a vendor function.
I suggest as a starting point, run artisan
commands. for example:
php artisan cache:clear
If there was a problem, it will prompted in terminal and you've got a Clue and you can google for the solution.
An update to fideloper's answer for Laravel 5 and its new file structure is:
$ sudo chmod -R o+w storage/
In my case , I have installed laravel
many times, and I am sure that the folder write permission has been correctly given.
Like most of the answers above :
sudo chmod 777 -R storage bootstrap
The mistake is that my nginx configuration comes from the official documentation.
I only modified the domain name after copying ,then I got a blank page.
I tried restarting nginx
and php-fpm
,but not work for me.
Finally, I added this line configuration to solve the problem.
location ~ \.php$ {
# same as documentation ...
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
I hope I can help others.
I have same issue. I already change chmod folder for Storage folder. fill database settings in .env, but didn't fix the problem. I used Laravel 5.5 and I used PHP 5.6, to fix it I went to (cpanel->PHP Selector) and I changed to PHP 7.1 And the issue is done.
It shows the problem it was the White spaces in App Name of .env file
in my case, the BLANK WHITE SCREEN issue was as simple as a typo or wrong character on the env file. I was implementing socialite, so when I was setting up the .env credentials for Google+ like this:
G+_CLIENT_ID = Your G+ Client ID
G+_CLIENT_SECRET = Your G+ Client secret
G+_REDIRECT = 'http://localhost:8000/callback/google'
But, the .env file can't use the '+' sign, so I have to make this correction:
GOOGLE_CLIENT_ID = Your G+ Client ID
GOOGLE_CLIENT_SECRET = Your G+ Client secret
GOOGLE_REDIRECT = 'http://localhost:8000/callback/google'
I hope this help you find a dumb error...
Blank screen also happens when your Laravel app tries to display too much information and PHP limits kick in (for example displaying tens of thousands of database records on a single page). The worst part is, you won't see any errors in the Laravel logs. You probably won't see any errors in the PHP FPM logs as well. You might find errors in your http server logs, for example nginx throws something like FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of XXX bytes exhausted
.
Short tip: add ->limit(1000)
where 1000
is your limit, on your query object.
I was struggling with a similar issue on a CentOS server. Using php artisan serv and accessing it through port 8000 on the local machine worked fine but could not get my remote machines to load a particular view. I could return strings fine, and some views were loading. Chased my tail on permissions for a while before I finally realized it was an SELinux issue. I just set it from enforce to permissive and it worked. Hope that helps someone else out there that may be encountering the same issue.
setenforce permissive
for anyone who get blank page even after making storage accessible for displaying errors put these two lines at first lines of public/index.php to see what is happening at least. for me this error was there :Class 'PDO' not found in /var/www/***/config/database.php on line 16
error_reporting(E_ALL);
ini_set('display_errors', 1);
I hit this problem when I tried to run a Laravel 5.8 app on my server, uploading from local development using Vagrant Homestead. After a while I figured out that the dev subdomain on the live server I was running was somehow set to PHP 5.6.
cPanel > MultiPHP Manager > Set to PHP 7.2
fixed this for me. Hope this might help someone.
I have some issues to setup it in a Vagrant machine. Whats really works for me was execute a:
chmod -R o+w app/storage/
from inside the Vagrant machine.
Reference: https://laracasts.com/lessons/vagrant-and-laravel
Got this from the Laravel forums, but if you recently upgraded Laravel versions AND PHP versions AND are running nginx, make sure you have changed your nginx configuration file to reflect the new PHP version. For instance:
In your nginx site config file (here: /etc/nginx/sites-available), change
fastcgi_pass unix:/var/run/php5-fpm.sock;
to
fastcgi_pass unix:/var/run/php/php5.6-fpm.sock;
Sometimes it's because laravel 5.1 require PHP >= 5.5.9. Update php will solve the problem.
Try this, in the public/index.php page
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set("display_errors", 1);
I have also one more option why blank page issue may occur. If you are on production mode and if you cached your config files by php artisan (config:cache), try to delete cache file executing:
php artisan config:clear
or delete it manualy (bootstrap/cache/config.php)
use this .htaccess to solve
Options +ExecCGI
addhandler x-httpd-php5-cgi .php
Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^ index.php [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
There might be a lot of reasons behind the blank screen without errors. I have faced this problem many times whenever I want to upload laravel project in shared hosting.
Reason: Incorrect PHP Version
In my case, issue was because of incorrect php version. I had php 7.1 version in local computer where as in shared hosting cpanel, there was php 5.6 version. Switching up the version from 5.6 to 7.1 worked for me.
You can change php version in cpanel from multiphp manager available in cpanel home page.
Source: Stackoverflow.com