PDA

View Full Version : can I create a file ??


c q
10-05-2002, 06:37 PM
can I create a file using php, on a remote unix server, giving file permissions according to my wish ?

Spookster
10-05-2002, 06:44 PM
yes

c q
10-05-2002, 07:39 PM
Originally posted by Spookster
yes
only a monosyllabic answer for such a long question :(
juss kidding. :p
okie then, if it can be done, then may I know how ???

Spookster
10-05-2002, 08:17 PM
yes you may. :D

Spookster
10-05-2002, 08:19 PM
now that I reread the question what do you mean by remote server? Is the script on the same server as where the file is going to be created?

c q
10-05-2002, 08:20 PM
the lord has finally bestwoed on me his blessings....hehehe...how 'bout some help now ?? this poor soul will be ever grateful to you, lord...:D

c q
10-05-2002, 08:24 PM
achha sorry,.....I dint read your latest reply..
actually what I really meant was that I somebody is hosting my pages on his server (ok..maybe HER server, who knows yea ?), I ws just asking how can I , sitting happily at my place create a file...with, as I metioned, the permissions that i require.

p.s. will come back to you asking how to go about with those permissions....ok I'll ask right away, I just need a file that I can be written into by another php script. suggestions ?

edit: yea...it all scripts files evrything on the same server, except me.

mordred
10-06-2002, 04:03 PM
If the file A lies on server A, then it can be written by PHPscript A if this script file also lies on server A.

On the other hand, if your PHPscript A lies on server B and wants to write into a file on server A, that won't work directly. You don't have writing access for different servers.

From the manual, see at fopen():

"HTTP connections are read-only; you cannot write data or copy files to an HTTP resource.".

What you can do is place a script on server A that gets triggered (by simply fopen()ing it) by another script on server B, if that's what you wanted to do.

Does that clear up things?

c q
10-06-2002, 04:27 PM
ya...actually I was using fopen, but for weird reasons, the file was not writable. then I realised i need to put it in my cgi-bin folder; now things are like fixed. thanks mordred..