Laravel 500 server error ubuntu

I have installed Laravel many times on Windows OS but never had this problem. However, on Ubuntu 14.04 I am getting a 500 Internal Server Error, and messages like this in my logs: [Wed Jul 22 10:2...

I have installed Laravel many times on Windows OS but never had this problem.

However, on Ubuntu 14.04 I am getting a 500 Internal Server Error, and messages like this in my logs:

[Wed Jul 22 10:20:19.569063 2015] [:error] [pid 1376] [client 127.0.0.1:52636] PHP Fatal error: require(): Failed opening required ‘/var/www/html/laravel_blog/../bootstrap/autoload.php’ (include_path=’.:/usr/share/php:/usr/share/pear’) in /var/www/html/laravel_blog/index.php on line 22

Previously I’ve had problems when mod_rewrite was not installed or set up properly, but I have installed it and it is not working. Changed .htaccess as well from original to this.

    +FollowSymLinks
RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]

I’ve given access to all my folders and files inside i.e.

/var/www/html/laravel_project

I have all the necessary extensions needed for Laravel 5+ as well. Is there something left that I didn’t do?

IMSoP's user avatar

IMSoP

85k13 gold badges111 silver badges164 bronze badges

asked Jul 21, 2015 at 15:18

DpEN's user avatar

9

Finally Overcame the problem

  • It was not the .htaccess file that was the problem nor the index.php. The problem was on accessing the files and requiring permissions.

For solving the problem i ran the following commands through terminal.

sudo chmod -R 755 laravel_blog

and then type below to allow laravel to write file to storage folder

chmod -R o+w laravel_blog/storage

This two commands solved the problem.

C.Liddell's user avatar

C.Liddell

1,08410 silver badges19 bronze badges

answered Jul 22, 2015 at 11:06

DpEN's user avatar

DpENDpEN

4,1363 gold badges17 silver badges25 bronze badges

12

Create the .env file and also run :

php artisan key:generate

This worked for me after pulling a git project.

After creating .env file and generating the key, run the code below:

php artisan cache:clear 
php artisan config:clear

tchap's user avatar

tchap

3,4123 gold badges28 silver badges46 bronze badges

answered May 3, 2017 at 14:23

Goodlife's user avatar

GoodlifeGoodlife

3,7222 gold badges23 silver badges23 bronze badges

5

Try to check if you have .env file.

Mostly this thing can cause something like that. Try to create a file then copy everything from .env.example, paste it to your created file and name it .env. or jsut simply rename the .env.example file to .env and run php artisan key:generate

Unheilig's user avatar

Unheilig

16.1k193 gold badges67 silver badges96 bronze badges

answered Sep 27, 2018 at 5:40

Lesther's user avatar

LestherLesther

4615 silver badges5 bronze badges

2

After installing run below command

sudo chmod 755 -R laravel
chmod -R o+w laravel/storage

here «laravel» is the name of directory where laravel installed

answered Mar 8, 2016 at 5:58

Sujendra Kumar's user avatar

2

Make sure a .env file, containing an APP_KEY, exists in root.

What should be in the .env hasn’t been explicitly stated in other solutions, and thought I’d boil it down to the sentence above.

This fixed my 500 error on a fresh install of Laravel.

Steps:

  1. Create a .env file in root (e.g. touch .env)
  2. Make sure it contains at least one line: APP_KEY=
  3. Generate an app key in terminal: php artisan key:generate

More .env paramaters:

As a reference, here’s the official .env with useful baseline parameters. Copy-paste what you need:

https://github.com/laravel/laravel/blob/master/.env.example

Notes:

  • My particular installation didn’t include any .env whatsoever (example or otherwise)

  • Simply having a blank .env does not work.

  • A .env containing parameters, but no APP_KEY parameter, does not work.

Bug?: When generating an app key in terminal, it seems to falsely report success, however no key will actually get placed in the .env if the file is missing a line starting with APP_KEY=.

answered Apr 10, 2020 at 16:06

MarsAndBack's user avatar

MarsAndBackMarsAndBack

8,7863 gold badges31 silver badges54 bronze badges

I fixed with this Command:

   rm -rf app/storage/logs/laravel.logs
   chmod -R 777 app/storage,
   php artisan cache:clear,
   php artisan dump-autoload OR composer dump-autoload

