I have followed through the phpacademy digital ocean tutorial in order to try and get my laravel site set up. After following through the steps there was a difference between my setup and theirs. My default index.html page was located at /var/www/html instead of /var/www
I removed the index.html page and uploaded my laravel app. I am not using any DB connections (just using static content). I developed my site locally with vagrant and homestead.
After uploading the app and going to the IP address I get the Laravel app directory listing. When I went into public I got a message saying mcrypt was require/not installed. I installed it with sudo php5enmod mcrypt and restarted the server.
Again I reloaded the page and I get the following message (after turning debugging to true) "Error in exception handler: The stream or file
"/var/www/html/app/storage/logs/laravel.log" could not be opened:
failed to open stream: Permission denied in
/var/www/html/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:84"
How do I fix this and can i remove the /public and just use straight IP / domain (once i get that far)
Error message indicates it can't open your log file there. Assuming you're using this tutorial (https://www.digitalocean.com/community/tutorials/how-to-install-laravel-with-nginx-on-an-ubuntu-12-04-lts-vps), take a look at the subsection "Fixing Permissions", you'll need to chmod your storage directory.
chmod -R 775 /var/www/laravel/app/storage
Start artisan with sudo. This will give artisan all the permissions it needs and won't make any security troubles as well.
so instead starting artisan serve with:
$ php artisan serve
try using:
$ sudo php artisan serve
thus you wont have to make any permission changes
Related
enter image description herei'm using centos to host my laravel application,
when i upload the project first time using git, it will be cached, and when i change any file, changes doesn't apply, i tried all artisan commands that clear cache in laravel but didn't fix
the only way is to change the root directory of the application after each single change, is centos caching or nginx or laravel or other software in the server or the browser? even i cleared every thing in public/index.php and put echo 'foo'; and still got old cached data
screenshot of my nginx config file
screenshot of my nginx config file
This is possibly directory permission issue you need to grant storage and bootstrap directory 777 permission level. You need to run the following command on the root folder of your app
chmod -R 777 storage
and
chmod -R 777 bootstrap
Then try to effect your changes.
i tried systemctl restart php-fpm now every thing worked as expected and all changes applied thank you a lot i appreciate your help
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.
I have updated the PHP version to 5.6.3 and create a project using laravel 5.3.0 . Now i want to run my project without php artisan serve. When i hit localhost , the index page is opened. But when i click one my project name it shows following error.
****The localhost page isn’t working****
Note that i have tried following method to get rid of this issue.
1. copy .htaccess file from public directory to project folder
2. rename the server.php to index.php
But it is not working. Any ideas in this regard?
If you using LAMP and you want to run Laravel project without Artisan, you have to navigate from browser to /laravel/public directory. Follow laravel documentation https://laravel.com/docs/4.2/quick
But if you getting errors like 500 and your page don't work, possibly you have to change permissions of your Laravel project directory.
Try sudo chmod -R 770 /path/to/your/laravel/project
or sudo chmod -R 775 /path/to/your/laravel/project
for more refer with this https://help.ubuntu.com/community/FilePermissions
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.
I trying to learn laravel and I am attempting to set it up on my server.
I have meticulously followed all the instructions in this tutorial while changing some variables based on the names of my own directories:
http://davidmyers.name/post/laravel-on-digital-ocean
The 500 error only is thrown when I visit the laravel project's public folder. When I attempt to visit any other page such as PHPMyAdmin or any other PHP or HTML page, the page pulls up just fine.
Is there anything I could be missing that is not included in the tutorial that I referenced? I double checked that I am following all the steps correctly.
Also, running composer update in the directory throws this error:
[RuntimeException]
Error Output: PHP Warning: require(/var/www/html/testproj/bootstrap/../vendor/autoload.php): failed to open stream: No
such file or directory in /var/www/html/testproj/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/var/www/html/testproj/bootstrap/../vendor/autoload.php' (include
_path='.:/usr/share/php:/usr/share/pear') in /var/www/html/testproj/bootstrap/autoload.php on line 17
I found this related stackoverflow article:
Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
but the solution did not work for me, since my phpinfo() shows that OpenSSL is enabled.
The problem is that the server does not have access to those locations.
Run the following commands
sudo chmod 755 -R "your project name"
and then
chmod -R o+w "your project name" /storage
if it still doesn't work try running:
sudo chmod 775-R "your project name"
sudo chmod 775-R "your project name"/storage
or
sudo chmod 777-R "your project name"
sudo chmod 777-R "your project name"/storage
Have you run composer install ? This should automatically run php artisan optimize after install, which I believe is the command to create the file in question.
You must install dependencies by composer using:
composer install
and then give right permission to storage directory:
chmod 777 -R storage
or
sudo chmod 777 -R storage
It turns out that I was doing everything right, but when I went to run composer install I didn't see that it was throwing an installation error due to my server not having enough memory. Increasing my server's memory fixed the problem.
There are 2 things to consider,
1. Web server throwing 500 error (as if text and font were from Chrome) or
2. The application is showing 500 error (with beautiful image and text)
Case 1: you probably need to install composer
sudo composer install
Case 2: Check appropriate permission on storage/ (as suggested on other answers) and check if you have .env file. if not copy .env.example and rename to .env and you also need to generate application key.
sudo php artisan key:generate
PS: You may be in this situation mostly if you have used git to deploy your code on server and your development machine is different. This answer is based on the scenario which I faced and how it was solved.