1

I have just installed fresh PhpStorm on Mac. I set my interpreter and so on. I can create .php files. But when I run it runs only JavaScript and there is no option to run php? How can I fix this?

Run 'filename.php (JavaScript...)'

Same with debug. How this can be fixed?

3
  • Have you created a run configuration for PHP? Commented Nov 6, 2018 at 21:40
  • @Don'tPanic sorry but how do i do that? Commented Nov 6, 2018 at 21:48
  • 3
    Go to Run->Edit Configurations... and add a configuration for PHP. There are some templates there you can work from. Commented Nov 6, 2018 at 22:04

2 Answers 2

1

It seems you've configured PhpStorm to handle files with .php extension as JavaScript code rather than PHP.

Open the settings dialog (File/ Settings), head to Editor/ File Types and review the Recognized File Types section:

  • Remove *.php from JavaScript.
  • Make sure that PHP contains *.php.
  • Remove any other unwanted registered pattern, such as filename.php.
Sign up to request clarification or add additional context in comments.

Comments

0

I had a similar issue on PhpStorm 2023.3.8

Turned out that I've marked the directory as excluded. When I removed the exclusion the option to run the file as PHP was visible again.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.