Get 15% off Mageplaza extensions & subscriptions! Use code HIMAY at checkout.

How to Create A Non-cacheable Block in Magento 2

Vinh Jacker | 05-02-2024

The Most Popular Extension Builder for Magento 2

With a big catalog of 224+ extensions for your online store

Xdebug is a PHP extension that offers many debugging and profiling features to support developers in troubleshooting and optimizing their PHP code. These features include code coverage, stack traces, profiling information, and many other capabilities.

In this article, we will walk you through how to set up Xdebug in PhpStorm to enhance your development process. Let’s dive in!

Step 1: Install the Xdebug module into PHP

Firstly, you need to ensure that PHP is installed on the system. If not, you can install it based on your operating system. For example, on Ubuntu, you can use:

sudo apt update
sudo apt install php8.3

Then, install the Xdebug extension compatible with your PHP version. You can use the following command:

sudo apt-get install php{php_version}-xdebug

Ex: sudo apt-get install php8.3-xdebug

To check your Xdebug run this command php -v

Check Xdebug

You will see the Xdebug with that version.

Step 2: Configure Xdebug in xdebug.ini

Open xdebug.ini file to edit

You can use either of the following commands:

sudo gedit /etc/php/8.3/mods-available/xdebug.ini
sudo nano /etc/php/8.3/mods-available/xdebug.ini

Copy and paste this content to this file

Add the following Configuration for Xdebug 3:

xdebug.client_port=9000 #run on port 9000

For Xdebug 2, use the following configuration:

xdebug.remote_autostart = 1
xdebug.remote_enable = 1
xdebug.remote_handler = dbgp
xdebug.remote_host =
xdebug.remote_log = /tmp/xdebug_remote.log
xdebug.remote_mode = req
xdebug.remote_port = 9000  #run on port 9000

  • Save and close the file

  • Restart apache:

sudo service apache2 restart

Step 3: Configure PhpStorm

Configure PhpStorm

  • Open PhpStorm > Navigate to settings > select PHP

  • Go to Debug in the top left corner > set the Debug port to 9000 as specified in the xdebug.ini

Debug port Turn on listening at the configured port by clicking on the call icon

Php Debug connections

Step 4: Install the Xdebug Chrome extension

To enable Xdebug for the browser, you need to install the Xdebug Chrome extension, follow these steps to install the extension.

Xdebug chrome extension

  • In the browser, Go to Option > set the IDE KEY to PHPSTORM

IDE key

  • Then, on the Magento Site, start the session of Xdebug by enabling the Chrome extension

Magento site

  • After that, refresh your Magento site and check your PHPStorm

Check Phpstorm

  • Click accept

  • Go to Setting of PHP > servers, uncheck the option specified in the text

Setting of PHP

  • Click Ok

  • Lastly, refresh your Site in the browser

Refresh the site in the browser

That is all the steps! Now you can try using keyboard shortcuts like F9, F8, F7,.. or check the variable in PhpStorm

Final Word

We hope that our blog has given you a clear understanding of how to set up Xdebug in PhpStorm. Just follow the step-by-step guide above, and you will succeed. If you encounter any challenges or have any questions, don’t hesitate to contact us.


Hello, I'm the Chief Technology Officer of Mageplaza, and I am thrilled to share my story with you. My deep love and passion for technology have fueled my journey as a professional coder and an ultra-marathon runner. Over the past decade, I have accumulated extensive experience and honed my expertise in PHP development.

Related Post

Website Support & Maintenance Services

mageplaza services

Make sure your store is not only in good shape but also thriving with a professional team yet at an affordable price.