PHP CLI has stopped working in WampServer

0

When I launch php -v from the command line, a pop-up window appears saying CLI has stopped working. I am using wampserver 2.5 and PHP version 5.5.12 on Windows 8.1. Because of this I cannot install Composer and get any coding work done.

php error log is blank

I'm getting this error in Event Viewer.

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:

What is going on? Please help.

command-line
php
wamp
asked on Super User Mar 30, 2017 by desbest • edited Apr 8, 2017 by desbest

1 Answer

1

As you claim you are using PHP version 5.5.12 but the error messages are describing PHP5.6.25

Check your PATH.

I would guess you added a PHP5.6.25 to it some time ago.

You should NEVER add a PHP folder to your PATH on WAMPServer as you can have more than one version of PHP installed with WAMPServer and specifying only one limits WAMPServers instant flexibility.

Instead create yourself a .cmd file and save it in a folder that is already on your PATH (so you dont need to add anything new to your path)

Here is an example of mine which encompasses a PHP version, Composer, and PEAR if you want it to.

@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=

Then call this like

> phppath 7.1.3

And it should make only TEMPORARY amendments to your PATH that exist only for the duration of the command windows existance.

answered on Super User Apr 27, 2017 by RiggsFolly

User contributions licensed under CC BY-SA 3.0