Than restart a server eather XAMPP ore another one and that should be working.

Khushal's user avatar

Khushal

2373 silver badges19 bronze badges

answered Feb 8, 2017 at 20:03

Atdhe Kurteshi's user avatar

1

I have faced a similar error. I checked the log in /var/log/apache2/error.log and found an UnexpectedValueException

I changed the owner to my apache user of the storage folder under the project dir.

sudo chown -R www-data:www-data ./storage

In my case apache2 process owner is www-data, so change this to yours, this can be found in apache2 config file. Hope this is useful to you.

Naman's user avatar

Naman

25.4k26 gold badges213 silver badges346 bronze badges

answered Jun 1, 2016 at 7:07

Snriud's user avatar

SnriudSnriud

1432 silver badges7 bronze badges

0

May another solution to this problem:

Install the required packages by running the composer command from the the root of the project:

sudo composer install

UPDATE:

  • You should not run this command on a production server, but some issues with composer can be resolved with this on local envs.

EDIT:

  • take a look at https://getcomposer.org/doc/faqs/how-to-install-untrusted-packages-safely.md to see why running composer install as root is not a good idea
  • If you need to run it as root, provide the following flags, to block third-party code from executing durin the install —no-plugins —no-scripts

LeonTheProfessional's user avatar

answered Nov 23, 2015 at 18:58

Christos Papoulas's user avatar

3

Create .env file with the below cmd command:

cp .env-example .env

Then generate a key for your project:

php artisan key:generate

After that clear your caches using the below commands:

//---Delete Configuration Cahce
php artisan config:cache
//---Clear Application Cache
php artisan cache:clear

answered Jul 5, 2021 at 3:39

Hedayatullah Sarwary's user avatar

run these commands

1. composer install 
2. mv .env.example .env 
3. php artisan cache:clear 
4. composer dump-autoload 
5. php artisan key:generate

I had this problem …

answered Feb 5, 2022 at 11:58

Saeid's user avatar

SaeidSaeid

3182 silver badges8 bronze badges

I read all the comments and suggestions. 500 — HTTP ERROR CODE represents internal server error.

Reasons for this error:

  • These mainly cause due to permission issues
  • Environment variables not found or .env file not found on your root directory
  • PHP extensions problem
  • Database problem

Fix:

  • Set the correct permissions:
  • Run these commands (Ubuntu/Debian)
find /path/to/your/root/dir/ -type f -exec chmod 644 {} ;
find /path/to/your/root/dir/ -type d -exec chmod 755 {} ;

chown -R www-data:www-data /path/to/your/root/dir/

chgrp -R www-data storage bootstrap/cache
chmod -R ug+rwx storage bootstrap/cache
  • If .env file doesn’t exist, create one by touch .env and paste your environment variables and then run
   php artisan key:generate
   php artisan cache:clear
   php artisan config:clear
   composer dump-autoload
  • Check your php.ini file and uncomment the extensions you need (In some case you have to install the extension by running this command apt-get install php7.2-[extension-name]
  • Check your database credentials and values in .env file. And grant permissions to the database user for that database.

These are some common problem you likely going to face when deploying your laravel app and once you start getting all these commands, I suggest you to make a script which will save your time.

answered Jun 30, 2019 at 7:11

Smit Patel's user avatar

Smit PatelSmit Patel

1,63817 silver badges21 bronze badges

I had PHP 7.0 and PHP 7.1 installed and I was using PHP 7.1 on command line and PHP 7.0 was enabled on Apache, that messy can bring problems when you are using Laravel Framework and localhost Apache2 with laravel.

Check your composer file first to see your PHP version.

"php": "^7.1.3",
"laravel/framework": "5.6.*",

Check your currently php version on command line

php -v

Check your currently php version enabled on Apache, I did using browser.

http://localhost

If it’s not the same disable the current version and enable the newest one.

sudo a2dismod php7.2

sudo a2enmod php7.1

sudo service apache2 restart

After that change folder permissions

sudo chmod 755 -R blog

for storage folder

chmod -R o+w blog/storage

answered Aug 31, 2018 at 20:58

Saulo Campos's user avatar

0

A frequent issue when using git:

Laravel's .gitignore ignores the .env file which when missing generates this error

Solved this by manually adding an .env file on the server or uploading it through FTP

answered Dec 31, 2018 at 17:05

Maroun Melhem's user avatar

Maroun MelhemMaroun Melhem

2,7901 gold badge19 silver badges22 bronze badges

First, if there is not .env file in your Laravel repository. Copy the .env.example file using the following cmd command cp .env.example .env and open .env file and apply your configuration if needed.

Run these commands:

//---Generate Key in your project
php artisan key:generate
//---Flush the application cache
php artisan cache:clear
//---Remove the configuration cache file
php artisan config:cache
php artisan config:clear
//---Regenerates the list of all classes that need to be included in the project
composer dump-autoload
//---Restart your Server
php artisan serve

answered May 13, 2020 at 6:10

Hedayatullah Sarwary's user avatar

Sometimes there is problem with php version. We need to change php version from server. Just write down below string in .htaccess file:

AddHandler application/x-httpd-php5 .php

Alexander Farber's user avatar

answered Oct 5, 2016 at 9:24

Riyan Sheikh's user avatar

0

First allow all permissions for your project folder (let say it’s called laravel), for the storage subfolder and its logs subsubfolder and for the vendor subfolder (laravel/storage, laravel/storage/logs and laravel/vendor).

Then check if your have .env file — if not you can run:

$ mv .env.example .env

to rename your build-in .env.example to the needed .env.

Otherwise turn on the debug mode — open .env and set

APP_DEBUG=true

and open laravel/config/app.php and change

'debug' => env('APP_DEBUG', false), 

to

'debug' => env('APP_DEBUG', true),

so you can find out what is the reason for your error.

answered Nov 29, 2016 at 15:03

tsveti_iko's user avatar

tsveti_ikotsveti_iko

6,2383 gold badges44 silver badges37 bronze badges

2

Run these two commands in the directory where Laravel is installed:

sudo chmod 755 -R DIRECTORY_NAME
chmod -R o+w DIRECTORY_NAME/storage

Then clear the cache and dump the auto load:

php artisan cache:clear
composer dump-autoload

zx485's user avatar

zx485

27.9k28 gold badges54 silver badges59 bronze badges

answered Mar 13, 2017 at 16:23

Ayman's user avatar

AymanAyman

313 bronze badges

I have faced this problem many times. Try one of these steps it helped me a lot. Maybe it will also help you.

  1. First of all check your file permissions.
  2. To fix file permissions sudo chmod 755 -R your_project
  3. Then chmod -R o+w your_project/storage to write file to storage folder.
  4. php artisan cache:clear
    composer dump-autoload
  5. php artisan key:generate
  6. Then check server requirements as per the laravel requirement.
  7. Many times you got this error because of the php version. Try changing your php version in cpanel.
  8. Then configure your .htaccess file properly

answered Jan 13, 2019 at 13:00

Anand Mainali's user avatar

Anand MainaliAnand Mainali

9231 gold badge13 silver badges23 bronze badges

If you use vagrant, try this:

First remove config.php in current/vendor.

Run these command:

php artisan config:clear
php artisan clear-compiled
php artisan optimize

NOT RUN php artisan config:cache.

Hope this help.

answered Feb 10, 2020 at 9:32

Hanh Nguyen's user avatar

Hanh NguyenHanh Nguyen

1251 silver badge12 bronze badges

if its on a live server try this

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews -Indexes
</IfModule>
Options +FollowSymLinks
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]

then also make sure that the php version in your composer.json is the same as that of your server.

Check your php version in your terminal using php -v

answered May 13, 2019 at 20:26

The Billionaire Guy's user avatar

Check if your .env file is present or not in file structure.
if not, follow the procedures:

  1. run command cp .env.example .env from projects root directory.
  2. run command php artisan key:generate
  3. refresh the browser.

Thanks.

answered May 4, 2022 at 6:53

Mehraab Hossain's user avatar

0

Run these two commands on root of laravel

find * -type d -print0 | xargs -0 chmod 0755 # for directories

find . -type f -print0 | xargs -0 chmod 0644 # for files

answered Jun 7, 2016 at 17:43

Davinder Singh's user avatar

