Web Hosting Talk







View Full Version : Creating files with PHP vs permissions


JamesHendrix
01-12-2005, 12:14 PM
I want to be able to create files using PHP. The files are to be created in a remote web server.

I think I might have a permission issue. I have tried several combinations of changing ownership and permissions on the directory based upon searching the net and trying exampes, but still no luck.

Here is my code:

$fp = fopen('html/test/file.html', 'w');
fputs($fp, var_export( stat('html/test/file.html'), true ));
fclose($fp);


If I manually create the file, then the code can access it, but I am needing to create new files first.

I have tried setting the ownership/group to my name, the nobody name and the apache name.

I also set 0777 to the directory as well.

I am running Linux (cenTos).

Any ideas?
Thanks
James

JamesHendrix
01-12-2005, 12:46 PM
duh - it's working. I did not realize my ftp program had to be refreshed. When I ssh into the server, I saw the files...