How to specify a Run Configuration to DEPLOY and RUN on LOCAL Web Server supporting PHP (like apache)

STEP 1: DEPLOYING : Assumes you have previously setup PHPStorm with local web server installed

FIRST- if you already setup (step 3 of PHPStorm setup) you can deploy directy to local Apache server and run it manually by going to

a browser and typing in correct URL http://localhost/whatever.php (or add directories in path as appropriate)

 

Tools->Deployment->Upload To and select the local server you created in step 3 of the PHP storm setup

 

Now you can see it is deployed the HelloWorld.php file I selected (I could have deployed the entire project or src directory --up to you to decide)

 

 

 

STEP2: Option 1 running Manually

After deployment --- NOW I can run it by going to Browser and typing in the URL. You should GO to a browser you do not have XDebug plugin configured inside of -- I typically have debug plug in for chrome and none for Microsoft Edge

 

  • HelloWorld.php file
    
    <?php
    print "hi <br>"; print "hi2 <br>";
    /**
    * Created by PhpStorm.
    * User: Lynne
    * Date: 3/23/2015
    * Time: 8:15 PM
    */
    ?>

STEP2: Option 2 running using Run Configuration

Next, go to Run->Edit Configurations & select + to add a new configuration and select PHP Web Application

special note: Make sure that PHPStorm is the only JetBrains IDE up (sometimes there can be a conflict with ports) and that you have your Apache server running and listening on port 80

 

Next, you enter in the path to the file you want to run locally

 

 

Now select Run->Run and select the configuration just added

Here is the results--it pops up the browser and runs the code

  • HelloWorld.php file
    
    <?php
    print "hi\n <br>";
    print "hi2 <br>"
    print "hi3 <br>";
    $a = 3;

    print $a;
    /**
    ?>

 

 

 

STEP2: Option 3 running in Debug mode --this assumes you are using the XDebug tool that comes downloaded as part of AMPPS

special note: Make sure that PHPStorm is the only JetBrains IDE up (sometimes there can be a conflict with ports) and that you have your Apache server running and listening on port 80

 

SPECIAL NOTE: Once you set this up for a browser it means it will run it in debug mode always even if you choose option 2 above

ONE TIME SETUP OF PLUGGIN for BROWSER: --this is needed so can communicate with PhpStorm

Choose a browser that you must configure to have a Debug pluggin for. I suggest doing this for Chrome and choose the XDebug extension:

 

STEP A install in Chrome the Xdebug helper and install it

 

STEP B go to Chrome Settings Extensions and make sure the IDE is set to PHPSTORM (Chrome ->Settings->More Tools->Extensions AND then choose Details for Xbug Helper and set the IDE value)



One time setup of php.ini file inside your Apache server to support XDebug.....I will assume you downloaded AMPPS server (includes Apache and the XDebug code you need)

 

Inside php.ini (located in your AMPPS folder ---for my version it is in Ampps/conf/php-5.6.ini --- depending on the version of Ampps you install the location of hte php.ini file will be different) ADD the following ALSO the path php-5.6 may be different depending on the default php installed with AMPPS.

;Xdebug
zend_extension="{$path}\php-5.6\lib\php_xdebug.dll"
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM
xdebug.remote_log = "{$path}\tmp\xdebug.log"
xdebug.remote_enable=1

One time setup of PHPStorm (for each project) -- Tools->Settings->Language&Frameworks->PHP->Debug

 

AND the Debug DBGp Proxy settings

 

 

 

 

Using The previously setup "Web Application Run Configuration"AND run it under debug (Run->Debug or hit Debug
button

 

  • FIRST - NOTICE when you run the code it pops up the file that is ON the local Apache webserver.
  • IT IS IN THIS FILE (not the one that is part of your PHPStorm project) that you set the breakpoints on

 

 

© Lynne Grewe