Laravel blank white screen

My laravel site worked before, I recently upgraded to Apache 2.4 and PHP 5.5.7.

Now I get a white blank screen when I go to laravel.mydomain.com, nothing in apache error logs, routes, etc. It should be good, as it was before.

.htaccess loads when I get 500, when I insert an invalid line in /var/sites/laravel/public/.htaccess.

Here is 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] 

Here is 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 
+106
php frameworks apache laravel laravel-4
Dec 19 '13 at 9:54 on
source share
30 answers

Apache

Does this answer describe or help your situation? Upgrading to Apache 2.4 comes with some changes to the Apache configuration.

Laravel

Are you checking Laravel or Apache logs?

Since upgrading to Laravel 4.1, I have had “white screen” errors (WSODs) when the application could not write to the log location. I always solved this problem by making the app / storage directory writable using Apache (either for a group writable in "www-data", "apache" or for writing to any other world, it depends on your server settings .

Web server user

On Ubuntu / Debian servers, your PHP can run as the www-data user. On CentOS / RedHat / Fedora servers, your PHP can run as an apache user.

Make sure your files are owned by a user working with PHP:

 # Debian/Ubuntu $ sudo chown -R www-data /path/to/laravel/files # CentOS/RedHat/Fedora $ sudo chown -R apache /path/to/laravel/files 

Please note that you may not work as a www-data or apache user. It depends on your hosting and settings!

Laravel 4

 # Group Writable (Group, User Writable) $ sudo chmod -R gu+w app/storage # World-writable (Group, User, Other Writable) $ sudo chmod -R guo+w app/storage 

Laravel 5+ (including 6)

 # Group Writable (Group, User Writable) $ sudo chmod -R gu+w storage # World-writable (Group, User, Other Writable) $ sudo chmod -R guo+w storage ##### # The bootstrap/cache directory may need writing to also ## # Group Writable (Group, User Writable) $ sudo chmod -R gu+w bootstrap/cache # World-writable (Group, User, Other Writable) $ sudo chmod -R guo+w bootstrap/cache 
+218
Dec 19 '13 at 13:25
source share

Update for fideloper answer for Laravel 5 and its new file structure:

 $ sudo chmod -R o+w storage/ 
+63
Feb 07 '15 at 15:48
source share

Try this on the page public / index.php

 error_reporting(E_ALL); ini_set('error_reporting', E_ALL); ini_set("display_errors", 1); 
+23
Jun 15 '15 at 15:36
source share

The following steps solved the white screen issue on my Laravel 5.

  • Go to Laravel root folder
  • Specify write permissions in the bootstrap/cache and storage directories

sudo chmod -R 777 bootstrap / cache storage

  • Rename .env.example to .env
  • Generate the application key using the following command in the terminal / command line from the Laravel root:

php artisan key: generate

This will generate an encryption key and update the value of APP_KEY in the .env file

This should solve the problem.

If the problem still exists, update config/app.php new key generated using the wizard key generation command:

'key' => env('APP_KEY', 'SomeRandomString'),

to

'key' => env('APP_KEY', 'KEY_GENERATED_FROM_ABOVE_COMMAND'),

+23
Sep 08 '15 at 13:29
source share

for those who get a blank page even after the repository available to display errors puts these two lines in the first lines of public / index.php to see what is happening at least. for me this error was: the "PDO" class was not found in / var / www / *** / config / database.php on line 16

 error_reporting(E_ALL); ini_set('display_errors', 1); 
+8
Feb 04 '16 at 11:50
source share

When I was familiar with Linux. I usually found this error with my Laravel project. White errors indicate an error; it may have resolution problems or errors.

You just need to complete two steps and work as a champion :)

(1) Give permission. Run this command from the root directory of your project.

 (a) sudo chmod 777 -R storage (b) sudo chmod bootstrap/cache 

(2) If you cloned a project or pulled from github, run

 composer install 

(3) Configure the .env file correctly and your project will work.

+6
Jan 14 '16 at 18:17
source share

I was struggling with a similar problem on a CentOS server. Using the php artisan service and accessing it through port 8000 on the local computer worked fine, but I could not get my remote computers to load a specific view. I could return the rows in order, and some views were loading. For some time I chased my tail on permissions before I realized this was a SELinux problem. I just configured it to force execution, and it worked. Hope this helps someone else who might run into the same problem.

 setenforce permissive 
+5
Mar 24 '16 at 15:12
source share

In my case, I installed laravel many times, and I'm sure that permission to write to the folder was given correctly.

Like most of the answers above:

 sudo chmod 777 -R storage bootstrap 

The error is that my nginx configuration comes from the official documentation .

I changed the domain name only after copying ,, then I got a blank page. I tried restarting nginx and php-fpm , but it failed.

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.

+3
Aug 30 '18 at
source share

I also have another option that might cause a problem with a blank page. If you are running and caching your configuration files using php artisan (config: cache), try deleting the cache file by doing:

 php artisan config:clear 

or delete it manually (bootstrap / cache / config.php)

+3
Sep 04 '18 at 11:01
source share

I have some problems to configure it in a stroller car. It really works for me:

chmod -R o+w app/storage/

from Wagrant’s car.

Link: https://laracasts.com/lessons/vagrant-and-laravel

+1
Mar 21 '14 at 13:04
source share

Another thing that can cause WSOD is the lack of the "return" keyword, for example:

return View::make('yourview');

Unlike

View::make('yourview');

+1
Sep 07 '14 at 17:43
source share

Sometimes this is because laravel 5.1 requires PHP> = 5.5.9. Updating php will solve the problem.

