I've been banging my head on this for weeks now. I've found many people with similar issues, and have gotten a little farther towards solving my issue, but not all the way.
WAMPserver 2.5 (PHP 5.5.12)
I originally installed Pear, but something was messed up (paths in config were crazy?), so I tried installing again, and then things got really messed up, so I removed everything Pear-related (except the pear subdir because Windows complained that a file in it was in use, even though it was empty), and gave Pyrus a shot. Now things seem to be working better at least as package management.
I believe I have my include_path(s) set correctly because now my script can at least find the Mail.php script.
include_path = ".;C:\wamp\bin\php\php5.5.12\pear\php"
my call, working:
include_once("Mail.php");
However, Mail.php is now complaining that it can't find Pear.php:
Failed opening required 'PEAR.php' (include_path='.;C:\wamp\bin\php\php5.5.12\pear\php') in C:\wamp\bin\php\php5.5.12\pear\php\Mail.php on line 46
There is no Pear.php file anywhere under \php5.5.12.
Is this happening because I'm using Pyrus, and Mail is set up to work in a Pear environment? (Even though Pyrus claims to be "Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear", see below.) Do I have to install both Pear and Pyrus? Should I use pyrus.phar to install Pear? As noted above, previous attempts to install Pear were less than successful. The documentation for both Pear and Pyrus could be improved by having a graphic depicting how a standard install ought to look like in terms of subdirs, etc. This is how my include_path branch looks like now:
c:\wamp\bin\php\php5.5.12\pear\php>tree /f
Folder PATH listing for volume OS
Volume serial number is A4D7-1271
C:.
│ Mail.php
│
├───Auth
│ │ SASL.php
│ │
│ └───SASL
│ Anonymous.php
│ Common.php
│ CramMD5.php
│ DigestMD5.php
│ External.php
│ Login.php
│ Plain.php
│ SCRAM.php
│
├───Mail
│ mail.php
│ mock.php
│ null.php
│ RFC822.php
│ sendmail.php
│ smtp.php
│ smtpmx.php
│
└───Net
SMTP.php
Socket.php
Here's my Pyrus config:
c:\wamp\bin\php\php5.5.12>php pyrus.phar get
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear
System paths:
php_dir => C:\wamp\bin\php\php5.5.12\pear\php
ext_dir => c:\wamp\bin\php\php5.5.12\ext\
cfg_dir => C:\wamp\bin\php\php5.5.12\pear\cfg
doc_dir => C:\wamp\bin\php\php5.5.12\pear\docs
bin_dir => C:\wamp\bin\php\php5.5.12
data_dir => C:\wamp\bin\php\php5.5.12\pear\data
www_dir => C:\wamp\bin\php\php5.5.12\pear\www
test_dir => C:\wamp\bin\php\php5.5.12\pear\tests
src_dir => C:\wamp\bin\php\php5.5.12\pear\src
php_bin => C:\wamp\bin\php\php5.5.12\php.exe
php_ini => C:\wamp\bin\php\php5.5.12\php.ini
php_prefix =>
php_suffix =>
Custom System paths:
User config (from C:\Users\mrz\pear\pearconfig.xml):
default_channel => pear2.php.net
auto_discover => 0
http_proxy =>
cache_dir => C:\wamp\bin\php\php5.5.12\pear\cache
temp_dir => C:\wamp\bin\php\php5.5.12\pear\temp
verbose => 1
preferred_state => stable
umask => 0022
cache_ttl => 3600
my_pear_path => C:\wamp\bin\php\php5.5.12\pear
plugins_dir => C:\Users\mrz\pear
(variables specific to pear2.php.net):
username =>
password =>
preferred_mirror => pear2.php.net
download_dir => C:\wamp\bin\php\php5.5.12\pear\downloads
openssl_cert =>
handle =>
paranoia => 2
Custom User config (from C:\Users\mrz\pear\pearconfig.xml):
(variables specific to pear2.php.net):
Any help will be greatly appreciated.
Update: I tried
php pyrus.phar install pear/PEAR
as shown on https://pear.php.net/package/PEAR/.
I get:
c:\wamp\bin\php\php5.5.12>php pyrus.phar install pear/PEAR
Pyrus version 2.0.0a4 SHA-1: 72271D92C3AA1FA96DF9606CD538868544609A52
Using PEAR installation found at C:\wamp\bin\php\php5.5.12\pear
Downloading pear.php.net/PEAR
Mime-type: application/octet-stream
Downloading pear.php.net/Archive_Tar=================================================================>] 100% (284/284 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/Structures_Graph============================================================>] 100% (19/19 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/Console_Getopt==============================================================>] 100% (12/12 kb)
Mime-type: application/octet-stream
Downloading pear.php.net/XML_Util====================================================================>] 100% ( 5/ 5 kb)
Mime-type: application/octet-stream
[====================================================================================================>] 100% (16/16 kb)
Warning: rename(C:\wamp\bin\php\php5.5.12,C:\wamp\bin\php\.old-php5.5.12): The process cannot access the file because it is bein
g used by another process. (code: 32) in phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransacti
on/Transaction/TwoStage.php on line 82
Call Stack:
0.0350 1218224 1. {main}() C:\wamp\bin\php\php5.5.12\pyrus.phar:0
0.0580 2198784 2. Pyrus\ScriptFrontend\Commands->run() C:\wamp\bin\php\php5.5.12\pyrus.phar:69
0.0970 3600832 3. Pyrus\ScriptFrontend\Commands->install() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/ph
p/Pyrus/ScriptFrontend/Commands.php:309
0.1110 4364600 4. Pyrus\Installer::commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/ScriptF
rontend/Commands.php:559
8.9739 11845424 5. Pyrus\AtomicFileTransaction::commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/P
yrus/Installer.php:344
8.9739 11845496 6. Pyrus\AtomicFileTransaction\Manager->commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0
a4/php/Pyrus/AtomicFileTransaction.php:90
8.9919 11845456 7. Pyrus\AtomicFileTransaction\Transaction\TwoStage->commit() phar://C:/wamp/bin/php/php5.5.12/pyrus.pha
r/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransaction/Manager.php:165
8.9919 11845488 8. rename() phar://C:/wamp/bin/php/php5.5.12/pyrus.phar/Pyrus-2.0.0a4/php/Pyrus/AtomicFileTransaction/Tr
ansaction/TwoStage.php:82
Pyrus\Installer\Exception: Installation failed
Pyrus\AtomicFileTransaction\MultiException: ERROR: commit failed
Pyrus\IOException: CRITICAL - unable to complete transaction, rename of actual to backup path failed
Pyrus\AtomicFileTransaction\RuntimeException: Cannot rollback - not in a transaction
Why is it trying to rename my entire php5.5.12 directory? Or is it? FTW?
Update: OK, I manually installed Pear. Changed include_path to
include_path = ".;C:\wamp\bin\php\php5.5.12\pear"
and my call to
include_once("php\Mail.php");
And I've gotten past the "missing" Pear.php error. But now, Mail can't find Net_SMTP, etc.
Gack. Do I have to specify a separate include_path entry for each extension? Or, should I get rid of \php and move its contents into \pear, with associated code and config changes? Or just dump all the extension files (without dir tree) into the same www dir as my script?
Easiest to do, without moving files, would be this:
include_path = ".;C:\wamp\bin\php\php5.5.12\pear;C:\wamp\bin\php\php5.5.12\pear\php"
But there really shouldn't be a subdirectory. Mail.php should be in the same directory as Pear.php.
(I use this stuff on Linux though, so I don't know how this particular distribution normally sets things up.)
Related
I would like to create a Symfony project. I have the same issue as many people concerning php version: Symfony uses the wrong one.
λ php -version
PHP 7.4.1 (cli) (built: Dec 17 2019 19:24:02) ( ZTS Visual C++ 2017 x64 )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
λ symfony -V
Symfony CLI version v4.12.4 (Tue Jan 14 13:09:08 UTC 2020)
λ symfony check:requirements
Symfony Requirements Checker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> PHP is using the following php.ini file:
C:\xampp\php\php.ini
> Checking Symfony requirements:
..............WWW......W..
[OK]
Your system is ready to run Symfony projects
I have Xampp installed but I use Laragon with 7.4.1 on Windows 10 and wish to use that one, but Symfony tells me this:
λ symfony local:php:list
┌─────────┬─────────────────────────────────────────────┬─────────┬─────────┬─────────────┬─────────┬─────────┐
│ Version │ Directory │ PHP CLI │ PHP FPM │ PHP CGI │ Server │ System? │
├─────────┼─────────────────────────────────────────────┼─────────┼─────────┼─────────────┼─────────┼─────────┤
│ 7.3.10 │ C:\xampp\php │ php.exe │ │ php-cgi.exe │ PHP CGI │ * │
│ 7.4.1 │ C:\laragon\bin\php\php-7.4.1-Win32-vc15-x64 │ php.exe │ │ php-cgi.exe │ PHP CGI │ │
└─────────┴─────────────────────────────────────────────┴─────────┴─────────┴─────────────┴─────────┴─────────┘
The current PHP version is selected from default version in $PATH
Even though there is no trace of Xampp or php 7.3.1 in my $PATH.
λ echo %path:;=&echo.%
C:\Program Files\cmder_mini\bin
C:\Program Files\cmder_mini\vendor\bin
C:\Program Files\cmder_mini\vendor\conemu-maximus5\ConEmu\Scripts
C:\Program Files\cmder_mini\vendor\conemu-maximus5
C:\Program Files\cmder_mini\vendor\conemu-maximus5\ConEmu
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Windows\System32\OpenSSH\
C:\Program Files\nodejs\
C:\Program Files\Git\cmd
C:\ProgramData\ComposerSetup\bin
C:\laragon\bin\php\php-7.4.1-Win32-vc15-x64\php.exe
C:\Program Files\Symfony
C:\laragon\bin
C:\laragon\bin\apache\httpd-2.4.35-win64-VC15\bin
C:\laragon\bin\composer
C:\laragon\bin\laragon\utils
C:\laragon\bin\mysql\mysql-5.7.24-winx64\bin
C:\laragon\bin\nginx\nginx-1.16.0
C:\laragon\bin\ngrok
C:\laragon\bin\notepad++
C:\laragon\bin\php\php-7.4.1-Win32-vc15-x64
C:\laragon\bin\putty
C:\laragon\bin\redis\redis-x64-3.2.100
C:\laragon\bin\telnet
C:\laragon\usr\bin
C:\Program Files\Sublime Text 3\
C:\Users\User\AppData\Local\Yarn\config\global\node_modules\.bin
C:\Users\User\AppData\Roaming\Composer\vendor\bin
C:\Users\User\AppData\Roaming\npm
C:\Ruby26-x64\bin
C:\Users\User\AppData\Local\Microsoft\WindowsApps
C:\Program Files\JetBrains\PhpStorm 2019.2.3\bin
C:\Program Files\JetBrains\DataGrip 2019.2.5\bin
C:\Program Files\Git\cmd
C:\Program Files\Git\mingw64\bin
C:\Program Files\Git\usr\bin
C:\Program Files\cmder_mini
(I checked user & system $PATH)
I tried to force Symfony into using 7.4.1 by running in a project directory:
λ echo "7.4.1" > .phpversion
When I run
λ symfony local:php:refresh
λ symfony local:php:list
I get:
λ WARNING the current dir requires PHP "7.4.1" (.php-version from current dir: C:\laragon\www\CMS_test\.php-version), but this version is not available
I also tried renaming the Xampp directory name, and as a matter of fact, that "works".
C:\
λ symfony check:requirements
php does not seem to be available under C:\xampp\php
C:\
λ symfony local:php:list
┌─────────┬─────────────────────────────────────────────┬─────────┬─────────┬─────────────┬─────────┬─────────┐
│ Version │ Directory │ PHP CLI │ PHP FPM │ PHP CGI │ Server │ System? │
├─────────┼─────────────────────────────────────────────┼─────────┼─────────┼─────────────┼─────────┼─────────┤
│ 7.4.1 │ C:\laragon\bin\php\php-7.4.1-Win32-vc15-x64 │ php.exe │ │ php-cgi.exe │ PHP CGI │ * │
└─────────┴─────────────────────────────────────────────┴─────────┴─────────┴─────────────┴─────────┴─────────┘
The current PHP version is selected from default version in $PATH
But that solution isn't really satisfying to me.
I've search StackOverflow for several hours, tried to re-install Symfony, restart the computer, ask friends etc no one seem to have another solution.
So, why does Symfony search for php in a Xampp directory ? Is it possible to choose another default one like Laragon's ? Any idea ?
I just had this problem on my Windows environment. For some reason, symfony is not reading .php-version correctly when I create it using echo "7.2" > .php-version.
The problem was gone once I deleted and created a new text file from my IDE. Probably creating it using vscode code .php-version or using the File Explorer would work too (I didn't try it, yet).
Edit: I just tried creating the file with VS Code and Notepad - Both worked. But I still don't know why it doesn't work when creating with echo...
Edit2: I think I got it. Looks like PowerShell's echo "" > file will create the file with UTF-16 encoding. After converting the file to UTF-8 it worked as expected.
Just delete your .php-version file and create in manually from your ide! With the from encoding (using echo from terminal) the error message was
the current dir requires PHP ��7.4.10
you can see the encoding is wrong by the question marks.
Creating the file from the ide fixed my problem!
I have a WAMP server on Win 8 running Laravel 4 and I'm trying to get wkhtmltophp to work properly.
I ran the Windows installation program I downloaded from here (the 64-bit "Windows (MSVC 2013)").
I'd first installed it into C:\Program Files\wkhtmltopdf, then I tried installing it into the laravel /vendor directory under C:\Program Files (x86)\Apache Group\Apache2\htdocs\gitt\vendor\wkhtmltopdf
naturally I changed my folder to match under /app/config/local/laravel-pdf.php and in this file I have
return array(
//'bin' => '/usr/bin/wkhtmltopdf'
'bin' => base_path() . '/vendor/wkhtmltopdf/bin'
);
And every time I run the script, I get the error "proc_open(): CreateProcess failed, error code - 5"
Not sure what I'm missing. Another developer, on a Mac, was able to install it on his side, so laravel also has the /vendor/mikehaertl/phpwkhtmltopdf installed, so I changed line 92 to:
class WkHtmlToPdf
{
#protected $bin = '/usr/bin/wkhtmltopdf';
protected $bin = '/Program Files (x86)/Apache Group/Apache2/htdocs/gitt/vendor/wkhtmltopdf/bin/wkhtmltopdf.exe';
etc......
Still got the same error. I'm lost! Any help would be greatly appreciated! :)
I am trying to install pear in wampserver. It doesn't come with a go-pear.bat.
I download the .phar file from pear.php.net/go-pear and run php go-pear.phar.
It just keeps looping over the config where I set all the paths.
What gives?
Lets assume you are running PHP5.3.24 and wamp is installed on the C: drive, if not change the folder names accordingly.
Get go-pear.phar from http://pear.php.net/go-pear.phar and copy it to the wamp\bin\php\php5.3.24 folder
Do all this from a windows command window
cd C:\wamp\bin\php\php5.3.24
md pear
PATH=%PATH%;C:\wamp\bin\php\php5.3.24
php go-pear.phar
When you get asked this question
Below is a suggested file layout for your new PEAR installation. To
change individual locations, type the number in front of the
directory. Type 'all' to change all of them or simply press Enter to
accept these locations.
1. Installation base ($prefix) : D:\wamp\bin\php\php5.3.24
2. Temporary directory for processing : D:\wamp\bin\php\php5.3.24\tmp
3. Temporary directory for downloads : D:\wamp\bin\php\php5.3.24\tmp
4. Binaries directory : D:\wamp\bin\php\php5.3.24
5. PHP code directory ($php_dir) : D:\wamp\bin\php\php5.3.24\pear
6. Documentation directory : D:\wamp\bin\php\php5.3.24\docs
7. Data directory : D:\wamp\bin\php\php5.3.24\data
8. User-modifiable configuration files directory : D:\wamp\bin\php\php5.3.24\cfg
9. Public Web Files directory : D:\wamp\bin\php\php5.3.24\www
10. Tests directory : D:\wamp\bin\php\php5.3.24\tests
11. Name of configuration file : D:\wamp\bin\php\php5.3.24\pear.ini
12. Path to CLI php.exe : \wamp\bin\php\php5.3.24
1-12, 'all' or Enter to continue: 12
To get it to proceed with the install you have to just PRESS the ENTER key
Its as simple as that
I faced the same issue, if you scroll a bit back, you should see an error, probably you didn't fill the php.exe folder properly (number 12). Just type 12, press enter and navigate to you PHP installation folder (like C:/php). Then, after hitting enter, installation should start.
Type local after running php go-pear.phar.
Then go with what Pedro Lobito said.
If the list shows again, just press Enter and installation should start.
I am having some trouble configuring doctrine orm on windows 8, php 5.4. I have installed Doctrine using Composer.
I have followed the docs to the letter but when I run any commands, php vendor/bin/doctrine orm:schema-tool:create for example, my command line just outputs
SRC_DIR="`pwd`"
cd "`dirname "$0"`"
cd "../doctrine/orm/bin"
BIN_TARGET="`pwd`/doctrine"
cd "$SRC_DIR"
"$BIN_TARGET" "$#"
I have also tried php vendor/bin/doctrine.php .... but it just prints out the above.
I have followed Doctrine's guide to the letter. Has anyone seen this before and if so, can you suggest anything?
i found a solution
there are also a bin folder in vendor/doctrine/orm/bin/ you can use this one like this
php vendor/doctrine/orm/bin/doctrine orm:schema-tool:create
make sure you have root folder and a cli-config.php file is present in root folder.
below is location where i found a solution
https://groups.google.com/forum/#!msg/doctrine-user/_ph183Kh-5o/_P_coljB-dcJ
this is working fine for me .
I had the same problem. The following solution worked for me:
"vendor/bin/doctrine.bat" orm:schema-tool:create
So, basically you:
use the ".bat" file provided by Doctrine and
enclose the call to that ".bat" file in quotes.
My Environment
Windows 7 Professional (x64)
PHP 5.5.12
Doctrine ORM 2.4.4
Do not write "php..." (it will write the file content)
Just "vendor\bin\doctrine orm:schema-tool:create" do the job (from the project root eg. c:\php\theProject).
Next, you will need a "cli-config.php" in the project root...
For Window version use backward slash "\"
vendor\bin\doctrine orm:schema-tool:create
not forward slash "/"
vendor/bin/doctrine orm:schema-tool:create
You can either install something like git bash or simply use the PHP version of the script:
php vendor\bin\doctrine.php orm:info
Obviously, the php binary directory should be in your PATH environment variable, otherwise, it's something like:
C:\path\to\php.exe vendor\bin\doctrine.php orm:info
Copy doctrine.bat (located at vendor/bin/doctrine.bat) to your project root directory
Create a bootstrap.php file in any path inside your project root directory with the following content:
use Doctrine\ORM\Tools\Setup;
use Doctrine\ORM\EntityManager;
$paths = array("../model");
$isDevMode = false;
$dbParams = array(
'driver' => 'pdo_mysql',
'host' => 'localhost',
'user' => 'root',
'password' => '',
'dbname' => 'angular_php',
);
$config = Setup::createAnnotationMetadataConfiguration($paths, $isDevMode);
$entityManager = EntityManager::create($dbParams, $config);
Create a cli-config.php file in your project root directory with the following content:
<?php
use Doctrine\ORM\Tools\Console\ConsoleRunner;
// replace with file to your own project bootstrap
require_once 'path/to/file/bootstrap.php';
return ConsoleRunner::createHelperSet($entityManager);
Execute from a command line window (CMD):
c:\path\to\project\root\directory>doctrine --help
It's done!
I found it wasnt returning anything from the doctrine.php.bat. Turns out it was a PHP error in my cli-config.php file
Using Cygwin on Windows with doctrine installed via composer, was having the same problem
resolved by:
vendor/bin/doctrine.bat orm:convert-mapping
if you are still having issues you can run the cli script using php to get the console tools running:
for example
php cli-config.php orm:schema-tool:create
All the answers on this question are either outdated or outright incorrect. In my case, I observed, after installing the the library, the "\vendor\doctrine\orm\" folder was completely empty. The docs ask you to run vendor/bin/doctrine, which in turn attempts to call "vendor\doctrine\orm\bin\doctrine[.php]" (The php file extension is optional). After discovering this, I downloaded the library from the git repository and replaced the composer-installed version.
php vendor/doctrine/orm/bin/doctrine
then works fine.
Also, beware of the common misconception that the cli-config.php file must exist in the root of your project. It's fine to leave it in your config folder
OSX machine running MAMP. CakePHP 2.2.1 installed and configured properly (meaning that I have all green bars when I browse to the Index.php file, I have completed the Blogs tutorial and am working on my second app with which scaffolding is up and running). Now I am trying to Bake for the first time.
Per the cookbook (and others), I installed a fresh copy of cake into a directory (my users directory) and then put the path variable in my .bash_profile file
export PATH="$PATH:/Users/p_scott/cake221/app/Console"
after which I was able to go into Terminal, type cake and have the console come up. You can see that up to that point, I was invoking the console from the app directory.
I first tried running cake bake from the terminal using the -app parameter and designating the path to my practice apps. The first time I did this, I got the following
Welcome to CakePHP v2.2.1 Console
-------------
App : app
Path: /Applications/MAMP/htdocs/blog/app/
-------------
Interactive Bake Shell
---------------
[D]atabase Configuration
[M]odel
[V]iew
[C]ontroller
[P]roject
[F]ixture
[T]est case
[Q]uit
What would you like to Bake? (D/M/V/C/P/F/T/Q)
> c
--------------------
Bake Controller
Path: /Applications/MAMP/htdocs/blog/app/Controller/
--------------------
\Use Database Config: (default/test)
[default] >
No matter what I put in for the database (if I leave it blank, it asks me again), but any answer gives me the following error:
Warning Error: PDO::__construct(): [2002] No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in [/Users/p_scott/cake221/lib/Cake/Model/Datasource/Database/Mysql.php, line 149]
Error: Database connection "SQLSTATE[HY000] [2002] No such file or directory" is missing, or could not be created.
#0 /Users/p_scott/cake221/lib/Cake/Model/Datasource/DboSource.php(260): Mysql->connect()
#1 /Users/p_scott/cake221/lib/Cake/Model/ConnectionManager.php(101): DboSource->__construct(Array)
#2 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ModelTask.php(906): ConnectionManager::getDataSource('default')
#3 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(396): ModelTask->getAllTables('default')
#4 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(419): ControllerTask->listAll(NULL)
#5 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(136): ControllerTask->getName()
#6 /Users/p_scott/cake221/lib/Cake/Console/Command/Task/ControllerTask.php(61): ControllerTask->_interactive()
#7 /Users/p_scott/cake221/lib/Cake/Console/Command/BakeShell.php(113): ControllerTask->execute()
#8 /Users/p_scott/cake221/lib/Cake/Console/Shell.php(393): BakeShell->main()
#9 /Users/p_scott/cake221/lib/Cake/Console/ShellDispatcher.php(201): Shell->runCommand(NULL, Array)
#10 /Users/p_scott/cake221/lib/Cake/Console/ShellDispatcher.php(69): ShellDispatcher->dispatch()
#11 /Users/p_scott/cake221/app/Console/cake.php(33): ShellDispatcher::run(Array)
#12 {main}
Once I started getting this error, I tried navigating in terminal to the <cake install dir>/app/Console folder and the <different instance of cake install dir>/app/Console folder to try the console from within my app/s. I either get the same errors or it asks me different questions, like:
What is the path to the project you want to bake?
[/Users/p_scott/myapp] > /Applications/MAMP/htdocs/history/app
What is the path to the directory layout you wish to copy?
[/Applications/MAMP/htdocs/history/lib/Cake/Console/Templates/skel] >
PHP CLI is installed and it appears to be working
PHP 5.3.8 (cli) (built: Dec 5 2011 21:24:09)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
My PDO support appears to be enabled. In terminal I typed:
php --ri pdo
PDO
PDO support => enabled
PDO drivers => mysql, sqlite, sqlite2
I don't have a php.ini file in Apache (because I am on a Mac), but the one in the PHP 5.36 directory, I have the following extensions enabled:
extension=imap.so
extension=yaz.so
extension=mcrypt.so
extension=gettext.so
extension=pgsql.so
extension=pdo_pgsql.so
extension=pdo_mysql.so
After taking a break, I found an article
(http://www.dereuromark.de/2011/10/31/freshly-baked-cake2-0-tips/) that talks about a change of console location in 2.0. I should try using it from that location (<cake installed dir>/lib/Cake/Console ). Once I tried this, I either got the questions about what layout I wanted to use or... ONCE, I was able to get the bake application to ask me to create a database configuration. I went through the steps and it pooped out this error at the end:
Fatal error: Class 'DATABASE_CONFIG' not found in /Applications/MAMP/htdocs/history/lib/Cake/Console/Command/Task/DbConfigTask.php on line 264
Which leads me to one more piece of info. This is my default DB configuration in the <cake installation dir>/history/app/Config/database.php file.
class DATABASE_CONFIG {
public $default = array(
'datasource' => 'Database/Mysql',
'persistent' => false,
'host' => 'localhost',
'login' => 'cakeHistoryUser',
'password' => 'cakeHistoryPassword',
'database' => 'cake_history',
'prefix' => '',
//'encoding' => 'utf8',
);
Before posting this question (and all of this information), I spend some quality time out here and it seems like most of my issues are or CLI related but I just don't see where I need to change something and hours and hours later, I need some help.
Help me Obi Wan, you are my only hope
The problem is you are trying to interact with the database via the command line, however the PHP-CLI is a different install than the one proveided by MAMP so it doesn't know about the database server.
Try changing localhost to 127.0.0.1 in your app/Config/database.php file and that should do the trick.
Something like this happened to me, and the easiest way I found to make it work which I don't see here is changing localhost to 127.0.0.1 and adding the port number at the end, e.g., MAMP uses port number 8899, so:
"mysql:host=127.0.0.1:8889"