• Skip to main content

Victor Font Consulting Group, LLC

Digital Business Strategists

Call Us Toll Free:

1-844-VIC-FONT (842-3668)

  • Home
  • Care Plans
    • Care Articles
    • Optional Subscriptions
  • Consultations
  • Products
    • Code Snippets
    • Public GitHub Repositories
    • Gist Snippets
    • Pastebin Snippets (Free)
    • Free Plugins
  • FAQs
  • Support
    • Graphic Design
  • Our Team
    • Contact
    • Speakers
    • Portfolio
  • Resources
    • Free WordPress Video Training
    • Tutorials
    • Articles
    • Cybersecurity
    • EU Referral Network
You are here: Home / Code Snippet / PHPStorm and XDEBUG Configuration

PHPStorm and XDEBUG Configuration

By Victor M. Font Jr.
May 6, 2014Leave a Comment

Contents
  • Xdebug Configuration
  • PHPStorm Configuration
  • Google Chrome
  • Port Forwarding
php
Image Courtesy of http://efffective.com

PHPStorm by JetBrains is considered by many to be one of the best integrated development environments (IDEs) available for PHP. PHP is a server-side scripting language primarily designed for web development, but it is also used as a general-purpose programming language. It's estimated that as of January 2013, PHP was installed on more than 240 million websites and 2.1 million web servers. The very popular WordPress platform is built upon PHP. Originally, the acronym PHP stood for Personal Home Page, but it has since been redefined and now stands for PHP: Hypertext Preprocessor, a recursive backronym.

While PHPStorm is an excellent product and highly recommended, it's documentation falls short. As an author of quite a few books, I may be overly critical of technical documentation. I like simple to understand directions.

Recently, I've been working on a few projects for Blue Olive Strategic Solutions out of Florence, Alabama. Blue Olive is an award–winning advertising agency made up of talented industry professionals with diversified backgrounds and significant expertise in social marketing, logo design, graphic design and website design and development. One of these projects is a home-grown PHP application the agency depends upon for scheduling, task management, and billing. It was written over 7 years ago for a very early version of PHP and has not been maintained since the original developer parted the company. I was asked to bring the application up to current standards and migrate it to a new server. After several weeks and over 1,000 changes, I had the application working well on my MacBook Pro, which I use for development. Of course, when I moved all of the source code to the new server, it doesn't work and I found that I had to setup my PHPStorm to work with XDEBUG on the remote server. It took me a day and much trial and error before I got everything working, so I thought I'd share what I learned.

There is a lot of information on the web about getting PHPStorm to work with XDEBUG in your local environment, but when it comes to a remote server, the documentation and available tutorials are lacking. In fact, many of the tutorials I looked at call “localhost" a remote server, which it is not. The remote server I'm working with is a Virtual Private Server (VPS) setup in the Amazon cloud. It is running Ubuntu 14.04 LTS. If you're running a different Linux distribution, these instructions may or may not work for you. All I can say, is try. You have nothing to lose.

Xdebug Configuration

The first thing we're going to do is setup the Xdebug configuration. The Xdebug configuration is either inside php.ini or in another ini file often called xdebug.ini. On the Ubuntu server, the xdebug.ini file is found in the /etc/php5/mods-available directory. There is also a symbolic link to this file in the /etc/php5/apache2/conf.d directory. The contents of the xdebug.ini file are:

After making these changes, restart Apache. In Ubuntu, the command is “service apache2 restart."

PHPStorm Configuration

The most important thing to do with PHPStorm is to make sure the Debug port is set to the same port you designated in your Xdegug.ini file. To set the PHPStorm Xdebug port, go to the preferences file and select PHP/Debug, then follow the example as in the image below:

PHPStorm Debug

Google Chrome

I've found that PHPStorm works best with Chrome when debugging. Chrome needs the Xdebug helper extension to connect to Xdebug for PHP and the JetBrains IDE Support extension to connect to PHPStorm for HTML and JavaScript. Both of those are pretty straight forward to setup. The only configuration needed is to set the session ID for Xdebug Helper to PHPStorm.

Xdebug Helper Config

Note: PHPStorm can only connect to one port for Xdebug. This means that every time we change a site from the default port, the IDE needs to be reconfigured.

Port Forwarding

In order for the Xdebug connection to reach your development box, you need to make certain the Xdebug port is forwarded from your router to your development machine. Each router is different and you should consult your router's documentation to determine exactly how to forward ports. As a representative example, my router is an ASUS RT-AC66R. The following screen print demonstrates how port forwarding works in my setup.

ASUS RT-AC66 Port Forwarding

Note: Port forwarding only works if you assign a static IP address to your development machine.

  • 8shares
  • Facebook0
  • Twitter0
  • Pinterest0
  • LinkedIn8
  • Print
  • SMS0

About Victor M. Font Jr.

Victor M. Font Jr. is an award winning author, entrepreneur, and Senior IT Executive. A Founding Board Member of the North Carolina Executive Roundtable, he has served on the Board of Advisors, of the North Carolina Technology Association, the International Institute of Business Analysis, Association of Information Technology Professionals, Toastmasters International, and the North Carolina Commission for Mental Health, Developmental Disabilities, and Substance Abuse Services. He is author of several books including The Ultimate Guide to the SDLC and Winning With WordPress Basics, and Cybersecurity.

Reader Interactions

VictorFont.com runs on the Genesis Framework

Genesis FrameworkThe Genesis Framework empowers you to quickly and easily build incredible websites with WordPress. Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go.

Check out the incredible features and the selection of designs. It's that simple—start using Genesis now!

Click here to download The Genesis Guide for Absolute Beginners (PDF - 1.4 MB)

Leave a Reply Cancel reply

Your email address and website will not be published. Required fields are marked *
Posting a comment means that you agree with and accept our Comment & Product Review Policy

Toll free: 844-VIC-FONT (844.842.3668)

Send us an E-mail Fax: 919.205.4446

Accessibility Statement | Affiliate Marketing Disclosure | Capability Statement

Cookie Policy | Comment & Product Review Policy | Privacy Policy | Site Map | Terms & Conditions

Copyright © 2003–2021 Victor M. Font Jr.

Return to top of page
Cover image: 5 Things You Can Fix On Your Website In The Next Week To Increase Engagement

Attract New Customers Automatically for Free!

  • Learn how to use the Internet to attract REAL clients
  • Avoid the 3 big mistakes EVERYBODY makes
  • Put this system on AUTOPILOT with the tools the Pros use!

GET YOUR COPY!

This little ebook has helped hundreds of business professionals get real results.
Now it's your turn!

ebook lead capture
Privacy Policy
{"cookieName":"wBounce","isAggressive":false,"isSitewide":true,"hesitation":"","openAnimation":false,"exitAnimation":false,"timer":"","sensitivity":"","cookieExpire":"7","cookieDomain":"","autoFire":"","isAnalyticsEnabled":false}
We only use analytical cookies on our website that allow us to recognize and count the number of visitors, but they do not identify you individually. They help us to improve the way our website works. By clicking Accept you, agree to cookies being used in accordance with our Cookie Policy.OkNoCookie policy