A quick guide to configuring PHP in PhpStormWritten by: zacbanas on August 27, 2019
JetBrains makes awesome software, once you learn how to use it it’s very powerful and makes for a great ally in the war against, uhh.. Code?
The problem is, their documentation isn’t the best, and the forums online are more or less always answering a very specific question. It took me way too long configuring PHP in PhpStorm when I first tried. I’m sure a lot of others must have this same issue, so I took the time to document my process.
I won’t be walking you through the downloading and installation process because if you can’t figure that out, there’s not much I can teach you. I will start right after installation, when you come across something similar to this screen
Here we click on “Create New Project”, which brings us to the following screen
Starting your first test server!
Now, lets download a tool called XAMPP. This means that you can write code in PHP and open it up in your browser of choice with PhpStorm. So I want you to visit the XAMPP download page and select your OS and once again I can’t really teach you how to download things…
So you should see this page
Go through the installer, and accept all of the default settings, and once you get to the end, click run XAMPP Control Panel. You will see this window
Upon completion of the installation, start up Apache and MySQL. Don’t worry if your Control Panel looks a little bit different, as long as you can start Apache and MySql.
Your test server is officially running. Congratulations, you’re a real genius. At this point, running your code in PhpStorm will produce a “Bad Gateway” error. This means you don’t have your PHP configured on PhpStorm, which means it has no clue what you’re saying. Computers need programs called interpreters to read code to them, and interpret what you’re trying to do into lower-level languages.
Finishing the job!
So now you need to point your PhpStorm to the php.exe file in your XAMPP folder, which if you listened to me and are on Windows, should be located at c:\XAMPP. If the XAMPP folder is not there, you need to find it and follow the rest of this tutorial with the proper path in mind.
We are going to bring up our PhpStorm again and click on the three dots next to the entry field “CLI Interpreter”
In the next window you will be navigating to xampp>php>php.exe and it will look something like this
First you will navigate to xampp under C:\
Then you will find PHP, and about halfway through that file is php.exe.
Click “OK” and then you will click apply on the remaining window. Now you are able to run your PHP code on a localhost! Congratulations, you’re seriously brilliant.
If you have any comments or questions about configuring PHP in PhpStorm please don’t hesitate to give me a holler at firstname.lastname@example.org. I would be glad to hear from ya!
[likebtn theme=”greenred” counter_type=”percent”]
Let’s be honest, you have no idea what Web Dependencies are. Check out this post to learn all about them.