简体   繁体   中英

Laravel from localhost to server error

My laravel 4 project was created on localhost. Now i am trying to put it on the server (shared hosting) but i am running in to an error. First let me explain how i uploaded my laravel project.

mydomain.nl

mydomain.nl--public_html
mydomain.nl--public_html--dev
mydomain.nl--public_html--packages
mydomain.nl--public_html--index.php
mydomain.nl--public_html--.htacces
mydomain.nl--public_html--all other contents form public laravel folders 

mydomain.nl--project
mydomain.nl--project--bootstrap
mydomain.nl--project--vendor
mydomain.nl--project--app
mydomain.nl--project--all other folders and files wich were not in laravel public folder

Then i changed my mydomain.nl/project/bootstrap/paths.php to:

'public' => __DIR__.'/../../public_html',

And my mydomain.nl/public_html/index.php to

 require __DIR__.'/../project/bootstrap/autoload.php';
 $app = require_once __DIR__.'/../project/bootstrap/start.php';

If i go to my domain i get the following error

Error in exception handler: The stream or file "/hostingvariables/project/app/storage/logs/laravel.log" could not be opened: fopen(/hostingvariables/project/app/storage/logs/laravel.log) [function.fopen]: failed to open stream: Permission denied in /hostingvariables/project/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:77

I tryd everyting i could imagine but i can not solve this error, if someone could help me solve this error that would be great?

The error tells you that you dont have write access to

/hostingvariables/project/app/storage/logs/laravel.log

it says

Permission denied

So if you can chmod it to 775, or contact your host if it a shared solution where they control write access

I like this method best. Instead of changing folder permissions, set Apache to run as you.

  1. In terminal type id to get uid=123(Myname) .

  2. Open /etc/apache2/httpd.conf and edit it to use your username.

     <IfModule unixd_module> User Myname Group staff </IfModule> 
  3. Back to terminal: sudo apachectl restart

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM