“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 Undecided

CLI has stopped working

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.

CLI has stopped working

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. Cool

Tags: 
Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • BlinkList
  • Ma.gnolia
  • Reddit
  • StumbleUpon


30 Responses to ““CLI has stopped working” on Windows Vista”

  1. thematrixuum Says:

    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..

  2. Tengku Zahasman Says:

    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.

  3. Ashrufzz Says:

    One of the reason quite a number of people upgraded back to Win XP..haha..

  4. Tengku Zahasman Says:

    You mean “downgraded”.. :P yeah that’s true. but sooner or later everyone will still have to migrate to Vista :D

  5. Kris Meister Says:

    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.

  6. Tengku Zahasman Says:

    @Kris Meister: Glad my post helped :D

  7. SpeedyG Says:

    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.

  8. adam Says:

    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

  9. Curt Says:

    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?

  10. Tengku Zahasman Says:

    @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 ;)

  11. Curt Says:

    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.

  12. Pádraic Brady Says:

    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?

  13. Jim Davies Says:

    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.

  14. Tengku Zahasman Says:

    Thanks Pádraic Brady and Jim Davies for your discovery! I have updated the post to include this useful information.

  15. Easy and Cheap PHP Editor…that’s good too… « Tarn Aeluin Says:

    […] 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. […]

  16. Draicone Says:

    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.

  17. QAD Says:

    Great article.

    I face the same problem today while trying to use bake script. After disabling mysqli, now it works.

    Thanks.

  18. Justin Says:

    I took Tengku Zahasman’s suggestion, and upgraded from 5.2.4 to 5.2.5, and it worked fine.

  19. Ryan McCue Says:

    Thanks. I could hug you, but I bought you a coffee instead. I assume it’s $5 :P
    Cheers,
    Ryan.

  20. Tengku Zahasman Says:

    Yay…! Thanks for the coffee Ryan. You assumed correct. I’m sipping it right now as I type this ;)

  21. Flo Says:

    great help! thanks, copied the newest php zip’s file to xampp and not it works without error! :-)

  22. Zvi Says:

    Wow! I thought it was a stupid Vista issue (I get similar rundll32 errors), but after commenting out mysqli.dll, works great! Thanks!

  23. Ten Fingers And A Brain, and FileMaker, XML, PHP · Getting XAMPP’s PHP CLI to work on Vista Says:

    […] 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 […]

  24. Munim Says:

    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 :-(

  25. Fauzi Says:

    NICE!

    Solution worked like a charm. Thanks. =)

  26. Martin Says:

    Thank you, you saved much discovery time!

  27. mosaic Says:

    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

  28. Jason Says:

    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/

  29. John Says:

    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.

  30. James Whitehead Says:

    Thanks, saved me from headache inducing error boxes in Komodo.

Leave a Comment