PHP -> CLI 已停止工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1671995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:27:41  来源:igfitidea点击:

PHP -> CLI has stopped working

phpwindows-7

提问by Scott Evernden

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

我最近在桌面上安装了 Windows 7,但开始出现以下问题:

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

我经常从命令行运行一些 PHP 脚本,这些脚本现在在弹出窗口中出现此错误:

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.

我已经在谷歌上搜索并尝试了大部分建议的想法,但我仍然被这种烦恼所困扰。现在,当我执行指向图像文件的 url 的 file_get_contents() 时,它似乎经常发生。仅在 url 为 http 协议时发生,适用于 ftp 文件。它也会虚假地做其他事情。

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.

这是在 xampp 1.7.2 .zip 中分发的 PHP 5.3.0。所有 exe 和 dll 都已通过通过 FAT32 复制并返回来解除阻止。

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

任何破解此问题的人的提示将是最有帮助的。

采纳答案by Patrick Allaert

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

尝试更新与 xampp 捆绑在一起的 PHP 版本。您可能需要更新一些 php_XXX.dll 扩展文件。

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

更多信息:http: //web2.0entrepreneur.com/31/cli-has-stopped-working-on-windows-vista.html

回答by 1000Gbps

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

PHP-CLI 在以下情况下停止:Windows 7 64 位,PHP 5.6.8 64 位,仅当 Zend OpCache 扩展启用时!!!只需编辑php.ini和评论zend_extension=php_opcache.dll;在它前面)

回答by ozeey

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

它发生在我的 Laravel 5.I 搜索了每一个地方,但没有解决我的问题的解决方案,然后我在不同的点调试我的 Web 应用程序,发现如果你在刀片模板中的 laravel 注释中注释你的 php 代码,例如

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

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

Now comment like this

现在这样评论

//print_r($date_a);

//print_r($date_a);

works

作品

回答by Prashiddha Raj Joshi

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.

如果您在安装 WAMP 后收到此错误,很可能您的计算机上安装了另一个 PHP。这可能是使用 Microsoft Web 平台安装程序或通过其他方式安装的。您应该做的第一件事是卸载 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.

如果这不起作用,请检查以确保 IIS 和 Apache 没有尝试使用相同的端口。WAMP 以端口 80 作为标准开始,而 IIS 通常是相同的。解决此问题的最简单方法是在运行 WAMP 时关闭 IIS,但您可以将其中任何一个服务器设置为端口 81 或其他端口。

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.

如果这不起作用,我最后的建议是在您的机器上查找 php.ini 的多个副本。您可以在 Windows 目录等地方找到它们。备份文件以防万一,然后从除 WAMP 文件夹之外的所有文件夹中删除它们。

回答by Craig

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

我发现当我启用 APC 扩展时,这发生在我身上。我改用 Wincache for PHP 扩展。

回答by sammy

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.

我在 Windows 7 Professional 上遇到了同样的问题。我的 Apache 服务器在我的 Web 应用程序中查找和执行 PHP 没有问题,但命令行执行给出了臭名昭著的消息“CLI 已停止工作”。用户帐户设置似乎允许执行。Perl 没有问题。

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

我总是必须将我的代码带到 XP 机器上并在那里运行以进行调试。

回答by Scott Evernden

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 5.3.0 并返回到 5.2.11。一旦我这样做了,“CLI 已停止工作”问题就消失了。

回答by Scott Denton

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

您没有指定您使用的是 xdebug,但以防万一,我可以提供帮助。我有这个错误很长时间了。原来我使用的是稍旧版本的 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.

我用“php_xdebug-2.2.2-5.4-vc9.dll”替换了该文件,它立即神奇地开始工作。

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"

我在 wamp 上,我用最新的文件名更新了两个 php.ini 文件(一个用于 cli,一个用于正常使用)。“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.

然后将新文件放入 php ext 文件夹并立即成功。

回答by lePunk

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.

我在 Windows 7(家庭高级版)上遇到了同样的问题。我有一种预感,它是由我安装的一个扩展引起的,所以我开始一一注释掉它们。

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

原来它是由我使用的不兼容的 mongodb 扩展引起的

回答by MSajadi

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

编辑php.ini和评论zend_extension=opcache.enable_cli=1(用 ; 在它前面)