Re: Opening files for write from php modules

[email protected] (Scott Baker) Mon, 10 Mar 2003 15:36:17 -0500
Newsgroups php.dev
Message-ID <[email protected]>
Nevermind... Seems the webserver was on afs filespace, and apache/php 
didnt like the permissions it had there.  Everything works now that I 
moved it to a jfs filesystem.

Scott Baker wrote:
> I'm trying to write an extention that calls a C++ lib i've written. I've 
> gotten the module to compile and function mostly correctly, but I have a 
> problem opening files for writing within functions of the lib. My code 
> links libpng to write image files to a img directory on the webserver.  
> The problem is that any attempt to actually open a file for write fails:
> 
> 
> this is the code to open the file (standard stuff):
> 
> FILE *pngout
> pngout = fopen(filename, "wb");
> 
> if (pngout==NULL) {
>         fprintf(stderr,"ERROR: Unable to open file %s for writing 
> graph\n",filename);
>         return -1;
> }
> 
> This code works when i compile the lib as a stand-alone app, but fails 
> when I call it from php.  I doubt permissions are the issue, I've gone 
> as far as to chmod 777 the img dir it writes to, and I still get this 
> error.  Is the problem that I need to use php streams to write to disk 
> or something?  I'd like to be able to use the same lib linked into a php 
> module and into a stand alone app.
> Thanks.
> 
> 
> 
> Platform: PowerPC AIX 4.3.3. ml10
> Compiler: xlC  (the C++ one)
> PHP version: 4.0.6 (this is because this was the most resent IBM rpm for 
> aix.  I had compile problems with newer versions, though i think b/c of 
> the changes i've made to libtool, it should work now.) I had to edit 
> libtool to use xlC's makeC++SharedLib script to get the module to link 
> correctly.  I've compiled everything from my library to php to apache 
> with xlC.
>