Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
tina4:recommendations [2021/03/23 17:54]
barco created
tina4:recommendations [2021/10/28 13:00] (current)
clayton fixed image
Line 16: Line 16:
 Two popular IDEs which support PHP debugging are: Two popular IDEs which support PHP debugging are:
  
-* [Visual Studio Code](https://code.visualstudio.com/download+* [[https://code.visualstudio.com/download|Visual Studio Code]]
-* [PHPStorm](https://www.jetbrains.com/phpstorm/download)+
  
-The most popular PHP debugging extension is [Xdebug](https://xdebug.org/docs/installand we recommend that you get this installed as soon as you have your PHP up +* [[https://www.jetbrains.com/phpstorm/download|PHPStorm]] 
 + 
 +The most popular PHP debugging extension is [[https://xdebug.org/docs/install|Xdebug]] and we recommend that you get this installed as soon as you have your PHP up 
 and running. and running.
  
Line 26: Line 27:
 Follow these instructions to install Xdebug on your system. Follow these instructions to install Xdebug on your system.
  
-==== Step 1 - Download & Install ==== +==== Step 1 - Download & Install  ==== 
-  +=== Windows ===  
-Head to the Xdebug page and download the corresponding version for PHP on your Operating System. For example, in this case the PHP version used is VC15 x64bit Thread Safe 7.4.1. +Head to the Xdebug page and download the corresponding version for PHP on your Operating System. For example, in this case the PHP version used is VC15 x64bit Thread Safe 7.4.1. Click on the Xdebug link 
-             +           
-Here'the link: [[https://xdebug.org/download|Xdebug]] +
- +
-<div align="center" alt="Xdebug Website"> +
-    <img src="images/xdebug.png"> +
-</div> +
 After the download is complete, extract/unpack or copy the file into the "ext" folder found in your PHP directory. (e.g. C:/php/ext)  After the download is complete, extract/unpack or copy the file into the "ext" folder found in your PHP directory. (e.g. C:/php/ext) 
 +
 +You will notice that the Xdebug file is in .dll format and you will need to rename it from "php_xdebug-2.9.6-7.4-vc15-x86_64.dll" to something simple like "php_xdebug.dll".
          
 +=== Linux ===
 + Install xdebug with the following command:
  
-    It is recommended you rename the file (eg. "php_xdebug-2.9.6-7.4-vc15-x86_64.dll" ) to "php_xdebug.dll".+<code bash> 
 + sudo apt install php7.4-xdebug 
 +</code>
  
-<div align="center" alt="Installing Xdebug"+and configure it with: 
-    <img src="images/xdebug1.png"+ 
-</div>+<code bash
 +sudo nano /etc/php/7.4/mods-available/xdebug.ini 
 +</code> 
 + 
 +Add the following code into it: 
 + 
 +<code  ini xebug.ini> 
 +zend_extension=xdebug.so 
 +xdebug.remote_autostart = 1 
 +xdebug.remote_enable = 1 
 +xdebug.remote_handler = dbgp 
 +xdebug.remote_host = 127.0.0.1 
 +xdebug.remote_log = /tmp/xdebug_remote.log 
 +xdebug.remote_mode = req 
 +xdebug.remote_port = 9005 #if you want to change the port you can change  
 +</code 
 + 
 +and then restart the services but running each command individually: 
 + 
 +<code bash> 
 +sudo systemctl restart php7.4-fpm 
 +sudo systemctl restart nginx //If you are using nginx server 
 +sudo systemctl restart apache2 //If you are using apache server 
 +</code>
  
 ==== Step 2 - Configure php.ini ==== ==== Step 2 - Configure php.ini ====
- +Once the file have been extracted, you will need to enable remote debugging by editing the configuration settings file, which will be your **php.ini** file. 
  
-Once the file have been extracted, you will need to enable remote debugging by editing the configuration settings file+Go to your PHP folder and open "php.ini" with Notepad or your IDE tool.
  
-Configure "php.ini" file:+<WRAP info center> 
 +Please ensure that the "php_xdebug.dll" file location is correct. 
 +</WRAP>
  
-<code php> +Add the following in the extensions directory list (HINT: its above Module Settings) and press Ctrl+S or save changes you just made to "php.ini" file
-Go to your PHP folder and open "php.ini" with Notepad or your IDE tool.  + 
-    *Please ensure that the "php_xdebug.dll" file location is correct*  +<code ini php.ini> 
-Add the following in the extensions directory list (HINT: its above Module Settings): +[XDebug] 
-    [XDebug] +zend_extension="C:\php\ext\php_xdebug.dll 
-    zend_extension="C:\php\ext\php_xdebug.dll +xdebug.remote_enable = 1 
-    xdebug.remote_enable = 1 +xdebug.remote_autostart = 1
-    xdebug.remote_autostart = 1 +
-Press Ctrl+S or save changes you just made to "php.ini" file.+
 </code> </code>
  
-<div align="center" alt="Configure php.ini file for Xdebug"> +<WRAP info center
-    <img src="images/xdebug2.png"> +Please note that the configuration settings for Xdebug might be updatedIf so, please visit their site and easily search for the required configuration setting 
-</div>+</WRAP>
  
 ==== Step 3 - Confirm Installation ==== ==== Step 3 - Confirm Installation ====
-Complete the installation by restarting your system so that changes may take effect.After this you can confirm if the installation was a success by opening your command terminal (e.g Command Prompt or terminal in your IDE tool) and typing in "php -m" and pushing Enter. +Complete the installation by restarting your system so that changes may take effect. After this you can confirm if the installation was a success by opening your command terminal (e.g Command Prompt or terminal in your IDE tool) and typing in "php -m" and pushing Enter. 
 This will display all modules loaded in your PHP. At the bottom of the list you should see the "Zend Modules" heading and "Xdebug" will be listed underneath.  This will display all modules loaded in your PHP. At the bottom of the list you should see the "Zend Modules" heading and "Xdebug" will be listed underneath. 
  
-<div align="center" alt="Confirm Successful Xdebug Installation"> +{{  :tina4:xdebug3.png?nolink  }}
-    <img src="images/xdebug3.png"> +
-</div>+
  
 ===== Debugging ===== ===== Debugging =====
Line 79: Line 101:
 the command line to make debugging work. the command line to make debugging work.
  
-<code php>+<code bash>
 XDEBUG_CONFIG="remote_host=127.0.0.1" php -S localhost:7145 index.php XDEBUG_CONFIG="remote_host=127.0.0.1" php -S localhost:7145 index.php
 </code> </code>
  
 On windows you can put the following in the built in PHP web server environment variables On windows you can put the following in the built in PHP web server environment variables
-<code cmd>+<code bash>
 XDEBUG_CONFIG="remote_host=127.0.0.1" XDEBUG_CONFIG="remote_host=127.0.0.1"
 </code> </code>
- 
-Continue to [[/installation/install-php.md|install php]] or go back to [[/installation/install-tina4.md|install tina4]]. 
- 
Powered by ComboStrap