Project

General

Profile

DataPortalDeveloperEnvironmentSetupLinux » History » Version 42

« Previous - Version 42/82 (diff) - Next » - Current version
Andreas Kohlbecker, 04/25/2018 03:06 PM


Local dataportal development and test environment on Debian based Linux

Install PHP packages

sudo apt-get install php libapache2-mod-php php-cli php-common php-curl php-gd php-mcrypt php-mysql php-xdebug php-json php-xml php-mbstring

Restart apache

sudo service apache2 restart 

Local data portal installation

  1. get latest drupal from http://cybertaxonomy.eu/download/dataportal/stable/ (drupal7-cdm_dataportal-x.x.x.tar.gz)
  2. extract to /var/www

NOTE: It would be better to install it in sub folder of ~/@, e.g. @~/workspaces/www/drupal7-cdm_dataportal@, this however would involve that you modify the @/etc/apache2/sites-available/default accordingly.

  1. Go to /var/www/drupal/sites/all
  2. delete /themes
  3. insert symlink to checked out themes from svn (http://dev.e-taxonomy.eu/svn/trunk/drupal/7.x/themes/)
sudo ln -s /path/to/svn/drupal/7.x/themes/ themes
  1. delete /modules/cdm_dataportal
  2. insert symlink to checked out cdm_dataportal modules from svn (http://dev.e-taxonomy.eu/svn/trunk/drupal/7.x/modules)
sudo ln -s /path/to/svn/drupal/7.x/modules/cdm_dataportal/ modules/cdm_dataportal
  1. Go to /var/www/drupal/profiles
  2. delete /CDM_DataPortal and CDM_DataPortal_Testing
  3. insert symlink to checked out profiles from svn (http://dev.e-taxonomy.eu/svn/trunk/drupal/7.x/modules/cdm_dataportal/profile/)
sudo ln -s /path/to/svn/drupal/7.x/modules/cdm_dataportal/profile/CDM_Portal/ CDM_Portal
sudo ln -s /path/to/svn/drupal/7.x/modules/cdm_dataportal/profile/CDM_Portal_Testing/ CDM_Portal_Testing
  1. change ownership of drupal folder to www-data
 sudo chown -R www-data:www-data /var/www/drupal/. <-- not sure what ownership is necessary but this works
  1. Create database as root:

newSite

if you're not logged in to mysql as root then also:

 GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON newSite.* TO 'username'@'localhost';
  1. got to localhost/drupal/install.php

NOTE: If you are having problems with the graphical installer ("page not found" after installation) you may consider editing /var/www/drupal7-cdm_dataportal/sites/default/settings.php with the following and repeat all the steps above

 $databases = array();
 $databases['default']['default'] = array(
     'driver' => 'mysql',
     'database' => 'new_site',
     'username' => 'user',
     'password' => 'pass',
     'host' => 'localhost',
     'prefix' => '',
  );

NOTE: If you see this message "Multibyte string input conversion in PHP is active and must be disabled" then add the following to your mbstring.ini or php.ini file

mbstring.http_input = pass ;
mbstring.http_output = pass ;

Starting local CDM server from workspace

Requirements:

  1. In your run configurations you will find two Jetty Webapp launch configs ("cdmlib-remote-webapp - run" and "cdmlib-remote-webapp - profile")
  • "cdmlib-remote-webapp - run" will start the local CDM server
  • if you don't have anything configured yet the following output explains how to configure the CDM data bases for the CDM server
2014-04-15 13:41:08,244 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - property {cdm.datasource} not found.
2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - --> This property can be set in two ways:
2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - -->       1. as attribute to the ServletContext
2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - -->       2. as system property e.g. -Dcdm.datasource
2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - -->       3. in ~/.cdmLibrary/cdmlib-remote.properties
2014-04-15 13:41:08,245 ERROR [eu.etaxonomy.cdm.remote.config.AbstractWebApplicationConfigurer] - Stopping application ...
  1. For the second option add a data source bean to your /home/user/.cdmLibrary/datasources.xml (<- create file if it does not exist) as follows (do NOT confuse with @/home/user/cdmLibrary/writableResources/cdm.datasources.xml@):
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">

<bean id="cdmDB"  lazy-init="true" class="com.mchange.v2.c3p0.ComboPooledDataSource">
        <property name="driverClass" value="com.mysql.jdbc.Driver"/>
        <property name="user" value="user"/>
        <property name="password" value="password"/>
        <property name="jdbcUrl" value="jdbc:mysql://localhost/cdmDB?autoReconnect=true&amp;autoReconnectForPools=true&amp;"/>
    </bean>

</beans>
  1. In your "cdmlib-remote-webapp - run" launch configuration add to VM arguments:
-Dcdm.datasource=cdmDB
  1. To connect the data portal to your local CDM server add the following to Home -> Administration -> Configuration -> CDM Dataportal and choose your classification
http://localhost:8080/

Xdebug

install Xdebug:

pecl install xdebug

at the end of the install log, pecl shows something like:

Build process completed successfully
Installing '/usr/lib/php/20151012/xdebug.so'
install ok: channel://pecl.php.net/xdebug-2.6.0
configuration option "php_ini" is not set to php.ini location
You should add "zend_extension=/usr/lib/php/20151012/xdebug.so" to php.ini

add xdebug to the php.ini: /etc/php/7.0/apache2/php.ini Use the xdebug.so location from the pecl output.

zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.idekey=PHPSTORM
xdebug.remote_enable=1
xdebug.remote_port=9008
service apache2 reload

Setup of PhpStorm

Workspace setup

Add Drupal code base to External libraries

open the external libraries configuration:

Setup the paths:

PhpStorm configuration to use Xdebug

Add a remote debug configuration to the localhost

This is the server configuration

install the Firefox extension Xdebug helper

make sure the extension is configured to use the api-key PHPSTORM:

Project setup

deployment_connection

deployment_mappingpng

Setup of the PDT project in eclipse

PDT is no longer recommended, use PhpStorm instead!

PDT launch configuration for Drupal projects

NOTE: Default debug port is 9000.

If the eclipse progress bar stops at 57% with the message "Waiting for the XDebug Session" check if xdebug.remote_enable=on is set in your php.ini (or xdebug.ini)

To see where the ini files are located type

php --ini

You may also look here for other troubleshooting: https://stackoverflow.com/questions/9534302/waiting-for-the-xdebug-session-57-in-eclipse-pdt

directories.png View (77.2 KB) Patrick Plitzner, 06/24/2014 12:56 PM

php_servers.png View (85 KB) Patrick Plitzner, 06/24/2014 12:56 PM

deployment_connection.png View (67.6 KB) Patrick Plitzner, 06/24/2014 12:56 PM

deployment_mapping.png View (74.2 KB) Patrick Plitzner, 06/24/2014 12:56 PM

Xdebug-helper-configuration.png View (17.2 KB) Andreas Kohlbecker, 02/15/2018 12:50 PM

phpstorm-remote-debug-config.png View (58.5 KB) Andreas Kohlbecker, 02/15/2018 12:54 PM

phpstrom-server-config.png View (27.3 KB) Andreas Kohlbecker, 02/15/2018 12:55 PM

phpstorm-external-libraries.png View (60.2 KB) Andreas Kohlbecker, 04/25/2018 03:02 PM

phpstorm-external-libraries-open.png View (40.8 KB) Andreas Kohlbecker, 04/25/2018 03:06 PM

phpstorm-validate-debugger-configuration.png View (49.3 KB) Andreas Kohlbecker, 06/08/2018 12:04 PM

phpstorm-settings-directories.png View (66.5 KB) Andreas Kohlbecker, 06/08/2018 01:21 PM

info.php View (26 Bytes) Andreas Kohlbecker, 09/12/2018 01:21 PM

sites-debug.php View (46 Bytes) Andreas Kohlbecker, 09/13/2018 09:11 AM

edit.test.conf View (1.67 KB) Patrick Plitzner, 09/13/2018 01:02 PM

Add picture from clipboard (Maximum size: 40 MB)