Skip to content

InstallationGuideDebuggingInVSC

tnier01 edited this page Jul 14, 2021 · 1 revision

This page describes how to debug OJS on macOS and Linux. These are individually created instructions. Additionally, programs for PostgreSQL interfaces are suggested for installation.

An alternative to the approach presented here is offered by psysh, a corresponding video for use with OJS can be found here: video.

Installation Guide Xdebug on Visual Code Studio and phpPgAdmin for Linux (Ubuntu 18.04)

Install Xdebug

  1. Install the LAMP stack. For more instructions follow this guide.
  2. Start the apache Server:
sudo service apache2 restart 
  1. Go to http://localhost and check if the Apche Ubuntu Default Page
  2. Go to /var/www/html/ and make a PHP file named test.php with the following content:
<?php
    phpinfo();
?>
  1. Restart the server like in 1. and go to http://localhost/test.php.
  2. Copy the PHP infos.
  3. Go to this site and paste the PHP infos into the first text field. Follow the given guide to install Xdebug.
  4. Restart the apache server and go to http://localhost/test.php and check if there is now a section about Xdebug.
  5. Go to /etc/php/7.4/cli/conf.d and open the 20-xdebug.ini in an editor and these lines:
zend_extension=xdebug.so

xdebug.mode = debug
xdebug.start_with_request = yes
xdebug.client_port = 9000


Install Visual Studio Code(VSC) and Xdebug extension

  1. Install VSC. Follow this guide.
  2. In VSC go to the extensions section and search for the PHP Debug extension. Then install it.
  3. Now go to debug section and choose create a launch.json. Then select PHP. There should now be a .vscode folder in your project.


Start Debugging OJS Plugins

  1. Start your OJS Server.
  2. Set a breakpoint in the plugin code within VSC. And set the debug mode to Listen for Xdebug.
  3. Reload the corresponding page on the localhost.
  4. VSC will open again with the debugging info.


Install phpPgAdmin for PostgreSQL Interface

  1. In the Terminal run the command:
sudo apt-get install phppgadmin 
  1. After the installation run:
a2enconf phppgadmin
service apache2 reload
  1. Go to http://localhost/phppgadmin and interact with your database.


Installation Guide Xdebug on Visual Code Studio and postico for macOS (11.2.2)

Preparation

Install OJS

A detailed description can be found here: Installation Guide OJS

Install VSC

Install Xdebug

  • Open your terminal and type in:
    pecl install xdebug
    
  • A detailed description can be found here: Installation Xdebug
  • Check if Xdebug appears in phpinfo().php
  • open the php.ini e.g. by
    code /usr/local/etc/php/yourPHPVersion/php.ini 
    
    and delete the first line
    zend_extension="xdebug.so"
    
  • open or create the ext-xdebug.ini e.g. by
    code code /usr/local/etc/php/yourPHPVersion/conf.d/ext-xdebug.ini
    
    and add the following lines
    [xdebug] 
    zend_extension="xdebug.so" 
    xdebug.mode = debug 
    xdebug.start_with_request = yes 
    xdebug.client_port = 9000
    

Enable Debugging in VSC

  • Install the felixfbecker.php-debug-extension in VSC
  • Now go to debug section and choose create a launch.json. Then select PHP.


Debugging

  1. Start your OJS Server and your PostgreSQL instance.
  2. Set a breakpoint in the plugin code within VSC.
  3. Set the debug mode to Listen for Xdebug.
  4. Reload the corresponding page on the localhost.
  5. VSC will open again with the debugging info.


Install postico for PostgreSQL Interface

  • interesting tool to get an overview about the OJS database
  • A installation guide can be found here: postico
  • add a favorite in the postico application and insert
    Host: localhost 
    
    User: yourPostgreSQLUsername 
    
    Database: yourOJSPostgreSQLDatabaseName 
    
    These settings should be enough
  • start your database in the terminal
    brew services start postgresql
    
  • Connect in the postico application