Running CMS with more PHP versions on local Apache servers

The web development is deep marked by manifold multi-version environment. Different versions of browsers as well as scripting languages, etc. are high appeal for developer work. Very convinient way for development with multiple versions of PHP on local computer is here possibility to arrange more local Apache servers parallel running each with different version of PHP as shown on next figure :

Two servers with different PHP versions

It is necessary to mention significant property of most popular CMS (Joomla, Drupal, WordPress,..) which configuration settings does not include URL root of application. The database definitions are relative to the installation root of CMS. Taking this fact into account we can arrange the development environment in very advantageous way.

To run shown two servers on one developer PC you need 2 Apache server installations (in 2 different directories and started/stopped with separate services) as well as 2 installations of different versions of PHP (in 2 different directories). The key point is here to set servers for responding on two different ports – e.g. 80 and 81. Then the configuration in httpd.conf is following (shown only part relating to port setting and PHP linking) :

Apache Server #1

Listen 80
LoadModule php5_module “c:/Servers/php_523/php5apache2_2.dll”
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir “c:/Servers/php_523″

Apache Server #2

Listen 81
LoadModule php5_module “C:/Servers/php_533/php5apache2_2.dll”
AddType application/x-httpd-php .php

# configure the path to php.ini
PHPIniDir “c:/Servers/php_533″

When you have made shown setup then you can call your application with PHP#1 as http://localhost/… and the same application running with PHP#2 as http://localhost:81/…

Posted in Web Development | Comments Off

Testing with Selenium RC in NetBeans environment (FF3, IE8, Opera9)

I am using frequently Selenium web application testing during development of different components and modules for CMS Joomla and Drupal. The best way is to perform testing directly from development IDE and here is excelent possibility to use Selenium module (plugin) inside of NetBeans. Latest versions of NetBeans (6.9, 6.9.1, 6.10.M1) have embedded Selenium Server ver.1.0.1, which can be started along with NB start. Here are some notes from latest web application testing with NetBeans 6.10.M1 (PHP 5.3.3) :

1. Object of testing was Joomla component – web pages with custom validation functions (using Mootools 1.11)

2. Opera was not starting – necessary hack was to use on the beginning of test code command ‘selenium.open(url)’ twice as was written by amadouwade in http://code.google.com/p/selenium/issues/detail?id=411 (“You can use selenium.openWindow(url, windowdId) instead of selenium.open(url). Otherwise if you use selenium.open(url) twice the page will be loaded correctly.”).

3. Running the same test script with Internet Explorer 8 was most difficult story because of two major obstacles :

test run was very slow – four times slower as it was in the case using Firefox 3.6 (IE8 84s. / FF3 20s.)

test was alerting with non-existent error when after ‘selenium.type(..)’ command have to run page javascript on event ‘change’.

Slow testing progress of IE8 was caused by using default multiple Window browser arragement. Necessary correction can be solved by using -singleWindow Selenium RC start parameter, but Selenium server embedded in NB does not have possibility to set any startup parameters. Succesfull solution was to stop embedded Selenium server in NB and to start external Selenium server with following command :

call java -jar selenium-server.jar -singleWindow

In this environment test runs with IE8 speeded up to FF level reaching 27s. total time.

Second problem with IE8 not firing onchange event under Selenium RC control (manual testing was all OK) was finally solved with additional command (relating to Mootools 1.11 framework) located after ‘selenium.type’ command :

selenium.runScript(“element.fireEvent(‘change’,params)”);

in specific test context it was exactly written as selenium.runScript(“$$(‘input[name^=ex_com_content]‘).fireEvent(‘change’,’0′)”);

Solution was taken from http://cfc.kizzx2.com/index.php/tag/selenium-rc/ where are two possibilities shown :

jQuery selenium.runScript(“$(‘#MyInputElement’).trigger(‘change’)”);

JavaScript document.getElementById(‘MyInputElement’).onchange();

Posted in Testing | Comments Off