Console CakePHP Mac

Par Nicolas Groelly, il y a 12 ans


Coucou :)
je suis sur Mac OS X 10.8.3, j'utilise MAMP comme serveur et j'ai crée un dossier "Sites" pour mettre mes projets, j'ai regardé des tutos pour utiliser la console sur Mac mais cela ne fonctionne pas et je ne sais pas comment la programmer ...

Pouvez-vous m'aider ? :)

Merci :)

11 réponses

justclara42, il y a 12 ans

Salut, tu obtiens quoi exactement comme message quand tu teste la console sous Mac?
Et les chemins de tes fichiers sont bons?

Nicolas Groelly, il y a 12 ans

J'obtiens "command not found"

justclara42, il y a 12 ans

ok, donne la commande, je suis aussi sous OS X 10.8.3 et j'ai pas se soucis

Edit: voilà mes commande en console (terminal.app sous mac)

cd /chemin/vers/ton/projet/cakephp/app/
./Console/cake ta_commande
Nicolas Groelly, il y a 12 ans
nico:~ Nicolas$ cd /Applications/MAMP/Sites/cakephp/app/console
nico:console Nicolas$ cake bake
justclara42, il y a 12 ans

va juste dans le dossier app, et tape ensuite:

./Console/cake bake

et aussi controle les droits du fichier "cake" dans le dossier console

Nicolas Groelly, il y a 12 ans

Oh ! Mecri je t'aime :) Mais pas trop non plus :p

Nicolas Groelly, il y a 12 ans

Et après quand sa marche pas ? :(

nico:app Nicolas$ ./Console/cake bake controller
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /Applications/MAMP/Sites/cakephp/lib/Cake/Cache/CacheEngine.php on line 59
Warning: strtotime(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /Applications/MAMP/Sites/cakephp/lib/Cake/Cache/CacheEngine.php on line 59
Welcome to CakePHP v2.3.0-beta Console
---------------------------------------------------------------
App : app
Path: /Applications/MAMP/Sites/cakephp/app/
---------------------------------------------------------------
---------------------------------------------------------------
Bake Controller
Path: /Applications/MAMP/Sites/cakephp/app/Controller/
---------------------------------------------------------------
Use Database Config: (default/test) 
[default] > y
Use Database Config: (default/test) 
[default] > default
Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [/Applications/MAMP/Sites/cakephp/lib/Cake/Model/Datasource/Database/Mysql.php, line 157]
Error: Database connection "Mysql" is missing, or could not be created.
#0 /Applications/MAMP/Sites/cakephp/lib/Cake/Model/Datasource/DboSource.php(261): Mysql->connect()
#1 /Applications/MAMP/Sites/cakephp/lib/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)
#2 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Command/Task/ModelTask.php(906): ConnectionManager::getDataSource('default')
#3 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Command/Task/ControllerTask.php(396): ModelTask->getAllTables('default')
#4 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Command/Task/ControllerTask.php(419): ControllerTask->listAll(NULL)
#5 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Command/Task/ControllerTask.php(136): ControllerTask->getName()
#6 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Command/Task/ControllerTask.php(61): ControllerTask->_interactive()
#7 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Shell.php(390): ControllerTask->execute()
#8 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/Shell.php(387): Shell->runCommand('execute', Array)
#9 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand('controller', Array)
#10 /Applications/MAMP/Sites/cakephp/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#11 /Applications/MAMP/Sites/cakephp/app/Console/cake.php(33): ShellDispatcher::run(Array)
#12 {main}
justclara42, il y a 12 ans

alors ton autre souci, c'est lier a un fichier "mysql.sock" qui est pas trouvé.

Je me souviens plus de la manipulation, mais il faut créer un alias.

J'essai de retrouver comment j'ai fait, sauf si quelqu'un te répond avant ;)

Nicolas Groelly, il y a 12 ans

Merci :)

Keisuke, il y a 12 ans

Hi,

Avec MAMP il faut que tu lui dise où se trouve le socket mysql.
soit dans le fichier database.php
ajouter dans le tableau de configuration:
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',

@+

lakamark, il y a 12 ans

Enfin j'ai réussit à faire fonctionner les ligne de commendes!