I have XAMPP and cakePHP intalled locally, and have been wondering why my bake.php is not working like it is supposed to be according to the tutorials. It fails to bake and gives an annoying error message in the command prompt. 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.
While googling online, I found an easier solution. Depending on which version of XAMPP you are using, you might need to replace the mysqli extension (mysqli_php.dll) So instead of replacing all of the latest PHP distribution, you only need to replace that particular extension (mysqli_php.dll) with the one that came pre-installed with XAMPP.
Leave a Reply