+1
Jul 6 '15 at 4:01
source share

Strange for me, but in my case I had to clear the laravel cache to solve the problem.

+1
07 Oct '16 at 17:22
source share

I also encountered the same problem after composer update

I tried installing composer required monolog/monolog too, but did not work.

Then I deleted the / vendor directory and ran composer install and worked as usual.

basically it was supposed to bring back my monologue and other stable versions of packages back to the previous one. so it’s better not to composer update

what I noticed when comparing both folders / vendor and found that these classes files in /vendor/monolog/monolog/src/Handler missing after updating composer.

+1
Oct 09 '18 at 7:15
source share

Another problem with the same behavior is using Laravel 3 with PHP 5.5.x. You have to change the name of the laravel function "yield (), because it is a reserved word in php 5.5

0
Jan 09 '14 at 9:45
source share

The reason may be Middleware if you forget to put the following code at the end of the handle function

 return $next($request); 
0
Oct 24 '15 at 14:22
source share

I also had the same error when I started for the first time on laravel + Ubuntu 14.04 I just right-click on the download and storage folder →> Properties →> Permission → Other Access →> change it to “Create and Delete Files” Change permission for attached files

thank

0
Mar 06 '17 at 4:08 on
source share

Got this from the Laravel forums, but if you recently updated your Laravel and PHP versions and run nginx, make sure you change your nginx configuration file to reflect the new version of PHP. For example:

In your nginx site configuration 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;

0
Mar 24 '17 at 17:40
source share

I have the same problem. I already change the chmod folder to the Storage folder. Fill in the database settings in .env, but the problem has not been fixed. I used Laravel 5.5 and I used PHP 5.6 to fix this, I went (cpanel-> PHP Selector) and I switched to PHP 7.1 and the problem is resolved.

0
Jan 12 '18 at 5:29
source share

In normal cases, errors should be logged, unless

The script cannot write to the log file

  • check the way
  • permissions

Or an error occurred while checking higher level application server logs, such as Appache || Nginx

Or is it resource constraints How to configure PHP ini

 memory_limit max_input_time max_execution_time 

Or OS limit, etc.

0
Jan 25 '18 at 13:07
source share

In addition to problems with permissions in the storage and cache folder, as well as problems with the php version, there may be other reasons for displaying a blank page without any error messages.

For example, I had a redeclare error message without any log and with a blank white page. There was a conflict between my own auxiliary function and the seller function.

I suggest, as a starting point , run artisan commands. eg:

 php artisan cache:clear 

If a problem occurs, it will be requested in the terminal, and you will get a hint, and you can search for a solution on Google.

0
Jul 07 '18 at 19:43
source share

Running this command solved this for me:

 php artisan view:clear 

I think the blank error page was somehow cached. Had to clear the caches.

0
Aug 21 '18 at 0:58
source share

A blank screen also occurs when your Laravel application tries to display too much information and a PHP restriction is triggered (for example, displaying tens of thousands of database records on one page). The worst part is that you will not see any errors in the Laravel logs. You probably also won't see errors in the PHP FPM logs. You can find errors in the logs of your http server, for example, nginx produces something like FastCGI sent in stderr: "PHP message: PHP Fatal error: Allowed memory size of XXX bytes exhausted .

A quick tip: add ->limit(1000) where 1000 is your limit for your request object.

0
Aug 22 '18 at 21:04
source share

I ran into this problem when I tried to run the Laravel 5.8 application on my server, loading from local development using Vagrant Homestead. After a while, I found out that the dev subdomain on the live server I was working on was somehow installed on PHP 5.6.

cPanel> MultiPHP Manager> Install on PHP 7.2

fixed it for me. Hope this can help someone.

0
Apr 24 '19 at 17:24
source share

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> 
0
May 17 '19 at 12:02
source share

Facing a blank screen in Laravel 5.8. It seems that everything is fine with the repository and boot folder with 777 rights. On

 php artisan cache:clear 

This shows a problem, these were Spaces in the Appendix .env file name

0
saad May 21 '19 at 6:54
source share

There can be many reasons behind a blank screen without errors. I have encountered this problem many times when I want to upload a laravel project to shared hosting.

Reason: wrong version of PHP

In my case, the problem was due to the wrong php version. I had php 7.1 version on the local computer, where, like in cpanel on shared hosting, there was php 5.6 version. Switching the version from 5.6 to 7.1 worked for me.

You can change the php version in cpanel from the multiphp manager, available on the cpanel homepage.

0
Jun 08 '19 at 13:49
source share

in my case, the “BLACK WHITE SCREEN” problem was as simple as a typo or an incorrect character in the env file. I implemented socialite, so when I set 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 cannot use the “+” sign, so I have to make this fix:

 GOOGLE_CLIENT_ID = Your G+ Client ID GOOGLE_CLIENT_SECRET = Your G+ Client secret GOOGLE_REDIRECT = 'http://localhost:8000/callback/google' 

I hope this helps you find a stupid mistake ...

0
Jul 01 '19 at 12:15
source share

In my case, restarting apache fixed the problem. for Ubuntu / Debian:

 sudo service apache2 restart 
-2
Feb 08 '15 at 0:04
source share

This change works for my local Ubuntu Server 14.xx server

 # Apply all permission to the laravel 5.x site folders $ sudo chmod -R 777 mysite 

Changes have also been made to the httpd settings available for the Apache2 Settings site.

Add Settings:

 Options +Indexes +FollowSymLinks +MultiViews Require all granted 
-2
Jun 18 '15 at 1:53 on
source share



All Articles