How do you run Wordpress with Phpstorm?

I've googled this to the point of fatigue. I feel I've seen it all, read it all, tried it all.

I'm just trying to learn a usable workflow with those two things. I have a local XAMPP with an entire WP installation and I'm developing a theme. I can run it off XAMPP perfectly and use Phpstorm as a mere code editor and keep manually refreshing the browser to see the changes.

Yet I can't use Phpstorm to debug it, or run it in anyway. Not to mention using LiveEdit to speed up the layout work.

I have the interpreter set:
http://i.imgur.com/KAgRwIH.png

The WP support activated too (I downloaded the new Phpstorm 8 just to solve my WP problems but not even then):
http://i.imgur.com/sZl3luh.png
The deployment (connection, mappings etc), directories and so on are all set. I've tried different combinations too, but nothing.

The whole WP codebase is within the project, I can even control-click stuff correctly from this very simple theme's index.php:
http://i.imgur.com/BU513be.png

Yet every time I try to run my theme's index I get this in the browser:

Fatal error: Call to undefined function get_header() in C:\blabla\wp-content\themes\blabla\index.php on line 2


I don't have however have XDebug installed, is it a must?

I don't get why within the code editor it understands the whole WP thing but when it runs it only runs that index.php on its own.

If I try to run WP's main index, I get my website but it's doing it off my XAMPP directly so no debugging possible, no LiveEdit.

1) What am I doing wrong?
2) How do you work with WP theme dev? What's your workflow when developing a WP theme?

Thanks!

9 comments
Comment actions Permalink

Hi there,

Please describe in details (preferably with screenshots) how you "run" the page from PhpStorm.

Yet every time I try to run my theme's index I get this in the browser:

Why do you run your theme's index.php file directly? Where WordPress' own code will be loaded from?

You should run your main index.php which will call your theme as configured in WP.

I don't have however have XDebug installed, is it a must?

If you want to debug in IDE (using xdebug) -- "Yes".

If you do not want to debug in IDE .. or prefer Zend Debugger -- then "No".

If I try to run WP's main index, I get my website but it's doing it off my XAMPP directly so no debugging possible

1) How do you plan to debug it if you do not have debugger extension installed?
2) So what that it will be run by your XAMPP directly? -- it makes very little difference.

Webinar Recording: Debugging PHP with PhpStorm
https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm

0
Comment actions Permalink

Hi there,

Please describe in details (preferably with screenshots) how you "run" the page from PhpStorm.


Well, I can do all those screenshots but I have tried all options: all clickable items from the Run menu, right click to a file and anything that reads "run" or "debug" etc.

Why do you run your theme's index.php file directly? Where WordPress' own code will be loaded from?

Well that's the thing, I thought "wordpress support" meant exactly that. I was under the impression Phpstorm would load whatever was needed (that's why I was being asked to link WP libraries/directories in the first place right?), but I guess no.

1) How do you plan to debug it if you do not have debugger extension installed? 

I thought Phpstorm would have its own PHP debugger. I ended up installing XDebug, which is awful to install and use but oh well.

How do you develop WP themes (XAMPP?) ? What do you do with the database? How do you iterate the trial and error process? How do you CSS the whole thing?

Thanks buddy.

0
Comment actions Permalink

Bump! Andriy I know you want to help me further :^O

0
Comment actions Permalink

I'm not a WordPress user -- I cannot give you any WP-specific advices.

I've dealt with it only once to fix small things (why this plugin stopped working after WP upgrade; fix few spelling mistakes/replace text with slightly different wording and change colors for few elements in existing style) -- that's it -- dealt with it as with plain PHP/CSS.

Well, I can do all those screenshots but I have tried all options: all clickable items from the Run menu, right click to a file and anything that reads "run" or "debug" etc.

"Run | Edit Configurations..." (or via corresponding drop-down box on tool bar) and create an entry of most appropriate type -- most likely it would be "PHP Web Application". Point it to your desired URL and now you will be able to use Run/Debug buttons on toolbar to launch this config.

I was under the impression Phpstorm would load whatever was needed (that's why I was being asked to link WP libraries/directories in the first place right?), but I guess no.

Yes -- it's not what is included. Plugin adds support for WP-specific code navigation, creation and completion mainly.

http://blog.jetbrains.com/phpstorm/2014/03/wordpress-support-in-phpstorm-8-eap/

0
Comment actions Permalink

I'd be happy if I could just use phpStorm to edit files on my website as easily as I can with Notepad ++.  That's a rhetorical comment. Found the forums today to look around to see if this is money well spent or just another well intended IDE that doesn't work for me.

0
Comment actions Permalink

PhpStorm is the best editor I've used so far. I am really glad that I decided to purchase it.

0
Comment actions Permalink

Two things:

  1. You need to setup a run configuration so it will do something when you hit the run/debug button. You configure you server and mappings here.
  2. You won't be able to run from the theme index, you need to run from the main index. (Already said but I thought I'd say it again, :| )
0
Comment actions Permalink

Well, then I have to say that developing for WP with this workflow just sucks. It's awkward, slow and feels bloated.

And I don't mean only because of Phpstorm, I'm used to it and I like it a lot for a lot of uses, but WP theme development? No way. I don't think there's a better workflow out there but saying phpstorm comes with wordpress support is an overstatement IMO.

For the guy that was asking about buying phpstorm, I think it's worth the money. But like many other things, you have to learn it well, wether it's phpstorm or other IDE or notepad++. You must study it and it will become your ally.

For frontend work (basically html + css) I haven't found anything that beats Adobe Brackets. They all suck, phpstorm the first one to suck at frontend...

0
Comment actions Permalink

I seem to have come to the right place before buying PHPStorm... It seems to be way too complicated to use with WordPress.

I tried setting up everything and I still get error on files location and such... I will start my own thread but good thing I found yours.

Cheers

0

Please sign in to leave a comment.