15
Quercus – PHP in JAVA Java implementation of the PHP language Author: Bui Dinh Ngoc Aiti-aptech

PHP Day 2011 Quercus – PHP in JAVA

Embed Size (px)

Citation preview

Page 1: PHP Day 2011  Quercus – PHP in JAVA

Quercus – PHP in JAVAJava implementation of the PHP language

Author: Bui Dinh NgocAiti-aptech

Page 2: PHP Day 2011  Quercus – PHP in JAVA

What's QuercusQuercus 100% Java implementation of

PHP PHP run on JVM (not Zend Engine)Opensource GPL license

Page 3: PHP Day 2011  Quercus – PHP in JAVA

Why?● Performance

– Up to 4x faster on some applications● Security

– Avoids buffer overflow problems in C-basedimplementation● Java/PHP integration

– PHP can now access any Java library or objects– Java can use PHP as a view technology

Page 4: PHP Day 2011  Quercus – PHP in JAVA

Why? (continue)

● PHP on Google App Engine– Google cloud computing

● Long Live Process (worker)– Php process ~ 82 live hours - Java process ∞ live hours

● Delicate Cache vs Cache on process

Page 6: PHP Day 2011  Quercus – PHP in JAVA

PHP+JAVA

Page 7: PHP Day 2011  Quercus – PHP in JAVA

Working with Java classes in PHP<?php    $a = new Java("java.util.Date", 123);    echo $a->time; ?>OR<?php   import java.util.Date;   $a = new Date(123);   echo $a->time;?>

Page 8: PHP Day 2011  Quercus – PHP in JAVA

PHP Module Standard modules

Quercus implements the standard PHP libraries (arrays, strings, date, regexp, zip ,zlib mcrypt, bcmath.

Page 9: PHP Day 2011  Quercus – PHP in JAVA

PHP Ext ModuleAPC (object caching)Image support ('gd')PDF generation (PDFlib api)AJAX (JSON)GetText (localization)

Page 10: PHP Day 2011  Quercus – PHP in JAVA

Using Databases (PHP API)MySQLPostgreSQLOracle

Page 11: PHP Day 2011  Quercus – PHP in JAVA

Java Module

All, of course !!!

Page 12: PHP Day 2011  Quercus – PHP in JAVA

Benefits of QuercusPerformance - simply fasterDevelopment - fast, safe, and easyCapability - powerful Java technologies Security - no more pesky C memory bugsScalability - Massive clusters of PHPInternationalization - 16-bit unicode

Page 13: PHP Day 2011  Quercus – PHP in JAVA

Demo<?php         $a=time();         $arr = array();         for($i=0;$i<10000000;$i++)         {             $arr[i] = $i;        }         sort($arr);         $b=time();         echo $b-$a; ?>

====> Time Processinghttp://quercusdemo.appspot.com/ ====> 8shttp://222.255.28.33:8888/index.php ====> 5shttp://o2tv.vn/quercus.php ===> 15s

Page 14: PHP Day 2011  Quercus – PHP in JAVA

Drupal performance stats

Page 15: PHP Day 2011  Quercus – PHP in JAVA

Thank you