VINLAB Laravel cPanel Deployment Guide ====================================== Use this guide after uploading/importing the VINLAB Laravel project into a cPanel hosting account. Important Folders ----------------- Laravel project root: - This is the folder containing artisan, app, bootstrap, config, database, public, resources, routes, storage, vendor, .env Public web root: - The website must point to the Laravel public folder. - Correct document root should be: your-project-folder/public Example: If project is uploaded to: /home/username/vinlab-laravel Then document root should be: /home/username/vinlab-laravel/public Step 1: Upload Project Files ---------------------------- Upload the full project to your cPanel account. Make sure these folders/files are included: - app - bootstrap - config - database - public - resources - routes - storage - vendor - artisan - composer.json - .env If vendor folder is missing, run composer install on hosting terminal: composer install --no-dev --optimize-autoloader Step 2: Set Domain / Subdomain Document Root -------------------------------------------- In cPanel: 1. Go to Domains or Subdomains. 2. Select the domain/subdomain. 3. Set document root to the project's public folder. Example document root: /home/username/vinlab-laravel/public If cPanel does not allow selecting public folder directly: - Keep project outside public_html if possible. - Put only contents of Laravel public folder inside public_html. - Then edit public_html/index.php paths to point to the real project folder. In public/index.php, update these paths if needed: require __DIR__.'/../vendor/autoload.php'; $app = require_once __DIR__.'/../bootstrap/app.php'; Example if public_html contains public files and Laravel core is in /home/username/vinlab-laravel: require __DIR__.'/../vinlab-laravel/vendor/autoload.php'; $app = require_once __DIR__.'/../vinlab-laravel/bootstrap/app.php'; Step 3: Create MySQL Database ----------------------------- In cPanel: 1. Go to MySQL Databases. 2. Create a database. 3. Create a database user. 4. Assign the user to the database with ALL PRIVILEGES. Keep these details: - Database name - Database username - Database password - Database host, usually localhost Step 4: Update .env File ------------------------ Open the .env file in the project root. Update website URL: APP_URL=https://yourdomain.com Update database details: DB_CONNECTION=mysql DB_HOST=localhost DB_PORT=3306 DB_DATABASE=your_database_name DB_USERNAME=your_database_user DB_PASSWORD=your_database_password If password has special characters, keep it as-is. Do not add extra spaces. Step 5: App Key --------------- If APP_KEY is empty, run: php artisan key:generate If APP_KEY already exists, do not change it unless this is a fresh deployment. Step 6: Import or Migrate Database ---------------------------------- Option A: Fresh database using migrations: php artisan migrate Then import products using the importer: php artisan vinlab:import-products "/home/username/path-to-product-file.txt" Option B: Existing local database export: 1. Export local MySQL database from phpMyAdmin. 2. Open cPanel phpMyAdmin. 3. Select hosting database. 4. Import the .sql file. Step 7: Storage and Cache Permissions ------------------------------------- These folders must be writable: - storage - bootstrap/cache - public/assets/uploads Typical cPanel permissions: - Folders: 755 - Files: 644 If uploads/cache fail, set these folders to writable from cPanel File Manager. Step 8: Clear and Cache Laravel ------------------------------- Run these commands from the project root: php artisan optimize:clear php artisan config:cache php artisan route:cache php artisan view:cache If the site shows old settings, run: php artisan optimize:clear Step 9: Admin Login Settings ---------------------------- Admin login uses .env values. Check or update: ADMIN_USERNAME=admin ADMIN_PASSWORD_HASH=your_bcrypt_password_hash Do not write plain password in ADMIN_PASSWORD_HASH. It must be a bcrypt hash. Step 10: Inquiry Email Recipients --------------------------------- Admin inquiry recipient emails can be updated from: /admin/settings Field: Admin Inquiry Emails You can add multiple emails separated by commas: sales@yourdomain.com, admin@yourdomain.com, support@yourdomain.com Mail sending also depends on .env mail settings. Example SMTP settings: MAIL_MAILER=smtp MAIL_HOST=mail.yourdomain.com MAIL_PORT=465 MAIL_USERNAME=sales@yourdomain.com MAIL_PASSWORD=your_email_password MAIL_ENCRYPTION=ssl MAIL_FROM_ADDRESS=sales@yourdomain.com MAIL_FROM_NAME="VINLAB" If mail is not configured, forms may save inquiries but emails may not be sent. Step 11: Product Import on Hosting ---------------------------------- Upload the product .txt file to the server, then run: php artisan vinlab:import-products "/home/username/path/file-name.txt" --dry-run If dry run looks correct: php artisan vinlab:import-products "/home/username/path/file-name.txt" Product import format is documented in: PRODUCT_CONTENT_IMPORT_FORMAT.txt Step 12: Media Uploads ---------------------- Uploaded product/media files are saved under: public/assets/uploads/products Make sure this folder exists and is writable. Step 13: Useful URLs -------------------- Public site: https://yourdomain.com Products: https://yourdomain.com/products Admin: https://yourdomain.com/admin/login Settings: https://yourdomain.com/admin/settings Media: https://yourdomain.com/admin/media Troubleshooting --------------- Error: 500 Internal Server Error - Check .env database details. - Run php artisan optimize:clear. - Check storage/logs/laravel.log. Error: No application encryption key - Run php artisan key:generate. Error: SQLSTATE access denied - DB username/password/database name is wrong in .env. - Make sure cPanel DB user has ALL PRIVILEGES. Error: Table not found - Run php artisan migrate or import the database SQL file. Images not uploading - Check public/assets/uploads/products permission. Pages still showing old content - Run php artisan optimize:clear. Composer not available on hosting - Upload vendor folder from local project. Final Deployment Checklist -------------------------- - Domain document root points to public folder. - .env APP_URL is correct. - .env DB details are correct. - Database migrated or imported. - storage and bootstrap/cache are writable. - public/assets/uploads/products is writable. - php artisan optimize:clear completed. - Admin login works. - Product listing works. - Inquiry form saves and sends email.