PHP Storm CLI Interpreter

HI, I have PHP Storm with XAMPP 8.03 which comes with PHP 8.0.3, hence PHP Language i use is version 8 with CLI Interpreter 8.0.3 . All is running fine, but i need to use PHP 7.2

I suppose it is not clever to chose PHP 7.2 and keep on using the same CLI Interpreter. That is why i downloaded (php-7.2.34-nts-Win32-VC15-x64) and added it to the XAMPP folder to chose the 7.2 php.exe for PHP Storm CLI Interpreter. Unfortunately it does not work. I copied the php.ini from the PHP 8.0.3 folder. 

Can you please give me a hint where to touch. Also, generally is the Interpreter supposed to be same version as PHP and since that works how wrong could it be.

0

Hi there,

You cannot really just copy php.ini between the versions -- they will have certain differences in the config: different values; point to different folders etc. Although it may work in general/to a some degree (excluding version specific paths/extensions).

I suggest you make a copy of "php.ini-development" from PHP 7.2 folder, name it "php.ini" and then compare with the current one from PHP 8 (use you diff viewer app and make the needed changes as you scroll-compare them). That's what I do when installing a new PHP version.

 

In terms of the IDE: you can use PhpStorm without PHP Interpreter just fine, as long as you will not use any tools that needs it (e.g. using Composer from IDE, run PHPUnit tests, CodeSniffer and alike, local PHP execution/debug in CLI)

You can have PHP 8 interpreter and have PHP Language Level set to 7.2 at the same time: it's OK for the IDE. But the code will still be executed with PHP 8 and in some aspects it may work differently (deprecated functionality, new stuff etc). So it's definitely a good idea to use the same PHP version where your code will actually be running.

 

Unfortunately it does not work.

What exactly does not work: the PHP itself (does not load/shows errors), Apache from XAMPP (if you are trying to use it for serving your web pages) .. or something in PhpStorm itself?

Just in case:

1. Apache generally needs TS version of PHP (while IIS has to use NTS).

2. Platform/bitness (x86 vs x64) may also play a role here (depends on XAMPP) so you better use the same as PHP 8

3. Ensure you have PHP error_log and display_startup_errors configured -- to see any possible startup errors

4. Make sure that PHP works in console first ("php -v" at very least) before trying it elsewhere (PhpStorm / XAMPP)

1

请先登录再写评论。