The PHP generation assumes that after the build step you will move your code 
after generation into your own PHP source tree, where you define 
$GLOBALS['THRIFT_ROOT'], and your packages go in 
$GLOBALS['THRIFT_ROOT'].'/packages/'

The issue is that PHP includes are a bit of a nightmare to deal with, as the 
paths are always relative to the directory that the PHP interpreter is invoked 
from, not the directory that the file with the include statement resides in.

Thus, it is always best to use absolute paths in PHP include/require 
statements, and we use $GLOBALS['THRIFT_ROOT'] for this.

A bit clunky and adds one manual step to the process, but keeps the paths sane.

-----Original Message-----
From: Ted Yu [mailto:[email protected]] 
Sent: Wednesday, October 28, 2009 10:17 AM
To: [email protected]
Subject: include paths for PhpClient

I feel strange that I needed to patch include paths in PhpClient.php:

$GEN_DIR = '../gen-php';
require_once $GEN_DIR.'/shared/SharedService.php';
require_once $GEN_DIR.'/shared/shared_types.php';
require_once $GEN_DIR.'/tutorial/Calculator.php';
require_once $GEN_DIR.'/tutorial/tutorial_types.php';

Originally $GEN_DIR was used without shared and tutorial directories.

--- On Tue, 10/27/09, Anner van Hardenbroek <[email protected]> 
wrote:

> From: Anner van Hardenbroek <[email protected]>
> Subject: Re: undefined constant E_NONE
> To: [email protected]
> Date: Tuesday, October 27, 2009, 5:16 PM
> Hi,
> 
> Just replace E_NONE with 0 (int), that will fix it.
> 
> Kind regards,
> -Anner.
> 
> --
> Anner van Hardenbroek
> [email protected]
> 
> On 28 okt 2009, at 00:30, Ted Yu wrote:
> 
> > Hi,
> > When running php client, I got:
> > PHP Notice:  Use of undefined constant E_NONE -
> assumed 'E_NONE' in / 
> > home/wr_webroot/thrift/tutorial/php/PhpClient.php on
> line 38
> > PHP Stack trace:
> > PHP   1. {main}()
> /home/thrift/tutorial/php/PhpClient.php:0
> >
> > I am using php 5.2.9
> >
> > Has anyone seen this ?
> >
> >
> >
> >
> >
> 
> 


      

Reply via email to