PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Thursday, February 3, 2022

[FIXED] How can I make migration work after MAMP Update and Symfony 4 installation?

 February 03, 2022     mamp, migration, mysql, symfony     No comments   

Issue

I updated my Mamp Pro application to 6.2 and everything works well. My Symfony is running with the database, so everything is fine.

in the env file I am using this setting:

DATABASE_URL=mysql://root:root@localhost/mypage

Now the problem is, that in the console I want to make a migration, and this is not working anymore

php bin/console doctrine:migrations:diff

I get the error

An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory


Solution

After a long research I finally found the solution:

The php version of the terminal did not match the php version of MAMP. I had to use the mamp php version instead of the default osx php version.

1. Locate your osx php version with:

which php

The result should be:

/usr/local/bin/php

2. Backup (move) your original php binary:

sudo mv /usr/local/bin/php /usr/local/bin/php.bak

3. Create the symlink:

sudo ln -s /Applications/MAMP/bin/php/php7.4.12/bin/php /usr/local/bin/php

4. Run your new php version:

php -v



Answered By - peace_love
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing