简体   繁体   中英

/vendor/autoload.php not found when installing Laravel on Ubuntu 18.04

I am trying to install Laravel on my Ubuntu 18.04 computer. I installed composer in /opt/lampp/htdocs/www .

I created a project using the create project command in composer. Once installed I went to the directory via terminal, /opt/lampp/htdocs/www/laravelproject .

I entered composer install in the terminal. When I go to localhost/www/laravelproject/public I get this error message:

PHP Warning:
  require(/opt/lampp/htdocs/www/laravelproject/vendor/autoload.php):  
  failed to open stream: No such file or directory
  in /opt/lampp/htdocs/www/laravelproject/artisan on line 18
PHP Fatal error: require(): Failed opening required
  '/opt/lampp/htdocs/www/laravelproject/vendor/autoload.php'
  (include_path='.:/usr/share/php')
  in /opt/lampp/htdocs/www/laravelproject/artisan on line 18

I have looked all over Google, and stackoverflow for a solution, and all I've been able to find was to go to the root directory and enter composer install via terminal.

But that hasn't fixed the issue for me. Any ideas what could have gone wrong?

Thank you for your time. I appreciate it.

UPDATE: I ended up uninstalling composer, installing Apache2 and installing the dependencies that are show on the laravel website.

From there I reinstalled composer, and laravel, and used the /var/www/html section that the apache installation gave me. And it worked.

In the www folder try to give permission recursively all the laravel folder. You can execute command below

sudo chmod -R 777 laravelproject

EDIT: If it works, check chmod 644 for a file and 755 for a folder. However, the problem here is to understand whether this is the source of the error.

UPDATE: You may try followings too

$ php artisan config:cache
$ php artisan config:clear
$ composer dump-autoload -o

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