PHP CLI已停止在WampServer中工作


0

当我发射 php -v 从命令行出现一个弹出窗口 CLI has stopped working。我在用 wampserver Windows 8.1上的2.5和PHP版本5.5.12。因此我无法安装Composer并完成任何编码工作。

php错误日志是空白的

我在事件查看器中收到此错误。

Faulting application name: php.exe, version: 5.6.25.0, time stamp: 0x57b60174
Faulting module name: ntdll.dll, version: 6.3.9600.18438, time stamp: 0x57ae642e
Exception code: 0xc0000005
Fault offset: 0x0000000000030c57
Faulting process ID: 0x2e70
Faulting application start time: 0x01d2aa27475e178b
Faulting application path: C:\wamp\bin\php\php5.6.25\php.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report ID: 870dbe02-161a-11e7-8263-38b1dbf6d8ea
Faulting package full name:
Faulting package-relative application ID:

Faulting application name: php-win.exe, version: 5.6.25.0, time stamp: 0x57b60195
Faulting module name: ntdll.dll, version: 6.3.9600.18438, time stamp: 0x57ae642e
Exception code: 0xc0000005
Fault offset: 0x0000000000030c57
Faulting process ID: 0x2f1c
Faulting application start time: 0x01d2aa0cab8c6362
Faulting application path: c:\wamp\bin\php\php5.6.25\php-win.exe
Faulting module path: C:\WINDOWS\SYSTEM32\ntdll.dll
Report ID: f3184580-15ff-11e7-8263-38b1dbf6d8ea
Faulting package full name:

到底是怎么回事?请帮忙。


已经提出并回答了这个问题 堆栈溢出 。你尝试过建议的解决方案了吗? 1.升级php 2.禁用OpCache 3.手动设置Apache,MySQL和PHP我相信将整个wampserver升级到更新的版本是你应该采取的第一步。
simlev

你检查过了吗 Stack Overflow上的这个答案 根据simlev的建议?
JakeGould

我已经升级到wampserver和php的最新版本,它仍然无法正常工作。
desbest

@desbest升级后,你删除了旧的PHP版本吗?请确保您正在启动最新版本。还要检查是否未启用OpCache。实际搜索你的硬盘可能是一个好主意 php*.exephp*.ini 文件,以了解您是否有多个版本,然后确定您正在使用哪个版本。对于 php.exe 这取决于 PATH 环境变量。
simlev

是的我升级后删除了旧的PHP版本。另外我卸载了wamp并试用了mamp for windows而它仍然无效。
desbest

Answers:


1

正如您声称您使用的是PHP 5.5.12版,但错误消息正在描述中 PHP5.6.25

检查你的路径。

我猜你加了一个 PHP5.6.25 不久之前。

你永远不应该 在WAMPServer上为您的PATH添加一个PHP文件夹,因为您可以使用WAMPServer安装多个版本的PHP并且只指定一个限制WAMPServers即时灵活性。

而是创造一个自己 .cmd 文件并将其保存在PATH上已有的文件夹中(因此您不需要在路径中添加任何新内容)

以下是我的一个示例,如果您需要,它包含PHP版本,Composer和PEAR。

@echo off

REM **************************************************************
REM * PLACE This file in a folder that is already on your PATH
REM * Or just put it in your C:\Windows folder as that is on the
REM * Serch path by default
REM * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
REM * EDIT THE NEXT 3 Parameters to fit your installed WAMPServer
REM **************************************************************

REM The folder WAMPServer is installed in
set baseWamp=C:\wamp
REM Pick a default version so you can call this without specifying
set defaultPHPver=5.6.15
REM Comment out if composer is not installed
set composerInstalled=%baseWamp%\composer
REM leave this alone
set phpFolder=\bin\php\php

if %1.==. (
    set phpver=%baseWamp%%phpFolder%%defaultPHPver%
) else (
    set phpver=%baseWamp%%phpFolder%%1
)

PATH=%PATH%;%phpver%
php -v
echo ---------------------------------------------------------------


REM IF PEAR IS INSTALLED IN THIS VERSION OF PHP

IF exist %phpver%\pear (
    set PHP_PEAR_SYSCONF_DIR=D:\wamp\bin\php\php%phpver%
    set PHP_PEAR_INSTALL_DIR=D:\wamp\bin\php\php%phpver%\pear
    set PHP_PEAR_DOC_DIR=D:\wamp\bin\php\php%phpver%\docs
    set PHP_PEAR_BIN_DIR=D:\wamp\bin\php\php%phpver%
    set PHP_PEAR_DATA_DIR=D:\wamp\bin\php\php%phpver%\data
    set PHP_PEAR_PHP_BIN=D:\wamp\bin\php\php%phpver%\php.exe
    set PHP_PEAR_TEST_DIR=D:\wamp\bin\php\php%phpver%\tests

    echo PEAR INCLUDED IN THIS CONFIG
    echo ---------------------------------------------------------------
) else (
    echo PEAR DOES NOT EXIST IN THIS VERSION OF php
    echo ---------------------------------------------------------------
)

REM IF A GLOBAL COMPOSER EXISTS ADD THAT TOO
REM **************************************************************
REM * IF A GLOBAL COMPOSER EXISTS ADD THAT TOO
REM * 
REM * This assumes that composer is installed in /wamp/composer
REM * 
REM **************************************************************
IF EXIST %composerInstalled% (
    ECHO COMPOSER INCLUDED IN THIS CONFIG
    echo ---------------------------------------------------------------
    set COMPOSER_HOME=%baseWamp%\composer
    set COMPOSER_CACHE_DIR=%baseWamp%\composer

    PATH=%PATH%;%baseWamp%\composer

    rem echo TO UPDATE COMPOSER do > composer self-update
    echo ---------------------------------------------------------------
) else (
    echo ---------------------------------------------------------------
    echo COMPOSER IS NOT INSTALLED
    echo ---------------------------------------------------------------
)

set baseWamp=
set defaultPHPver=
set composerInstalled=
set phpFolder=

然后称之为

> phppath 7.1.3

并且它应该仅对您的PATH进行TEMPORARY修正,仅在命令窗口存在的持续时间内存在。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.