CakePHP: Running bake.php on Windows command line

Saturday, August 12th, 2006 @ 8:56 pm | PHP, CakePHP

I have been wondering why my bake.php is not working like it is suppose to be. After some debugging with the help of exit() and die(), I found out that PHP (v4.4.2) is not reading the arguments on the command line. After a quick google-ing, I found out that there’s a php.exe for CLI. It is different then the one on the PHP root directory. You can find out if the php.exe you are running from the command line is a PHP for CGI or PHP for CLI by: >php -v.

To run bake.php correctly on windows, you have to use PHP for CLI not PHP for CGI. On my system, PHP for CLI is residing in the PHP_ROOT\cli directory. So, what I did was renaming the php.exe in the CLI subdirectory to php-cli.exe, then add PHP_ROOT\cli into my PATH. Now, I can run bake.php with:

**>php-cli bake.php -h** this should display bake help file.

I hope the above information is helpful.

One Response to “CakePHP: Running bake.php on Windows command line”

  1. Gilles Says:

    Those are those kind of advices which makes you smilling in the middle of the night. Thanks ! I can go to sleep now

Leave a Reply