Project

General

Profile

Actions

DataPortalDeveloperEnvironmentSetupLinux » History » Revision 53

« Previous | Revision 53/91 (diff) | Next »
Andreas Kohlbecker, 09/12/2018 02:16 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

copy edit.test.conf to /etc/apache2/sites-available/

open /etc/apache2/sites-available/edit.test.conf and replace all {USER_HOME} with the output of echo ~/

enable the test vhost:

sudo chown root:root /etc/apache2/sites-available/edit.test.conf
sudo a2ensite edit.test.conf
sudo systemctl restart apache2.service  

Check if php is working:

Copy info.php in the http root (e.g. ~/workspaces/www/) and open http://edit.test/info.php in your browser

Install Drush

http://docs.drush.org/en/8.x/install/

Local data portal installation

create the cdm_dataportal workspace:

cd ~/workspaces/
git co edit-git:/var/git/cdm-dataportal.git

now you should have the folder ~/workspaces/cdm/cdm-dataportal

install drupal core:

mkdir -p ~/workspaces/drupal-7
cd ~/workspaces/drupal-7
drush dl drupal-7.x  

setup the cdm_dataportal by creating symlinks to the according folders in the cdm_dataportal workspace

cd ~/workspaces/drupal-7/
ln -s ~/workspaces/cdm/cdm-dataportal/themes/zen_dataportal/polyfills
ln -s ~/workspaces/cdm/cdm-dataportal/debug/db_debug.php.inc
ln -s ~/workspaces/cdm/cdm-dataportal/debug/drupal_site_debug.php
cd ~/workspaces/drupal-7/sites/all` 
rm /themes 
cd ~/workspaces/drupal-7/profiles
ln -s ~/workspaces/cdm/cdm-dataportal/modules/cdm_dataportal/profile/CDM_Portal CDM_Portal
ln -s ~/workspaces/cdm/cdm-dataportal/modules/cdm_dataportal/profile/CDM_Portal_Testing/ CDM_Portal_Testing

sudo ln -s /path/to/svn/drupal/7.x/themes/ themes

Delete `/modules/cdm_dataportal` if it exists (it should not!!!)

sudo ln -s /path/to/svn/drupal/7.x/modules/cdm_dataportal/ modules/cdm_dataportal

1. Go to `/var/www/drupal/profiles` 
1. delete `/CDM_DataPortal` and `CDM_DataPortal_Testing` 
1. insert symlink to checked out profiles from svn (http://dev.e-taxonomy.eu/svn/trunk/drupal/7.x/modules/cdm_dataportal/profile/)


change group ownership of drupal folder to www-data

sudo chown -R :www-data ~/workspaces/drupal-7/

## Create a site



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:

* You need to have cdmlib checked out and imported into your eclipse workspace (http://cybertaxonomy.eu/cdmlib/getting-started.html#Developing_the_CDM_Library_with_Eclipse)
* You neet a CDM database (called `cdmDB` in this example)
* You need Jetty installed in your workspace (EclipsePreferencesforTeams#RunJettyRun)


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"?>

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

Create a Drupal project in phpStorm for the cdm_dataportal project folder:


The  final Directory settings for the project should now look like:

![](phpstorm-settings-directories.png)

### Add Drupal code base to External libraries

open the external libraries configuration:

![](phpstorm-external-libraries-open.png)

Setup the paths (this screenshot is only an example):

![](phpstorm-external-libraries.png)

## PhpStorm configuration to use Xdebug

* [jetbrains: Zero-configuration Web Application Debugging with Xdebug and PhpStorm](https://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm#Zero-configurationWebApplicationDebuggingwithXdebugandPhpStorm-1.InstallXdebug)
* [jetbrains: Browser Debugging Extensions](https://confluence.jetbrains.com/display/PhpStorm/Browser+Debugging+Extensions)

Add a remote debug configuration to the localhost

![](phpstorm-remote-debug-config.png)

This is the server configuration. Do not configure pathmappings for localhost!

![](phpstrom-server-config.png)

If you are having problems configuring your debugger, you can use the Web Server Debug Validation tool to solve common problems with your debug configuration. The tool can be started by selecting the Run | Web Server Debug Validation option from the menu.

![](phpstorm-validate-debugger-configuration.png)

install the Firefox extension [Xdebug helper](https://addons.mozilla.org/en-US/firefox/addon/xdebug-helper-for-firefox/)


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

![](Xdebug-helper-configuration.png )

## Project setup


![deployment_connection](deployment_connection.png)


![deployment_mappingpng](php_servers.png)

# Setup of the PDT project in eclipse

**PDT is no longer recommended, use PhpStorm instead!**


![](drupal7-core-buildpath.png)


![](drupal7-core-includes.png)

##  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

Updated by Andreas Kohlbecker over 5 years ago · 53 revisions