Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting up a PHP interpreter in PhpStorm [closed]

Tags:

php

phpstorm

I am a beginner in web development and am having trouble trying to figure out how to set up a CLI interpreter for PHP. I don't know what to do to set up an interpreter and the JetBrains tutorials seem to assume that I already have available interpreters.

I have previously used AWS to make websites, but I am switching to PHPStorm because my free trial has ended. From uses AWS, I did not need anything additional to run my PHP files, so now that I am using PHPStorm, I am confused by all these extra steps I need to run a PHP file. I am essentially confused with what an interpreter is, how to set it up, and how to view my webpage on my local server.

I also don't understand what the CLI is. I read it stands for Command Line Interpreter, but I don't know if that is any different than a regular interpreter.

I've read things like WAMP and XAMPP, but I don't know what they mean. I have Windows 10.

like image 362
titooooo27 Avatar asked Jun 17 '26 07:06

titooooo27


1 Answers

To download & install the PHP Interpreter and use it in PHPStorm :

1. Visual C++ Redistributable

  1. Make sure you've installed Visual C++ Redistributable for Visual Studio 2015-2019 : x64 or x86

2. PHP Interpreter (CLI)

  1. Download the last version of the PHP interpreter (current: 2020-Apr-14 / PHP 7.4.5) at https://windows.php.net/download
  2. There you've to choose between Non Thread Safe (NTS) and Thread Safe (TS) versions.

    • If you are using PHP as FastCGI with IIS you should use the Non-Thread Safe (NTS) versions.
    • Otherwise proceed to download the Thread Safe (TS) version.
  3. Click the "Zip" link that suit your processor architecture (x64 for 64bit, x86 for 32bit or lower).

  4. After the downloading the file, extract the .zip archive in the directory of your choice (for example, in C:\php\)

  5. Open the directory you just extracted, you will see bunch of directories (dev, ext, lib, ...), DLL files and executables. Spot the php.exe, that's our PHP interpreter :)

3. Configure PHPStorm interpreter

  1. In PHPStorm, go to "File" menu (Windows), then Settings (Ctrl+Alt+S).
  2. Go to "Languages & Frameworks", then click on "PHP".
  3. Click the ... button from the "CLI Interpret" field.
  4. Add a new interpreter by clicking the + button.
  5. Here, provide the PHP Executable path to the php.exe we've spotted earlier (eg.: C:\php\%currentPhpVersionDir%\php.exe).

    If done correctly, PHPStorm will display the PHP version & the path to the configuration file (php.ini).

That's all for linking PHPStorm to a PHP interpreter in itself.

like image 100
Adri1 Avatar answered Jun 19 '26 22:06

Adri1



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!