Re: PHP extension and the open file
| From: | Pierre | Date: | Sun, 03 Jun 2007 18:38:27 +0000 |
| Subject: | Re: PHP extension and the open file | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-4698@lists.php.net to get a copy of this message | ||
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