Re: PHP extension and the open file
| From: | homer242 | Date: | Mon, 04 Jun 2007 08:07:37 +0000 |
| Subject: | Re: PHP extension and the open file | ||
| References: | 1 2 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4699@lists.php.net to get a copy of this message | ||
Pierre a écrit :
> Hi Homer,
>
> On 6/3/07, homer242 <homer242@patatrac.info> wrote:
>> Hi,
>>
>> I've coded an extension for php in C. It's based on an other project
>> called "redtemplate" write in C too. Redtemplate is a template system
>> likes clearsilver.
>>
>> In my extension, there are the function rd_display($file) which call
>> redtemplate_parse() which open the $file with open or fopen (lex/yacc do
>> this job).
>>
>> My problem is that extension doesn't work in browser. I mean, in
>> console, "php index.php" work but in browser, on the same php file, i
>> have this message :
>>
>> Fatal error: File 'themes/lanteam/main.html' not found ! ...
>>
>>
>> I think the problem is where php is executed in apache.
>>
>> What do i do to solve this problem ?
>
> Do you mean that a fopen("foo/a.html") works in php but not in your
> extension using system fopen? If yes, you have to take care of the
> differences between the SAPI.
>
> Threaded SAPI (some apache2, windows IIS or CLI) requires absolute
> path to be passed to the file system functions. The current directory
> is different than php's cwd. For example, I use expand_filepath in the
> zip extension, there is alternatives but this one was the most
> reliable (and let me raise a file not found).
>
> --Pierre
thanks, i will try this fix :)
but i think that i'm going to have some problems with the include system
of redtemplate... one solution would be to define a hook in the
redtemplate/lex/yacc file management and redefine it in the extension
with the 'expand_filepath'. Easy 8)
homer242.