简体   繁体   中英

PHP -> CLI has stopped working

I recently installed Windows 7 on my desktop and the following problem has begun occuring:

I regularly run some PHP scripts from the commandline that are now giving this error in a popup window:

CLI has stopped working.

I cancel this and my script terminates. Not good...

I've googled around and tried most of the few ideas suggested but still i am plagued by this annoyance. Right now it appears to regularly occur when I do a file_get_contents() of a url pointing to an image file. Only happens when the url is http protocol, works fine for ftp files. It also happens spuriously doing other things as well.

This is PHP 5.3.0 as distributed in a xampp 1.7.2 .zip. All exe's and dll's have been unblocked by copying thru FAT32 and back.

hints from anyone who's cracked this would be most helpful.

Try updating your PHP version bundled with xampp. You might have to update some php_XXX.dll extension files.

More info: http://web2.0entrepreneur.com/31/cli-has-stopped-working-on-windows-vista.html

PHP-CLI stops under these circumstances: Windows 7 64bit, PHP 5.6.8 64bit, only when Zend OpCache extension is ENABLED!!! Just edit php.ini and comment zend_extension=php_opcache.dll (with ; in front of it)

If you receive this error after installing WAMP, most likely you have another installation of PHP on your machine. This may have been installed using the Microsoft Web Platform Installer or by other means. The first thing you should do is un-install PHP.

If this doesn't work, check to make sure that IIS and Apache are not trying to use the same port. WAMP starts out with Port 80 as standard and IIS usually will be the same. The easiest way to fix this is to turn off IIS while running WAMP, but you can set either of them servers to port 81 or another port.

If this doesn't work, my last suggest is to look for multiple copies of php.ini on your machine. You may find them in places like the Windows directory. Make a backup of the file just in case, and then remove them from all of the folders except the WAMP folder.

it happened to me in laravel 5.I searched every where but no solution that fix my problem then i debug my web application at different points and found that if you comment your php code in laravel comments in blade template like

{{--print_r($date_a);--}}

Now comment like this

//print_r($date_a);

works

I found that this happened to me when I had the APC extension enabled. I switched to using the Wincache for PHP extension instead.

You didn't specify that you were using xdebug, but just in case you were, I may be able to help. I had this error for a long time. It turned out I was on a slightly older version of Xdebug (php_xdebug-2.2.0-5.4-vc9.dll).

I replaced that file with "php_xdebug-2.2.2-5.4-vc9.dll" and it magically started working immediately.

I'm on wamp, and I updated both php.ini files (one is for cli, one for normal use) with the latest filename. "zend_extension = c:\\wamp\\bin\\php\\php5.4.3\\ext\\php_xdebug-2.2.2-5.4-vc9.dll"

Then dropped the new file into the php ext folder and instant success.

I had the same issue on Windows 7 (Home premium). I had a hunch that it is caused by one of the extensions I installed so I started commenting them out one-by-one.

Turned out it was caused by a non-compatible mongodb extension I was using

The solution for me was to stop using PHP 5.3.0 and go back to 5.2.11. Once I did this the "CLI has stopped working" issue disappeared.

编辑php.ini并注释zend_extension=opcache.enable_cli=1 (前面有;)

Try to use another php version instead.

It works perfectly for me.

I have the same issue with Windows 7 Professional. My Apache Server has no problem finding and executing PHP within my web application but the command line execution gives the infamous message "CLI has stopped working." The User Account Settings seem to allow executions. Perl has no problem.

I always have to take my code to an XP machine and run it there to debug it.

Try to run scripts with php-cgi.exe instead of php.exe. For me it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM