“CLI has stopped working” on Windows Vista
I am posting this information because I want other people who’s facing the same problem as I had to be able to find the solution when searching through Google. I know I didn’t. So for PHP users who are using XAMPP on Windows Vista, pay attention (other WAMPs could be affected too)…
The Problem
Being a CakePHP baker, I had the tendency to try out the Bake script (a convenient command-line interface (CLI) tool in CakePHP which helps programmers to create all the necessary Model classes, Controller classes, and View template files based on the database schema - alongside with some optional basic CRUD methods). So after I set-up the console so that it can run PHP and the bake script, I typed in “cake” into the cmd box and pressed Enter. The Cake console appeared to be running successfully, but there is this annoying error box which kept on popping up everytime I run a command/script. This error box carried the message “CLI has stopped working”. Oddly, the CLI could still be used afterwards 

At first I thought it was a CakePHP problem, but when I tried running the command “php -v” to check the PHP information, the same problem happened. So I knew this must be a PHP problem instead of CakePHP’s.

A short Googling around suggested me that most of the people having this problem are those who uses XAMPP on Vista. Initially I decided to just forget about the problem and move on since the scripts did run without problems. But to make matters worse, everytime I start up my Komodo Edit IDE, that error box pops up like 5 times in a row. Now that annoyed me to the bone so I decided to have this problem fixed.
The Solution
I paid a visit to PHP.net in hope to find something helpful and found a line somewhere in the PHP 5.2.3 changelog that caught my attention:
“Fixed commandline handling for CLI and CGI. (Marcus, Johannes)”
Realising that the PHP version used in XAMPP is version 5.2.2, I immediately downloaded the PHP 5.2.3 binaries in hope that replacing the PHP in the XAMPP folder with the new version of PHP would fix this problem. To my amazement, it did. No more annoying pop-ups.. yay!
Update: The “Actual” Solution
Turns out that the actual culprit to this problem is the mysqli extension (mysqli_php.dll) distributed with XAMPP. So instead of replacing all of the latest PHP distribution, you only need to replace that particular extension with the one that came pre-installed with XAMPP. That is sufficient enough to get rid of the annoying alert box.
So there.. if you ever face the “CLI has stopped working” error on your Vista machine, don’t just give up and disable CLI straight away. Simply download the latest PHP binaries and replace it into where you installed PHP (eg: C:\xampp\php) overwriting everything. Practically, you may only need to replace the mysqli_php.dll extension. That should do the trick. 








