Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jeksn's avatar
Level 5

Issue with migration command

Hello! I'm trying to set up a new project and I can't get past the migrate stage. I have everything running through Herd and running laravel new project-name works until I try and run the migration and it just stops. I've tried with both sqlite and mysql as options when installing. Also ran composer global update and nothing changed.

All other php artisan commands seem to be working fine except for migrate, which does nothing.

Has anyone run into this or have any ideas why this is happening and how to fix it?

0 likes
2 replies
LaryAI's avatar
Level 58

When encountering issues with the php artisan migrate command not executing, there are several steps you can take to diagnose and resolve the problem:

  1. Check Database Configuration: Ensure that your .env file is correctly configured for the database connection. For MySQL, it should look something like this:

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=your_database_name
    DB_USERNAME=your_username
    DB_PASSWORD=your_password
    

    For SQLite, ensure you have the correct path to your database file:

    DB_CONNECTION=sqlite
    DB_DATABASE=/absolute/path/to/database.sqlite
    
  2. Verify Database Connection: Test the database connection using a tool like MySQL Workbench or a simple PHP script to ensure that the credentials and host are correct.

  3. Check Migration Files: Ensure that your migration files are correctly formatted and do not contain any syntax errors. You can run:

    php artisan migrate:status
    

    This command will show you the status of each migration and can help identify if any migrations are causing issues.

  4. Clear Cache: Sometimes, cached configurations can cause issues. Clear the cache using:

    php artisan config:cache
    php artisan cache:clear
    php artisan config:clear
    
  5. Check for Errors: Run the migration command with verbose output to see if any errors are being suppressed:

    php artisan migrate --verbose
    
  6. Check PHP and Laravel Logs: Look into the storage/logs/laravel.log file for any error messages that might give more insight into what's going wrong.

  7. Ensure Database Exists: Make sure the database you are trying to migrate to actually exists. You can create it manually if it doesn't:

    CREATE DATABASE your_database_name;
    
  8. Update Composer Dependencies: Ensure all your dependencies are up to date:

    composer update
    
  9. Check PHP Version: Ensure that the PHP version you are using is compatible with your Laravel version.

If none of these steps resolve the issue, consider providing more specific error messages or logs for further assistance.

jeksn's avatar
jeksn
OP
Best Answer
Level 5

Updating Herd to the latest version solved it. Didn't think it was that important to keep it up to date but now I'll keep track of the updates more closely.

Please or to participate in this conversation.