CLI has stopped working
- July 3rd, 2008
- Posted in Announcements . PHP
- Write comment
“CLI has stopped working” is an error that you may encounter when running command-line PHP scripts in Windows. This has been reported frequently by CakePHP users when their “bake” scripts crash. My particular experience with this issue occurred while running PHPUnit tests from the command line.
The top search result as well as others indicates that this is a problem with php_mysqli.dll however none of the suggestions on this page helped me. An experts exchange post indicates that the problem is with libmysql.dll, however I didn’t know where to download the replacement for libmysql.dll. It turns out that I already had it and the following solves the problem on My Vista and Windows 2003 boxes:
Copy From: C:\Program Files\MySQL Server 5.0\bin\libmySQL.dll
Paste To: C:\Program Files\PHP\ (overwrite the original)
This assumes you installed MySQL and PHP to their default locations. If not, then use the correct paths for your particular setup.
Prior to this fix, my unit tests were causing the “CLI has stopped working” error at least 50% of the time. Since replacing the dll file I haven’t seen the error.
UPDATE – I recently got the CLI error again so this doesn’t solve the problem completely. However, it did radically decrease the number of times I get it. I’ve since discovered that the CLI happens when using the PEAR library Spreadsheet::Writer – I doubt that library is the cause, but something in there triggers the CLI error frequently.
This hasn’t helped at all for me. I have replaced libmysql.dll and php_mysqli.dll to no avail. What about php_mysql.dll?
I tell a lie, I have got it working. This time I completed replaced the ext directory with the latest from the PHP zip, and it works. I don’t think the problem was libmysql.dll
Hey John, what version did you copy? I thought I had fixed the problem for a while – i did not see any errors, but then it turns out it wasn’t totally fixed. The dll update definitely had a positive effect, but I can say for sure it wasn’t 100%.
Ok, maybe someone can help me. I’ve been trying install Wampserver, but the same thing happens each time. I get “CLI has stopped running” and the program closes. No one has been able to help me. I run a vista Ser.
Pac. 2 on a good running Windows system. Please help. If you don’t know please send me to the right place. The folks at Wampserver are not very responsive.
Hey Bob, I wish I knew. I would try installing Apache, PHP and MySQL manually using the latest versions. Personally I like using as many of the OS built-in services as possible so on Windows I prefer using IIS instead of Apache, but of course that has nothing to do with the CLI issue. CLI stands for Command Line Interface if you didn’t already know, which is only relevant when running PHP shell commands so you don’t really see it when running CGI or ISAPI.