On 6/13/07, tedd <tedd@xxxxxxxxxxxx> wrote:
At 1:37 PM -0400 6/13/07, Daniel Brown wrote: >On 6/13/07, tedd <tedd@xxxxxxxxxxxx> wrote: >>Hi Gang: >> >>I'm sure this is obvious to most, but not to me. >> >>I working on a virtual host. >> >>If I want to save data in a file, I can ftpconnect(); change the >>permissions of an existing file from 0755 to 0777; write to the file; >>and change the permissions of the file back to 0755 -- no problem. >> >>However, if a file is not there, then I can create one. However, the >>permissions of the file will be automagically set to 0600 and as >>such, I can't change them via ftpconnect(). In other words, I can't >>FTP in to my site and change the permissions of a file I created. I >>can delete the file, but that's all. >> >>How do you guys create a file and set its permissions working on a >>virtual host via php? >> >>-snip- > > Two quick questions.... > > Is the PHP script running ftpconnect() using a valid FTP account >with privileges to own/share a file on the system? > > How are you creating the file on the FTP server? > >-- >Daniel P. Brown Daniel: 1. I'm not sure -- from within a script, I ftpconnect() with user and password and can change permissions of directories with no problems -- can I do that without a valid FTP account? 2. From within a script, I change the permission of the parent directory and open a file. If it's there, then I can read from or write to it. If it's not there, then the operation ( fopen( $folder . $filename, "w" )) creates the file and I can write to it then read from it. I have now figured out how to get the created file to 644 permission and that's sufficient. I'm still not able to get permissions to 755, but really don't need to, just wondering how. Thanks, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com
When you're chmod()'ing your file, are you doing it correctly, with the four-bit (octal) number as opposed to the common use of the three-bit (decimal) number? Id est: chmod($somefile, 0755); // The "correct" way chmod($somefile, 755); // Should work, but is still "technically incorrect" -- Daniel P. Brown [office] (570-) 587-7080 Ext. 272 [mobile] (570-) 766-8107 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php