Laravel 빈 흰색 화면
내 laravel 사이트는 이전에 작동했지만 최근에 Apache 2.4 및 PHP 5.5.7로 업그레이드했습니다.
이제 laravel.mydomain.com으로 이동할 때 흰색 빈 화면이 나타납니다. 아파치 오류 로그, 경로 등의 내용은 이전처럼 정상이어야합니다.
.htaccess가 /var/sites/laravel/public/.htaccess에 잘못된 줄을 삽입 할 때 500을 받으면서로드됩니다.
내 .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]
내 가상 호스트 지시문은 다음과 같습니다.
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>
그리고 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
Apache
이 답변이 귀하의 상황을 설명하거나 도움 이 됩니까 ? Apache 2.4로 업그레이드하면 Apache 구성이 약간 변경됩니다.
라 라벨
Laravel의 로그 또는 Apache의 로그를 확인하고 있습니까?
Laravel 4.1로 업그레이드 한 이후로 애플리케이션이 로그 위치에 쓸 수 없을 때 흰색 화면 "오류"(WSOD)가 발생했습니다. 나는 항상 아파치 ( "www-data", "apache"또는 세계에서 쓸 수있는 그룹 중 하나에 쓸 수있는 앱 / 스토리지 디렉토리를 서버 설정에 따라)로 만들어서 해결했다.
웹 서버 사용자
Ubuntu / Debian 서버에서 PHP는 사용자 "www-data"로 실행될 수 있습니다. CentOS / RedHat / Fedora 서버에서 PHP는 사용자 "apache"로 실행될 수 있습니다.
PHP를 실행하는 사용자가 파일을 소유하고 있는지 확인하십시오.
# Debian/Ubuntu
$ sudo chown -R www-data /path/to/laravel/files
# CentOS/RedHat/Fedora
$ sudo chown -R apache /path/to/laravel/files
사용자 www-data 또는 apache로 실행하지 않을 수 있습니다. 호스팅 및 설정에 따라 다릅니다!
라 라벨 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+ (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
Laravel 5 및 새로운 파일 구조에 대한 fideloper의 답변에 대한 업데이트는 다음과 같습니다.
$ sudo chmod -R o+w storage/
public / index.php 페이지에서 시도해보십시오.
error_reporting(E_ALL);
ini_set('error_reporting', E_ALL);
ini_set("display_errors", 1);
다음 단계는 Laravel 5에서 빈 흰색 화면 문제를 해결했습니다.
- Laravel 루트 폴더로 이동하십시오.
bootstrap/cache
및storage
디렉토리에 대한 쓰기 권한 부여
sudo chmod -R 777 부트 스트랩 / 캐시 저장소
- 이름 바꾸기
.env.example
로.env
- Laravel 루트의 터미널 / 명령 프롬프트에서 다음 명령으로 애플리케이션 키를 생성합니다.
PHP 장인 키 : 생성
그러면 암호화 키가 생성 APP_KEY
되고 .env
파일 의 값이 업데이트 됩니다.
이렇게하면 문제가 해결됩니다.
문제가 계속 config/app.php
되면 위의 artisan key generate 명령에서 생성 된 새 키로 업데이트 하십시오.
'key' => env('APP_KEY', 'SomeRandomString'),
에
'key' => env('APP_KEY', 'KEY_GENERATED_FROM_ABOVE_COMMAND'),
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);
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.
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
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 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)
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
Another thing that may cause the WSOD is missing the 'return' keyword, as in:
return View::make('yourview');
as opposed to
View::make('yourview');
Sometimes it's because laravel 5.1 require PHP >= 5.5.9. Update php will solve the problem.
Strange for me, but in my case I had to clear the laravel's cache to solve the issue.
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
Reason can be Middleware
if you forget to put following code to the end of handle
function
return $next($request);
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
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;
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.
On normal cases errors should be logged Unless
Script can't write to log file
- check it's path
- permissions
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
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.
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.
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 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.
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>
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
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.
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...
In my case, restarting apache fixed the problem. for Ubuntu / Debian:
sudo service apache2 restart
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
참고URL : https://stackoverflow.com/questions/20678360/laravel-blank-white-screen
'developer tip' 카테고리의 다른 글
Windows 명령 프롬프트에서 .sh를 실행하는 방법은 무엇입니까? (0) | 2020.08.09 |
---|---|
응답 코드 200 또는 201 및 내용 인 POST로 요청을 작성하십시오. (0) | 2020.08.09 |
테이블보기 결과가 없으면 화면에 "결과 없음"표시 (0) | 2020.08.08 |
Postgres-치명적 : 데이터베이스 파일이 서버와 호환되지 않습니다. (0) | 2020.08.08 |
Swift에서 경과 시간 측정 (0) | 2020.08.08 |