Zend Server CE and Xdebug install on Ubuntu
Install Zend Server CE
- Open terminal and login as root
root sudo -i - Edit sources list
nano /etc/apt/sources.list - Add row:
deb http://repos.zend.com/deb/ce ce non-free - Get and install key:
wget http://repos.zend.com/deb/zend.key -O- |apt-key add - - Update repository:
apt-get update - Install Zend Server CE:
aptitude install zend-ce
Install Xdebug
- You have to have this packages installed:
build-essential, autoconf.
sudo apt-get install build-essential
sudo apt-get install autoconf - Get Xdebug source, unpack and compile.
wget http://www.xdebug.org/files/xdebug-2.0.4.tgz
tar -xzf xdebug-2.0.4.tgz
cd xdebug-2.0.4/
/usr/local/zend/bin/phpize
./configure --enable-xdebug --with-php-config=/usr/local/zend/bin/php-config
make - Compiled library is in
xdebug-2.0.4/modules/xdebug.so - Copy library into
/usr/local/zend/lib/debugger/xdebug.socp modules/xdebug.so /usr/local/zend/lib/debugger/xdebug.so - Edit file
/usr/local/zend/etc/ext.d/debugger.iniand comment row (add semicolon);zend_extension_manager.dir.debugger=/usr/local/zend/lib/debugger - Add at end
/usr/local/zend/etc/php.ininew row withzend_extension=/usr/local/zend/lib/debugger/xdebug.so - Restart server
/etc/init.d/zend-server restart
PHP Class for Hudson
I make php class for work with Hudson (http://code.google.com/p/php4hudson/). Is useful for save all jobs configs and deploy jobs on another server or some multichanges in jobs. Useful is easy and some example is in wiki.
Save all config.xml
/**
* Retrive all config.xml and save into directory
*/
require_once ("src/phphudson.php");
$hudson = new PhpHudson('http://localhost:8080/');
// save all jobs config into temp
$hudson->getAllConfigs("/tmp/hudson/");
Recreate all jobs
/**
* Read all config.xml from directory and create jobs in Hudson
*/
require_once ("src/phphudson.php");
$hudson = new PhpHudson('http://localhost:8080/');
$dir = '/tmp/hudson/';
if ($handle = opendir($dir)) {
echo "Directory handle: $handle\n";
echo "Files:\n";
while (false !== ($file = readdir($handle))) {
echo "$file\n";
$hudson->createJob(basename(str_replace("-config.xml", "", $file)), file_get_contents($dir . $file));
}
closedir($handle);
}
phpDepend and php frameworks
Php Depend
Php Depend is php fork of JDepend. pDepend traverses Php class file directories and generates design quality metrics for each php package. At chart you can see abstractness and instability at axis. This metric is an indicator of the package’s balance between abstractness and stability. At pyramid some data as NOP (number of packages), NOC (number of classes), NOM (number of methods), LOC (line of code). Details about pyramid you find at Using the Overview Pyramid.
Php Frameworks in Php Depend
Akelos
CakePHP
CodeIgniter
Kohana
Nette
Prado3
Symfony 1.2
Solar
Zend Framework
Others
Ez components
Summary
I’m not expert in QA. I have some experiences with integration php. I use phpunit, phpcs and Hudson for CPD, PMD, Code Coverage and Unit testing. For integration tests we use Selenuim and phpunit. Php Depend is good for some comparism between frameworks. Matrics can’t say how good is code in framework or if is good for my project. Some numbers as ANDC (Average Number of Derived Classes) and AHH (Average Hierarchy Height) can give some image about programming style.
In article you have some comparism and i make this test every 6 months and after that will be results about progress in frameworks.
PHP and Hudson
Hudson is extensible continuous integration engine used for Java projects. It’s architecture can be used for others languages as PHP too.
Install
- download war file
- run direct in console java -jar hudson.war (free port 8080 andJDK 1.5+)
- or make install to servlet server (Tomcat, Jetty, JBoss, …)
- after that go http://localhost:8080
- plugins recommended for php
Build
For build can use phing (example) or ant.
<?xml version="1.0" encoding="UTF-8"?>
<project name="start_page" basedir="." default="main">
<!-- $Id: build.xml 102 2009-02-26 14:39:10Z abtris $ -->
<property name="tmp" value="/tmp" />
<property name="wsname" value="source" />
<property name="package" value="${phing.project.name}" override="true" />
<property name="builddir" value="${tmp}/build/${phing.project.name}" override="true" />
<property name="srcdir" value="./src/" override="true" />
<!-- Main Target -->
<target name="main" description="main target">
<!-- Create dirs -->
<mkdir dir="${builddir}/reports"/>
<mkdir dir="${builddir}/reports/coverage"/>
<!-- PHP API Documentation -->
<phpdoc title="API Documentation"
destdir="${builddir}/apidocs"
sourcecode="yes"
defaultpackagename="StartPage"
output="HTML:Smarty:PHP">
<fileset dir=".">
<include name="*/*.php" />
</fileset>
</phpdoc>
<!-- PHP CodeSniffer -->
<exec command="phpcs --standard=ZEND --report=checkstyle ${ws}/${wsname}/src/ > ${builddir}/reports/checkstyle.xml" escape="false" />
<!-- PHPUnit -->
<exec command="phpunit --log-xml ${builddir}/reports/phpunit.xml --log-pmd ${builddir}/reports/phpunit.pmd.xml --coverage-clover ${builddir}/reports/coverage/clover.xml --coverage-html ${builddir}/reports/coverage/ tests/AllTests.php"/>
</target>
</project>
Example configuration
Project name: StartPage
Source Code Management: Subversion
Repository URL: https://localhost/svn/start_page/trunk
Local module directory (optional): source
Use update: true
Build
Execute shell: phing -f $WORKSPACE/source/build.xml -Dws=$WORKSPACE -Dtmp=$WORKSPACE
Post-build action
Publish Javadoc
Javadoc directory = build/start_page/apidocs/
Retain javadoc for each successful build = false
Publish JUnit test result report
Test report XMLs = build/start_page/reports/phpunit.xml
Publish Checkstyle analysis results
Checkstyle results = build/start_page/reports/checkstyle.xml
Publish PMD analysis results
PMD results = build/start_page/reports/phpunit.pmd.xml
Publish Clover Coverage Report
Clover report directory = build/start_page/reports/coverage/