If I've provided some info that you find to be useful, don't hesitate to
July 23rd, 2007 at 2:11 am
i’ve also experienced the same problem using xampp.. but alternatively, i uninstall xampp, disable UAC, reinstall xampp, and did not turn on UAC at all.. and it seems go back to normal..
July 23rd, 2007 at 8:14 am
The problem that you encountered may be a different issue altogether since I never had UAC turned on when this problem happened or even when I installed XAMPP (I had UAC turned off from the day I got my Vista machine due to it being an annoying feature :P).
Besides, when I was trying to troubleshoot this problem, I had gone through a few re-installations of XAMPP, EasyPHP and Wampserver.
July 23rd, 2007 at 12:24 pm
One of the reason quite a number of people upgraded back to Win XP..haha..
July 23rd, 2007 at 1:01 pm
You mean “downgraded”..
yeah that’s true. but sooner or later everyone will still have to migrate to Vista 
July 28th, 2007 at 5:06 pm
This helped a lot, I wasn’t using it for Cake, put to install PEAR packages and I ran into this CLI problem.
Upgrading PHP did the job, but funny thing is all the PEAR packages which came preinstalled in XAMPP weren’t detected so I ‘re-installed’ those which I needed.
And did I say thanks, if not there you go.
July 28th, 2007 at 5:13 pm
@Kris Meister: Glad my post helped
August 19th, 2007 at 10:43 pm
No, I think Ashrufzz was correct when he said upgraded back to XP. As for everyone migrating to Vista I’ll switch over to Linux before I develop under Vista.
As for php 5.2.3 - i’ve heard some negative things about it. Segmentation faults and bugginess.
October 17th, 2007 at 8:04 pm
Hi i’m having a similar problem and i wonder if you could help.
when i click the pear.bat file in the php folder of xampp i get the “CLI Stopped working”
i only really want the pear DB classes at the moment so if you could tell me how to install these that would be great
November 2nd, 2007 at 12:58 am
Thank you for posting your solution.
I’ve got exactly the same problem (Vista, XAMPP, CLI error messages), but the strange thing is that my PHP version is 5.2.4.
Does anyone know what else could be the reason for the problem?
November 2nd, 2007 at 1:36 am
@Curt: I recommend downloading the latest PHP files and just replace it with the one you have installed with XAMPP, even though the versions are the same. Some people have reported that doing this solved their problem.
So go ahead and give it a try
November 2nd, 2007 at 3:19 pm
Yesss! Thank you Tengku Zahasman, that fixed the problem.
The strange thing was that I already tried updating the PHP version before, but I did it using the Installer (not the zip package). This obviously didn’t help, but using the zip package did it.
November 3rd, 2007 at 8:54 pm
Apparently the prime suspect is the mysqli extension. Disabling it in a stock XAMPP PHP 5.2.4 install gets rid of the annoying error. So perhaps only replacing this specific extension is required?
November 8th, 2007 at 11:58 pm
I was just researching this exact problem for PHP 5.2.4 and when I read this I thought I’d try what Pádraic Brady said. I confirmed that simply replacing the mysqli extension (php_mysqli.dll) did the trick. My install was a stock XAMPP 1.6.4 install.
Thanks.
November 9th, 2007 at 2:18 am
Thanks Pádraic Brady and Jim Davies for your discovery! I have updated the post to include this useful information.
November 24th, 2007 at 2:49 pm
[…] took a while to find an explanation - but finally I did. Many thanks to Tengku Zahasma. I followed his suggestion and upgraded to PHP 5.2.5 and now all is well. […]
November 29th, 2007 at 8:34 am
If mysqli isn’t one of your priorities (although if you’re using mysql, it probably should be), you can always just comment your xampp/php/php.ini’s “extension=php_mysqli.dll” line and it will work fine.
December 9th, 2007 at 9:53 pm
Great article.
I face the same problem today while trying to use bake script. After disabling mysqli, now it works.
Thanks.
December 16th, 2007 at 9:06 pm
I took Tengku Zahasman’s suggestion, and upgraded from 5.2.4 to 5.2.5, and it worked fine.
December 28th, 2007 at 6:15 am
Thanks. I could hug you, but I bought you a coffee instead. I assume it’s $5
Cheers,
Ryan.
December 29th, 2007 at 5:38 am
Yay…! Thanks for the coffee Ryan. You assumed correct. I’m sipping it right now as I type this
January 4th, 2008 at 11:53 pm
great help! thanks, copied the newest php zip’s file to xampp and not it works without error!
January 27th, 2008 at 10:35 pm
Wow! I thought it was a stupid Vista issue (I get similar rundll32 errors), but after commenting out mysqli.dll, works great! Thanks!
February 7th, 2008 at 10:30 am
[…] on your system. – I know this seems weird, but it works. If you want a longer explanation, read Tengku Zahasman’s article on the same subject, with the comments. (I found the article using […]
February 16th, 2008 at 7:10 pm
Hmm.. thats strange.. my XAMPP already has php 5.2.5 and i still get the error… anyway i will try downloading and see.
is there any place where i can download that particular dll rather than the whole zip or installer? i have a slow dial up connection
April 12th, 2008 at 10:29 am
NICE!
Solution worked like a charm. Thanks. =)
April 16th, 2008 at 12:31 pm
Thank you, you saved much discovery time!
June 13th, 2008 at 10:23 am
Just ran into the very first pop saying CLI stopped working, and a quick google turns up your post. Will try your fix later. Thanks
July 3rd, 2008 at 6:15 am
Thanks for the post. Unfortunately it didn’t solve the problem for me, but I finally resolved it by replacing libmysql.dll. If interested, I posted a follow-up here: http://www.verysimple.com/blog/2008/07/03/cli-has-stopped-working/
July 23rd, 2008 at 4:20 pm
This hasn’t solved the problem for me either. I have used the latest PHP 5.2.6 php_mysqli.dll file, and the latest from mysql.com in the connectors section. Each time I get the fabled CLI has stopped working error.
September 8th, 2008 at 11:57 am
Thanks, saved me from headache inducing error boxes in Komodo.
January 7th, 2009 at 12:36 am
Ah, thanks for the tip. Even though XAMPP for Windows currently ships with PHP 5.2.8, I was getting the same “CLI stopped working” error. Extracting a fresh download from php.net made the hurting stop. Okay, so maybe this is like using a chainsaw to remove a splinter, but I had more bandwidth than patience
Thank you for posting this!
January 11th, 2009 at 3:02 am
Thanks, it did the trick. Even though the new php version is exactly the same as the one that came with XAMPP. Same as just Brian said.
Now my ingredients are there I can start baking as well.
January 25th, 2009 at 2:09 am
I’ve found using Cygwin Bash Shell a lot more useful for baking cake applications. It provides a great history of previous commands (easier than remember cd cake/console/, ./cake version shadow, etc.) and acts like the native environments on Mac or Linux.
http://www.cygwin.com/
February 8th, 2009 at 1:39 am
Hi Tengku, I’m using PHP 5.2.8, and yet your solution still works. Thanks a bunch.
Appreciate that you put the solution into your blog!
Robert
February 18th, 2009 at 4:24 pm
Thanks for that! You made my day!
February 24th, 2009 at 1:28 pm
Hello. While I appreciate the solutions previously described, none seem sufficient for me so far. I have replaced all of the PHP subfolder contents with a PHP.net 5.2.8 binary’s contents. I have also replaced the libMySQL.dll, and the popup keeps popping up.
My problem signature for this same CLI/PHP issue is as follows:
Problem signature:
Problem Event Name: APPCRASH
Application Name: php.exe
Application Version: 5.2.8.8
Application Timestamp: 493d760b
Fault Module Name: ntdll.dll
Fault Module Version: 6.0.6001.18000
Fault Module Timestamp: 4791a783
Exception Code: c0000005
Exception Offset: 0002f217
OS Version: 6.0.6001.2.1.0.256.1
Locale ID: 1033
Additional Information 1: fd00
Additional Information 2: ea6f5fe8924aaa756324d57f87834160
Additional Information 3: fd00
Additional Information 4: ea6f5fe8924aaa756324d57f87834160
Any ideas on which files I should try to replace?
March 4th, 2009 at 10:10 pm
I would start off by replacing ntdll.dll as stated in the error message, and also mysqli_php.dll from a fresh php download.
Not really sure if it may work but its worth the try
April 3rd, 2009 at 5:56 am
hi,Thanks very much!
April 22nd, 2009 at 11:25 am
Wow… I had the EXACT same problem… XAMPP on windows vista running the cake bake script… Thanks!!!
June 23rd, 2009 at 10:12 pm
On the xampp 1.7.1, I see that php.exe -v take a long time to exit. Anyone else with the same problem?
September 3rd, 2009 at 7:28 pm
Thanks for the advice, it worked perfectly. Now I can get back to my app!
November 27th, 2009 at 10:44 am
Thank you so much!
I just commented out the extension because I don’t use it and it worked perfectly!
December 14th, 2009 at 1:31 pm
[…] Podobny problem jets opisany tutaj: cli has stopped working on vista […]
January 16th, 2010 at 9:59 pm
I was getting this issue but it wasn’t the mysqli_php.dll extension, but rather php_soap.dll.
I had to figure this out by process of elimination — commenting out extension includes in my php.ini file until I found the culprit. Fortunately it’s not a big deal for me as I don’t need soap extensions, but this isn’t really a “fix” either.
January 25th, 2010 at 11:47 pm
thanks…. you are my hero… jajaja