Laravel 4 ERROR 500 After fresh install on LAMP - php

This is my first time behind Ubuntu: I followed this tutorial to install Apache, PHP, SQL and phpMyAdmin. http://www.howtoforge.com/ubuntu_lamp_for_newbies
I got no errors and everything is working smooth. I then downloaded composer.phar and laravel I ran php composer.phar install and php composer.phar update. No errors here either I then changed apache config to have DirectoryROot at var/www/public.
And enabled rewrite mod: sudo a2enmod rewrite
Standard installation procedure however visiting localhost gives 0 php error messages only shows: Whoops, looks like something went wrong.
Apache error logs show nothing, access log only shows the 500 error. What am I missing I went over the entire procedure 3 times.

I solved the problem.
1) Open Terminal
2) Navigate to your laravel root folder CD var/www
3) Execute sudo chmod -R 777 *
This solved the problem but be careful with this. Make sure your permissions are properly set when you move from local to live.

Related

Laravel 500 error no logs

First of all, according to stackoverflow, this problem occurs when something is wrong with permissions of bootstrap/cache and storage directories. And I tried literally every advice on that with no luck.
I was happy user of Xubuntu 16.04 at my old laptop, developed one project. Using docker-compose to set up development environment. Yesterday I bought brand new PC, installed Kubuntu 18.04, installed docker and everything I need to work.
Cloned repository, ran composer install, docker-compose up, then php artisan migrate and php artisan storage:link. But when I try to open website in browser, I get 500 error with empty body response.
APP_DEBUG is set to true.
6 hours later I'm here with literally zero results. Tried dozens of solutions found here and on forums (just example).
I even did a little experiment: removed project directory from my old laptop, cloned it from scratch, installed everything required and it worked. Without any permission problem.
And what kills me more: there are no logs inside docker containers, no logs inside laravel directory, just nothing.
Please help! What's wrong? Maybe it's Kubuntu? Maybe it's 18.04? Maybe it's newer docker version?
P.S. Right now bootstrap/cache and storage directories are owned by alex:alex and has 775 permissions. Exactly same as at my laptop.
Add a dd($exception->getMessage()); to the exception handler class right before line 37. Run the request and check the response.
If that doesn't avail anything, verify the request is hitting the webserver by checking access and error logs. Check system logs also using dmesg and similar.
Since you mention Docker, if you're using nginx, be sure your site configuration is not being overwritten when running docker-compose up.
Looks like error is probably either related with storage permissions that should be 777, or with ownershp, or with app's bootstrap, before it even runs your files, when it pulls out configuration setup.
Check the .env configuration, and config files in config directory for any errors.
For storage switch to 777 permissions
chmod -R 777 storage
For configuration issues, try first with
php artisan config:clear
From the console.
If you are on linux server it may be selinux permissions.
Try setting selinux as passive:
in terminal type:
setenforce 0
then see if you see errors. If it works as should you want to turn selinux back on:
setenforce 1
Then give directory writable with selinux command:
chcon -R -t httpd_sys_rw_content_t /path

"localhost" always shows "welcome to Nginx" Ubuntu?

I am running Ubuntu 16. I am fairly new to web design but I have set up a LAMP server on my Ubuntu machine and installed WordPress site. I wanted to try to mess around with PHP so I tried to install myphp.
I managed to do this and I realized that I had to install nginx also.
I did this, but my local host always diverts to a message "welcome to Nginx"
I tried to edit the configuration files but could not get it to work?
Is there a guide for installing Nginx and myphp to see phpMyAdmin, after you have already set up a WordPress site?
Like I said I am running Ubuntu 16.04.
You may need to delete the index.html file from the web root. The index.php file should remain.
On Ubuntu+nginx go to html directory using following command
cd /var/www/html/
then find out following index.nginx-debian.html and delete it or edit it as you want
To edit these file open into you editor or use Ubuntu default editor nano.
sudo nano /var/www/html/index.nginx-debian.html
To delete these file run following command.
sudo rm -rf /var/www/html/index.nginx-debian.html
these is the defautl nginx welcome page that why it appear after install, for more information check nginx default configuration file using following command.
sudo nano /etc/nginx/sites-available/default
Thanks

Laravel project not working after successfully installation on the server

I have successfully installed Laravel project on the server but its not working. I am getting error like "page isn’t working
HTTP ERROR 500".
I have execute command
composer create-project --prefer-dist laravel/laravel
and created a directory name Laravel. But it's not working while same thing I have done on my local server and it's working fine.
in local you serve laravel project by internal web server using below command:
php artisan serve
but in your server env you must use apache conf and you must set document root like this:
your_project_directory/public/index.php
if every thing ok till now, your error must made by laravel error handling.
if so, then you can check your laravel log to find out exactly 500 error reason:
go to your project directory, then navigate to storage directory, here is logs directory and it has a laravel.log
tail -f your_project_directory/storage/logs/laravel.log
your generated log are here so read and solve it :)
tips: you must set privilages to your storage directory in server.
I run composer update and it resolve the problem. Known I run the following command from the root path of the application:
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 755 -R 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.
Please insert below command and try to access.
setenforce 0
it's working for me.

Laravel Project not working in XAMPP htdocs folder.What could be the reason of this?

Error States:
The localhost page isn’t working
localhost is currently unable to handle this request.
HTTP ERROR 500
my project is in htdocs>laravel>project1>public>index.php
any more details like installation etc?
how did you install the laravel project by php artisan command or by composer or by zip package? and why you want to run your laravel project with the xammp file structure.. you can simply write the "php artisan serve" in your command line.. also make sure the .env variables set properly.. also try to clear all cache browser and run following query and try again
php artisan cache:clear
you need to know that the default port of laravel project is localhost:8000
When you meet 500 error, it's usually permissions related problem. Set write permissions on a storage directory. For Linux:
sudo chmod -R 775 storage
If it didn't help, look into Laravel error log.

php include path doesnt work

My server uses Ubuntu with PHP5 and NginX.
I have installed pear using sudo apt-get install php-pear, and later uninstalled it using sudo pear uninstall pear. Today I downloaded phpmailer using sudo apt-get install libphp-phpmailer.
I wrote code to send email with phpmailer. It begins with:
require_once("class.phpmailer.php");
and I edit the php.ini both in /etc/php5/cli and in /etc/php5/fpm to set:
include_path = ".:/usr/share/php/libphp-phpmailer"
It did work well if I execute this php program in command line, but if I visit this php page through my browser, it produce a HTML500 error, and I checked the error.log file, which shows:
PHP message: PHP Fatal error: require_once():
Failed opening required 'class.phpmailer.php'
(include_path='.:/usr/share/php:/usr/share/pear') in ...
I wander how comes this path? I am sure I have edited the include_path in both php.ini files. Is there another configuration file I missed? Where does the string ".:/usr/share/php:/usr/share/pear" come from?
If you are absolutely sure all paths are correct then it could be a file permission issue.
Find out what user Nginx runs under. It will probably be nginx. Run groups nginx and the output should be nginx : nginx, meaning the user nginx exists, and has only one group, which is also nginx.
On the command line navigate to the location of class.phpmailer.php and run ls -l to view the permissions of the files in that directory. Example output would be: -rw-r--r-- 1 someuser somegroup, meaning read and write access is granted to the owner (someuser), read access for the group (somegroup), and read access to everybody else.
The user nginx (if that is what it is running under) needs to have read access to that file. So change the owner/permissions as necessary.
If you need further explanation of how to do any of this just give me a shout and I will update this with further instructions.

Categories