I have a similar issue with a share Host. I was having 500 error. I just fixed by checking the Laravel version and PHP version. The error was because Laravel 5.6 doesn’t run on PHP 7.0.x Once I know this I just reconfigure the project to Laravel 5.5 that is compatible with PHP 7.0.x now everything is right. Another reason I have issues sometimes is the FTP I get corrupted Files and have to upload the project more than once.
Hope this help in the future I don’t found so many information in this topic.

answered Feb 21, 2018 at 13:07

Josean Maya's user avatar

0

For those of you who like me still got errors after trying all the other answers :

Check the version of php apache uses, latest laravel only works with php7.1.
So you have to :

sudo a2dismod php[yourversion]
sudo a2enmod php7.1
sudo systemctl restart apache2

hope this helps

answered Apr 26, 2018 at 12:06

Ika's user avatar

Make sure, you’ve run composer update on your server instance.

answered Jan 2, 2020 at 7:22

Usama Munir's user avatar

Usama MunirUsama Munir

5899 silver badges11 bronze badges

I fixed this problem by this commands:

mv .env.example .env
php artisan cache:clear
composer dump-autoload
php artisan key:generate

then

php artisan serve

Dharman's user avatar

Dharman

29.3k21 gold badges80 silver badges131 bronze badges

answered Feb 24, 2021 at 19:55

Adam's user avatar

AdamAdam

3093 silver badges8 bronze badges

0

According to the logs :

[06-Feb-2016 22:38:48 Europe/Berlin] PHP Warning:  require(/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:38:48 Europe/Berlin] PHP Fatal error:  require(): Failed opening required '/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php7.0.0/lib/php') in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:43:37 Europe/Berlin] PHP Warning:  require(/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:43:37 Europe/Berlin] PHP Fatal error:  require(): Failed opening required '/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php7.0.0/lib/php') in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17

There are some failures opening files into the /vendor folder.

By installing and updating via composer, I was able to finally solve the issue.

sudo composer install
sudo composer update

answered Feb 6, 2016 at 23:46

tomsihap's user avatar

tomsihaptomsihap

1,69218 silver badges27 bronze badges

Make sure storage folder with write previlege (chmod o+w), work for me like a charm.

answered Sep 21, 2016 at 1:32

user3619249's user avatar

0

Because of no right to write the log’s directory.
chmod 755 storage -R

answered Nov 10, 2016 at 22:11

George Peter's user avatar

George PeterGeorge Peter

691 gold badge1 silver badge6 bronze badges

1

I faced this issue and fixed by upgrade my php version in apache up to 5.6.x

answered Jul 22, 2017 at 21:50

Mahmoud Niypoo's user avatar

Mahmoud NiypooMahmoud Niypoo

1,4883 gold badges23 silver badges39 bronze badges

  1. How do I fix 500 Internal Server Error in Ubuntu?
  2. How do I fix laravel 500 internal server error?
  3. How do I get 500 internal server error?
  4. How can I fix 500 error in php?
  5. When should you use internal server error?
  6. What type of error is 500?
  7. How do I fix this is currently unable to handle this request http error 500?
  8. What is laravel log?
  9. Can’t open PHP artisan serve?
  10. Why do I get server error?
  11. Why do I keep getting server error?
  12. How do I fix Apache 500 internal server error?

How do I fix 500 Internal Server Error in Ubuntu?

1 Answer

  1. Remove the file /etc/apache2/conf-available/fqdn.conf via sudo mv /etc/apache2/conf-available/fqdn.conf /etc/apache2/conf-available/fqdn.conf.bak. …
  2. Restart your server and check if the problem is solved sudo service apache2 restart.

How do I fix laravel 500 internal server error?

Below are common troubleshooting steps that can be taken to resolve a 500 Internal Server Error:

  1. Check the error logs.
  2. Check the . htaccess file.
  3. Check your PHP resources.
  4. Check CGI/Perl scripts.

How do I get 500 internal server error?

How to Fix the 500 Internal Server Error

  1. Reload the web page. …
  2. Clear your browser’s cache. …
  3. Delete your browser’s cookies. …
  4. Troubleshoot as a 504 Gateway Timeout error instead. …
  5. Contacting the website directly is another option. …
  6. Come back later.

How can I fix 500 error in php?

