php7 cli
Posted by: adiuvo (---.kpn.net)
Date: May 17, 2016 12:09PM

Switched to PHP7, but the CLI is still using 5.6.16, this way i cannot use composer to install packages which require php >= 7. I am using WS 3.0 64 bit

Below my conf.

[php]
phpVersion = "7.0.0"
phpLastKnown = "7.0.0"
phpIniDir = "."
phpConfFile = "php.ini"
phpExeDir = "."

[phpCli]
phpCliVersion = 7.0.0
phpExeFile = php.exe
phpCliFile = php-win.exe

Can someone assist?

Thanks Robbert



Edited 1 time(s). Last edit at 05/17/2016 12:10PM by adiuvo.

Options: ReplyQuote
Re: php7 cli
Posted by: RiggsFolly (Moderator)
Date: May 17, 2016 12:59PM

By default WAMPServer does nothing to associate a specific PHP CLI version.
So a command prompt should not know where/how to find php.exe


Internally it uses a version that comes with the install, so that we know the internal PHP code we test here will run there correctly.


I would guess that you have added one of the PHP version folders to your PATH. You should NEVER add any PHP version folder to your PATH for this very reason


REMOVE any php version from your PATH, come to that NOTHING in WAMPServer requires adding to your PATH!

Instead create yourself a simple bat/cmd file like this, this is the one I use

Here's mine, I call it phppath.cmd

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


set baseWamp=D:\wamp
set defaultPHPver=5.6.15
set composerInstalled=%baseWamp%\composer
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

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=


You call it like this

C:> phppath

and it will use the default php Version

Or like this

C:> phppath 7.0.6

And it will use this Verison of PHP if it exists on your system in the WAMP folder.


This cmd file will add the correct things to your PATH, BUT ONLY FOR the duration of the command window. So to switch version of PHP either open another window and call this with a different parameter or close the windows you were using and open another and call `phppath` with another version of PHP as the parameter

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 3 time(s). Last edit at 05/17/2016 01:02PM by RiggsFolly.

Options: ReplyQuote
Re: php7 cli
Posted by: Otomatic (Moderator)
Date: May 17, 2016 03:11PM

Hi,

There is a way to change the PHP CLI version used with Wampserver.

This version is only used by internal scripts of Wampserver, but I have not tested these scripts always work perfectly with PHP 7.0.1+.
Also, this procedure is at your own risk and I declines all responsibility for any problems that might arise.
- Exit Wampserver
- Update to Wampserver 3.0.4
- Add the PHP version you want to have for CLI
- Vérify that all work fine
- Exit Wampserver

Edit the file wamp/wampmanager.conf to replace phpCliVersion = 5.6.16 with the version number you want to use and save the modified file.
Launch Wampserver and wait for Green icon then exit

Wampserver is now using "your" PHP CLI version.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote


Sorry, only registered users may post in this forum.