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

strategicsdemexico's avatar

I got error on php artisan migrate

I got a error when I try to do php artisan update on my production server

[ErrorException]                         
  Invalid argument supplied for foreach()  
                                           


Content-type: text/html

Script php artisan clear-compiled handling the post-update-cmd event returned with an error


                      
  [RuntimeException]  
  Error Output:       
                      


update [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--lock] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--with-dependencies] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [packages1] ... [packagesN]

Also when i do php artisan migrate, i got almost the same thing

$ php artisan migrate


                                           
  [ErrorException]                         
  Invalid argument supplied for foreach()  
                                           


Content-type: text/html
0 likes
3 replies
bobbybouwmann's avatar

Well the error is pretty clear right? One of your foreach is not correct... Can you post your migration here?

Note: Laravel is mostly used in America en Europe.. At the time of your post most people sleep or they are there jobs so they can't respond

vedmant's avatar

I just had the same problem. The problem is that your script is launched by php, but it needs php-cli. I fixed it by creating new dir ~/opt/bin, linking php-cli there as just php, and adding this dir to $PATH variable as prepending others.

something like this commands:
mkdir ~/opt/bin
ln -s /usr/local/php56/php-cli ~/opt/bin/php
echo "PATH=~/opt/bin/php:$PATH" >> ~/.bashrc

(didn't check commands)

Please or to participate in this conversation.