MacOSX XAMPP "doctrine-module" Does Not Work

Asked 2 years ago, Updated 2 years ago, 108 views

Is my Mac love or is there not enough effort?I'm afraid they don't understand... Please help me.Because...

I have Xampp on MacOSX and my database is trying to use MySQL.The language is PHP, the framework is ZendFramework 2.5, and I put Doctrine 2 in composer.

So,
Tried to generate an entity with reference to using Doctrine with the Zend Framework.

doctrine-moduleorm:convert-mapping --namespace=Application\Entity\ 
      --from-database announcement module\Application\src

doctorline-moduleorm:generate-entities --generate-annotations="true" 
          --generate-methods="true" module\Application\src

The results of the execution are

Fatal error: Uncaught exception 'PDOException' with message' SQLSTATE [HY000] [2002] No such file or directory 'in/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctorline/DBAL/Driver/PDOConection.php:43
Stack trace:
#0/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php(43): PDO->__construct('mysql:host=loca...', 'root', '12345678909876', Array)
#1/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOMySql/Driver.php(45): Doctrine\DBAL\Driver\PDOConection->__construct('mysql:host=loca...',45786',12390698)
#2/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(360): Doctrine\DBAL\Driver\PDOMySql\Driver->connect (Array, 'root', '12345678909876', Array)
#3/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php (429): Doctrine\DBAL\Connection->connect()
#4/Users/leonardo/Development/twap/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL in/Users/leonardo/Development/twap/vendor/zendframework/library/Zend/Service Manager.php onMagazine

Also, if you write down the common path information,

echo$PATH
/Users/leonardo/google-cloud-sdk/bin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/Applications/XAMPP/xamppfiles/bin:/Applications/XAMPP/xamppfiles/var/mysql/

So, php.ini

pdo_mysql.default_socket=/Applications/XAMPP/xamppfiles/var/mysql/mysql.sock

What's wrong with me?I really want to get along with this machine for a long time, so I've already written down what I'm calling her and the hierarchy in the house.

Why do people say "No such file or directory"?Can someone tell me?And in order not to be told this, what should I do next to her and what should I understand?

I'm really in trouble.Please give me some advice.

php mysql macos doctrine2 zend-framework

2022-09-30 20:35

1 Answers

PDO cannot connect to MySQL.

This is because /usr/bin/php is installed normally on a Mac, so the $PATH configuration above runs that php.

$PATH is used to search for executable files and looks for them in the order in which they are listed. /Applications/XAMPP/xamppfiles/bin/php must be listed before /usr/bin.


2022-09-30 20:35

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.