Laravel 5.5执行php artisan serve启动失败求助(Ubuntu服务器)
vendor/autoload.php Not Found Error on Ubuntu Hey there, let's troubleshoot this issue together. That missing vendor/autoload.php error almost always means your Composer dependency installation didn't finish properly when setting up the Laravel 5.5 project. Here's how to fix it step by step:
1. Verify Your PHP Version Meets Laravel 5.5 Requirements
Laravel 5.5 requires PHP 7.0.0 or higher (this is likely why 5.4 works smoothly—it supports PHP 5.6+). Check your current PHP version with:
php -v
If you're running a version lower than 7.0, upgrade PHP on your Ubuntu server. For example, to install PHP 7.2 (a compatible LTS version):
sudo apt update sudo apt install php7.2 php7.2-cli php7.2-common php7.2-mbstring php7.2-xml php7.2-mysql php7.2-zip
2. Re-Run Composer Install to Generate Vendor Files
If your PHP version is correct, force Composer to re-download all dependencies and create the missing vendor directory:
- Navigate to your project folder first:
cd /var/www/html/sidbrint - Then run:
composer install
This command will pull in all required packages for Laravel 5.5 and regenerate the autoload.php file. It fixes issues caused by partial downloads or network interruptions during the initial project setup.
3. Fix Directory Permissions
Permission conflicts often prevent Composer from creating or writing to the vendor directory. Ensure your web server user (usually www-data) has proper access:
sudo chown -R www-data:www-data /var/www/html/sidbrint sudo chmod -R 755 /var/www/html/sidbrint
Alternatively, if you're using your personal user account to run Composer, add yourself to the www-data group to avoid future permission issues:
sudo usermod -aG www-data $USER
Log out and back in for this change to take effect.
4. Create the Project with --no-scripts (If Initial Install Kept Failing)
If the original composer create-project command kept failing mid-process, try creating the project without running post-install scripts first, then set up dependencies manually:
composer create-project --prefer-dist laravel/laravel blog "5.5.*" --no-scripts cd blog composer install php artisan key:generate
The --no-scripts flag skips auto-running setup commands that might be breaking the installation, letting you complete dependency downloads first.
After completing these steps, run php artisan serve again—your Laravel 5.5 project should start up without the autoload error.
内容的提问来源于stack exchange,提问作者Albert Lazaro de Lara