How to Resolve 500 Internal Server Error

  1. Step 1: Debugging the Issue. The first step is to make sense of the situation and try to make sense of the error. …
  2. Step 2: Check if the Admin Works. …
  3. Step 3: Revert Recent Changes. …
  4. Step 4: Audit Your Plugins/Extensions/Modules. …
  5. Step 5: Check File Permissions. …
  6. Step 6: Increase PHP Memory Limit. …
  7. Step 7: Debug .

When should you use internal server error?

The HyperText Transfer Protocol (HTTP) 500 Internal Server Error server error response code indicates that the server encountered an unexpected condition that prevented it from fulfilling the request. This error response is a generic «catch-all» response.

What type of error is 500?

The 500 Internal Server Error is a «server-side» error, meaning the problem is not with your PC or Internet connection but instead is a problem with the web site’s server.

How do I fix this is currently unable to handle this request http error 500?

How to Fix 500 Internal Server Error on Your WordPress Website?

  1. Method 1) Check the Error Log.
  2. Method 2) Checks for Corrupted . htaccess File.
  3. Method 3) Increase the Memory Limit.
  4. Using Constant.
  5. Creating a Blank File.
  6. Method 4) Deactivate all Plugins.
  7. Method 5) Deactivate the Active Theme.
  8. Method 6) Re-uploading Core Files.

What is laravel log?

The Laravel logging facilities provide a simple layer on top of the powerful Monolog library. By default, Laravel is configured to create daily log files for your application which are stored in the storage/logs directory. You may write information to the log like so: Log::info(‘This is some useful information.

Can’t open PHP artisan serve?

Laravel error could not open input file artisan

  • Wrong console location. This error mainly occurs when a user tries to open a Laravel project outside the project folder. …
  • Improper permissions of artisan. Sometimes the artisan may not be executable.

Why do I get server error?

A server error can be caused by any number of things from uploading the incorrect file to as bug in a piece of code. This error response is a generic «catch-all» response. The web server is telling you that something went wrong, but it’s not sure exactly what that is.

Why do I keep getting server error?

An internal server error is an error on the web server you’re trying to access. That server is misconfigured in some way that prevents it from responding properly to what you’re asking it to do. … 🙂 Something went so wrong on the server that it couldn’t even tell you what the problem was.

How do I fix Apache 500 internal server error?

Try to clear your browser cache. If the page that shows 500 error is cached, after the cache is cleared, the browser will request a new version of the page. Come back later. The webmaster may fix the server issue in the meantime.

22 ответа

Наконец-то преодолел проблему

  • Проблема была не в файле .htaccess, а в файле index.php. Проблема была в доступе к файлам и требовании разрешений.

Для решения проблемы я запустил следующие команды через терминал.

sudo chmod -R 755 laravel_blog

а затем введите ниже, чтобы Laravel записать файл в папку хранения

chmod -R o+w laravel_blog/storage

Эти две команды решили проблему.

DpEN
22 июль 2015, в 11:24

Поделиться

После установки прогона под командой

sudo chmod 755 -R laravel
chmod -R o+w laravel/storage

здесь «laravel» — это имя каталога, в котором установлена ​​laravel

Sujendra Kumar
08 март 2016, в 07:41

Поделиться

Я исправил с помощью этой команды:

   rm -rf app/storage/logs/laravel.logs
   chmod -R 777 app/storage,
   php artisan cache:clear,
   php artisan dump-autoload OR composer dump-autoload

Чем перезапустить сервер или XAMPP или другой, и это должно работать.

Atdhe Kurteshi
08 фев. 2017, в 21:55

Поделиться

Я столкнулся с подобной ошибкой. Я проверил журнал в /var/log/apache2/error.log и нашел UnexpectedValueException

Я изменил владельца на пользователя apache папки хранения в каталоге проекта.

sudo chown -R www-data:www-data ./storage

В моем случае владелец процесса apache2 www-data, поэтому измените его на ваш, это можно найти в файле конфигурации apache2. Надеюсь, это вам полезно.

Snriud
01 июнь 2016, в 08:21

Поделиться

Может другое решение этой проблемы:

Установите необходимые пакеты, выполнив команду composer из корня проекта:

sudo composer install

ОБНОВИТЬ:

  • Вы не должны запускать эту команду на производственном сервере, но некоторые проблемы с composer могут быть решены с помощью этого в локальных средах.

Christos Papoulas
23 нояб. 2015, в 19:01

Поделиться

Новичок, но это то, что я сделал, потому что у меня не было ключа

Создал файл .env, а также запустил

php artisan key:generate

Это сработало для меня после вытаскивания проекта git

Goodlife
03 май 2017, в 14:45

Поделиться

Попробуйте проверить, есть ли у вас файл .env.

В основном эта вещь может вызвать что-то подобное. Попробуйте создать файл, затем скопируйте все из .env.example, вставьте его в созданный файл и назовите его .env. или просто переименуйте файл .env.example в .env и выполните php artisan key:generate

Lesther Bualan
27 сен. 2018, в 06:37

Поделиться

Иногда возникает проблема с версией php. Нам нужно изменить версию php с сервера. Просто напишите ниже строку в файле .htaccess:

AddHandler application/x-httpd-php5 .php

Riyan Sheikh
05 окт. 2016, в 10:16

Поделиться

У меня были установлены PHP 7.0 и PHP 7.1, и я использовал PHP 7.1 в командной строке, а PHP 7.0 был включен в Apache, что может привести к проблемам при использовании Laravel Framework и localhost Apache2 с laravel.

Сначала проверьте ваш файл композитора, чтобы увидеть версию PHP.

"php": "^7.1.3",
"laravel/framework": "5.6.*",

Проверьте вашу текущую версию PHP в командной строке

php -v

Проверьте вашу текущую версию php на Apache, я сделал с помощью браузера.

http://localhost

Если это не то же самое, отключите текущую версию и включите самую новую.

sudo a2dismod php7.2

sudo a2enmod php7.1

sudo service apache2 restart

После этого измените права доступа к папке

sudo chmod 755 -R blog

для хранения папки

chmod -R o+w blog/storage

Saulo Campos
31 авг. 2018, в 22:42

Поделиться

Запустите эти две команды в каталоге, где установлен Laravel:

sudo chmod 755 -R DIRECTORY_NAME
chmod -R o+w DIRECTORY_NAME/storage

Затем очистите кеш и сбросьте автозагрузку:

php artisan cache:clear
composer dump-autoload

Ayman
13 март 2017, в 17:21

Поделиться

Я сталкивался с этой проблемой много раз. Попробуйте один из этих шагов, это мне очень помогло. Может быть, это также поможет вам.

  1. Прежде всего, проверьте ваши права доступа к файлу.
  2. Чтобы исправить права доступа к файлу sudo chmod 755 -R your_project
  3. Затем выполните команду chmod -R o + w your_project/storage, чтобы записать файл в папку хранилища.
  4. PHP кэш ремесленника: очистить
    композитор дамп-автозагрузка
  5. Ключ ремесленника php: генерировать
  6. Затем проверьте требования к серверу согласно требованию laravel.
  7. Много раз вы получили эту ошибку из-за версии php. Попробуйте изменить версию php в cpanel.
  8. Затем настройте файл .htaccess правильно

Anand Mainali
13 янв. 2019, в 14:56

Поделиться

Для тех из вас, кто любит меня, все еще есть ошибки после попытки ответить на все остальные вопросы:

Проверьте версию php apache, последняя версия laravel работает только с php7.1. Итак, вы должны:

sudo a2dismod php[yourversion]
sudo a2enmod php7.1
sudo systemctl restart apache2

надеюсь это поможет

Ika Tobihi
26 апр. 2018, в 13:58

Поделиться

У меня похожая проблема с хостом общего ресурса. У меня была ошибка 500 Я только что исправил, проверив версию Laravel и версию PHP. Ошибка была в том, что Laravel 5.6 не работает на PHP 7.0.x Когда я это узнал, я просто перенастроил проект на Laravel 5.5, который совместим с PHP 7.0.x, теперь все правильно. Другая причина, по которой у меня иногда возникают проблемы, — это то, что по FTP я получаю поврежденные файлы и вынужден загружать проект более одного раза. Надеюсь, что это поможет в будущем, я не нашел так много информации в этой теме.

Josean Maya
21 фев. 2018, в 14:17

Поделиться

Сначала разрешите все разрешения для вашей папки проекта (предположим, что это называется laravel), для подпапки хранилища и подкаталога журналов и для подпапки поставщика (laravel/storage, laravel/storage/logs и laravel/vendor).

Затем проверьте, есть ли у вас файл .env — если вы не можете запустить:

$ mv .env.example .env

чтобы переименовать ваш встроенный .env.example в необходимый .env.

В противном случае включите режим отладки — откройте .env и установите

APP_DEBUG=true

и откройте laravel/config/app.php и измените

'debug' => env('APP_DEBUG', false), 

к

'debug' => env('APP_DEBUG', true),

чтобы вы могли узнать, в чем причина вашей ошибки.

tsveti_iko
29 нояб. 2016, в 15:59

Поделиться

Помимо перечисленных выше причин, есть и другие причины, по которым laravel может дать 500 внутренних ошибок сервера. Включая отсутствующий или старый CSRF, синтаксическую ошибку, конфигурацию прошивки .htaccess и т.д. Здесь представлен весь список https://abbasharoon.me/how-to-fix-laravel-ajax-500-internal-server-error/

Meta Pakistani
02 нояб. 2016, в 13:43

Поделиться

Запустите эти две команды в корневом каталоге laravel

найти * -тип d -print0 | xargs -0 chmod 0755 # для каталогов

найти. -тип f -print0 | xargs -0 chmod 0644 # для файлов

Davinder Singh
07 июнь 2016, в 19:41

Поделиться

Частая проблема при использовании git:

Laravel .gitignore ignores the .env file which when missing generates this error

Решил это, вручную добавив файл .env на сервер или загрузив его через FTP

Maroun Melhem
31 дек. 2018, в 17:52

Поделиться

Измените разрешение веб-папки только с помощью этой команды:

sudo chmod 755 -R your_folder

Muhammad Shoaib
09 фев. 2018, в 14:22

Поделиться

Я столкнулся с этой проблемой и исправил обновление своей версии php в apache до 5.6.x

Mahmoud Niypoo
22 июль 2017, в 22:44

Поделиться

Из-за отсутствия права писать каталог журнала.
Хранилище chmod 755 -R

George Peter
10 нояб. 2016, в 22:21

Поделиться

Удостоверьтесь, что папка с напитком с предикатом записи (chmod o + w) работает для меня как шарм.

user3619249
21 сен. 2016, в 03:22

Поделиться

В соответствии с журналами:

[06-Feb-2016 22:38:48 Europe/Berlin] PHP Warning:  require(/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:38:48 Europe/Berlin] PHP Fatal error:  require(): Failed opening required '/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php7.0.0/lib/php') in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:43:37 Europe/Berlin] PHP Warning:  require(/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17
[06-Feb-2016 22:43:37 Europe/Berlin] PHP Fatal error:  require(): Failed opening required '/Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/../vendor/autoload.php' (include_path='.:/Applications/MAMP/bin/php/php7.0.0/lib/php') in /Users/tomsihap/Documents/Development/mamp/partie_1_exo/bootstrap/autoload.php on line 17

Есть некоторые отказы, открывающие файлы в папке /vendor.

Установив и обновив с помощью композитора, я смог наконец решить проблему.

sudo composer install
sudo composer update

tomsihap
07 фев. 2016, в 00:34

Поделиться

Ещё вопросы

  • 0Как написать фильтр в контроллере для конкретных значений
  • 0PHP находит экстент общей подстроки от начала
  • 0Как сделать вставку, если id не существует, и обновить, если существует?
  • 1Проблема перекрытия меток по оси Х Highstock
  • 0Поиск более одного столбца с использованием PHP для получения данных JSON
  • 1Загрузка приложения для Android на SD-карту
  • 1Функции Firebase — добавление нового значения к старому значению
  • 1GeckoFX — альтернатива для элемента управления WebBrowser «RaiseEvent» или «InvokeMember»
  • 0Пользовательские привязки Knockout и JQuery UI не распознают виджет при обновлении наблюдаемого массива
  • 1Изменить этот учебник для доступа к изображениям с SD-карты?
  • 0GMP неисправен алгоритм наивной простоты c ++
  • 1Импорт android.pim не может быть решен
  • 0Angular ng-повторить эту структуру JSON для обмена сообщениями между пользователями
  • 1Python pandas: добавление информации из словаря в строки во время циклического перебора данных
  • 1Низкоуровневый API Amazon S3 для загрузки больших файлов
  • 1Запустить запрос (создать процедуру) в .net (C #) [дублировать]
  • 1Как переименовать элемент SOAP, отвечающий в CXF?
  • 0Не знаю, какой плагин JQuery использовать
  • 1Причал отвечает ненужным перенаправлением
  • 0Компилятор Intel: что означает ошибка «неизвестный тип в IL-обходе»?
  • 1Ролевая авторизация в asp.net
  • 1вызов Android закончить по намерению
  • 0DatePicker UI-Boosttrap и ISO-формат
  • 0Сервер WAMP не позволяет загружать файлы (PHP application)
  • 0Перетащите таблицы
  • 0Как искать по отображаемым данным, а не по данным на основе использования Angular
  • 0Попытка пропустить повторяющиеся значения в Where for Laravel
  • 1Где разместить twitter4j.properties в проекте Android?
  • 0MySQL 5.7.20 — SELECT FOUND_ROWS () возвращает неверный результат
  • 0Создать функции из значений массива
  • 0MySQL выбрать строку, которая имеет общее значение в одном столбце, но максимальное значение другого
  • 1Как получить доступ к атрибутам xml, в имени которых содержится символ ‘:’?
  • 1phoneGap / разработка Titanium
  • 0Применение обработчика событий к переменной
  • 0bower.json и package.json интерполяция
  • 1Деинсталлировать пакеты невидимые в Android
  • 0MySQL объединяет 2 отдельных запроса в 1
  • 0Отправить не отвечает после вызова ajax + fadeIn ()
  • 1Определение типа кнопок передних навигационных клавиш
  • 0Перемещение объекта с использованием SFML
  • 0Zend-DB не выполняет замены связывания pdo
  • 1Как добавить API в код Visual Studio
  • 1Недопустимая синтаксическая ошибка в учебнике по scrapy при выполнении команды «scrapy crawl quotes»
  • 0Перегрузка перегруженного метода: есть ли упрощение?
  • 1Отправка задания на печать в Google Cloud Print из приложения App Engine
  • 1Я пытаюсь сделать графический интерфейс на Java
  • 1Python получает ключи JSON в качестве полного пути
  • 0Как использовать curl вместо fopen для отправки данных в URL
  • 0Ошибка синтаксического анализа внешних данных XML как HTML с JQuery
  • 1Python — невозможно загрузить файл в указанную папку в корзине AWS S3

  • June 6, 2017
  • Laravel

When you get an error 500 screen with a red bar at the top stating Whoops, looks like something went wrong. running your Laravel app you might spend a lot of time debugging your Nginx configuration like I did before. You will be looking at the wrong place. Here is what is up and how you can solve this.

Laravel Error

This error you are getting in the top bar besides the general error 500 warning in the access logs probably at /var/log/nginx/error.log  stating Whoops, looks like something went wrong followed by the ghost icon and word Exception is a Laravel error. The red bar and text is generated by Laravel , not Nginx!. So you should check the Laravel log to see what is up. And perhaps you have not turned on Laravel logging properly so you will then need to add:

APP_ENV=local

to the .env file. In my case the issue was that is was all empty as I was working on setting up a new deployment mechanism.

NB If if it was not for you and you did have this line then you simply need to check the log.

Laravel Logging

With error logging now finally working (if you did had an empty .env as me before) you will start logging in Laravel. You will be able to see this kind of error in storage/logs/laravel.log :

production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. in /var/www/domain.com/releases/1/vendor/laravel/framework/src/Illuminate/Encryption/Encrypter.php:43

followed by the full stack trace. This as you are also missing your Laravel key in the .env as well.

Generating Laravel Key

To fix this missing key issue do a:

php artisan key:generate

Then copy the output in the brackets, and put it in your .env file as:

APP_KEY=base64:keygoeshere

Clearing Laravel Cache

Then you need to clear the cache to load the new key / .env changes. To do this do a:

 php artisan config:clear

followed by a:

php artisan config:cache

Now you should be able to see the Laravel welcome page or whatever page you have set up to load as the main page for the domain.

Tagged in : Tagged in : error 500, laravel

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.

Related Articles

Понравилась статья? Поделить с друзьями:

Читайте также:

  • Land rover discovery 3 ошибка u2023 86
  • L200 ошибка u1109
  • L200 mitsubishi ошибка p0234
  • L2 l3 cache error was detected on the raid controller
  • Lancer x error 01

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии