Scott Evernden
Scott Evernden

Reputation: 39950

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.

Upvotes: 18

Views: 30139

Answers (12)

ibamboo
ibamboo

Reputation: 1577

Try to use another php version instead.

It works perfectly for me.

Upvotes: 0

MSajadi
MSajadi

Reputation: 3

Edit php.ini and comment zend_extension=opcache.enable_cli=1 (with ; in front of it)

Upvotes: 0

Kazzo
Kazzo

Reputation: 3

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

Upvotes: -1

ozeey
ozeey

Reputation: 11

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

Upvotes: 1

1000Gbps
1000Gbps

Reputation: 1517

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)

Upvotes: 4

lePunk
lePunk

Reputation: 523

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

Upvotes: 0

Scoson
Scoson

Reputation: 29

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.

Upvotes: 0

Prashiddha Raj Joshi
Prashiddha Raj Joshi

Reputation: 91

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.

Upvotes: 1

sammy
sammy

Reputation: 223

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.

Upvotes: 0

Craig
Craig

Reputation: 2193

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

Upvotes: 1

Scott Evernden
Scott Evernden

Reputation: 39950

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.

Upvotes: 0

Patrick Allaert
Patrick Allaert

Reputation: 1752

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

Upvotes: 5

Related Questions