Xdebug - PHPStorm - Ubuntu: How to configure Xdebug on Ubuntu for PHPStorm
For this illustration we are using PHP7.3
Find the path of your PHP ini files by opening the console and running following command:
In your root folder create a new file using following command and generate Phpinfo file:
Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands:
Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d"
Now in your PHPStorm perform below steps:
You can validate your Xdebug installation with PHP using below steps:
You can validate your Xdebug settings for PHPStorm with below steps:
In order to run Xdebug do following settings in your PHPStorm:
Picture Source: pexels.com
php --ini
In your root folder create a new file using following command and generate Phpinfo file:
sudo vi phpinfo.php
Now in your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard This will give you the download link to xdebug. Now open your console and run below commands:
Check the path against "Scan the additional .ini files in". In most cases the path would look something like "/usr/local/etc/php/7.3/conf.d"
sudo vi /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini
Now in your PHPStorm perform below steps:
- Click on PHPStorm > Preferences > Languages & Frameworks > PHP > Debug
- Under Xdebug > Change "Debug Port" to "9001" and select "Can accept external connections
- Click on Apply
You can validate your Xdebug installation with PHP using below steps:
- In your browser run: http://localhost/phpinfo.php . Copy the entire output from this page and paste it into https://xdebug.org/wizard
- This should give you the message "You're already running the latest Xdebug version"
You can validate your Xdebug settings for PHPStorm with below steps:
- Navigate to PHPStorm > Preferences > Languages & Frameworks > PHP > Debug
- Under Pre-Configuration > Click on Validate debugger configuration on the Web Server
- Select Local Web Server or Shared Folder
- Under "Path to create validation script" add path to your Project's Root Directory
- Under "URL to validation script" add your localhost URL or URL to your project home-page
- Click on Validate
In order to run Xdebug do following settings in your PHPStorm:
- Navigate to PHPStorm > Run > Edit Configurations
- Click on "+" symbol at top left of the window and select "PHP Remote Debug" from the drop-down list
- In the right-hand pane add the name of your Xdebug profile. For example "My Remote Debug"
- In the right-hand pane Under configuration tab select "Filter debug connection by IDE Key"
- Click on "..." near Server and add your project settings (Name: Project Name, Host: Your project's localhost URL - example.local, Port: 80, Debugger: Xdebug) and click on Apply
- Add "PHPSTORM" against IDE key(sessiod id)
- Click on Apply
Picture Source: pexels.com
Comments
Post a Comment