View as source file or XML.
$ sudo apt-get install apache2Once the web server installation is done, PHP5 needs intalled also.
$ sudo apt-get install php5 php5-dev libapache2-mod-php5 php5-curl php5-gd \ php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ps \ php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-xsl php5-commonLet's create a new PHP file to ensure everything is working:
$ sudo pico /var/www/test.php
Add this code to the file: <?php phpinfo(); ?>Restart Apache so all the prior changes get applied:
$ sudo /etc/init.d/apache2 restart
Now using a web browser point it to: http://localhost/test.phpCheck if php works corectly.$ zorba -q '2+1' <?xml version="1.0" encoding="UTF-8"?> 3Check php test is working.
$ ctest -R php Start processing tests Test project /tmp/zorba-1.2.0/build 1188/1188 Testing php Passed 100% tests passed, 0 tests failed out of 1Passing the php test means that PHP5 is instlled corectly and there is a succesfull build that includes the PHP swig binding.
zorba/build$ cp swig/php/zorba_api.so swig/php/zorba_api_wrapper.php /usr/local/lib/php/
Add the following lines to /etc/php5/apache2/php.ini file.include_path="/usr/local/lib/php/" extension=/usr/local/lib/php/zorba_api.soRestart Apache Http server
$ sudo /etc/init.d/apache2 restart
Refresh browser: http://localhost/test.phpCheck if zorba_api is in the list of php known extensions.<html> <title>Zorba test</title> <body> <?php // include Zorba API require_once 'zorba_api_wrapper.php'; // create Zorba instance in memory $ms = InMemoryStore::getInstance(); $zorba = Zorba::getInstance($ms); try { // create and compile query string< $queryStr = '1+2'; $query = $zorba->compileQuery($queryStr); // execute query and display result $result = $query->execute(); echo $result; // clean up $query->destroy(); $zorba->shutdown(); InMemoryStore::shutdown($ms); } catch (Exception $e) { die('ERROR:' . $e->getMessage()); } ?> </body> </html>Point your browser to http://localhost/zorba.php and see the result.