dumping to text file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

i'm on apache. i can see permission denied. i'm going to ask the administrator to give me permissions to the folder to write.

the m2.txt does not have to exist at the beginning does it. the script will create a file what ever name i give it from fresh?
User avatar
liljester
Forum Contributor
Posts: 400
Joined: Tue May 20, 2003 4:49 pm

Post by liljester »

yes if you use fopen("filename", "w") it will (attempt to) create a new file, or if it exists it truncates it 0 bytes
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Yeah, $string gets written to m2.txt, the 'w' on the fopen() will create the file if it doesn't already exist.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

i'm waiting for permissions from my administrator now. any probs i'll be back.

so far you been a great help. thank you for your time.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

i got the folders and files to create. thank you for your help. The only problem is that i cant delete them because when it creates the files it gives permissions only for apache user to delete. anyway of over coming this?

also in the $string i want to store the output from a function. this is how i echo the function normally

Code: Select all

<?php
 echo "<html><body><pre>";
 echo htmlspecialchars(mysqlbackup($host,$dbname,$uname,$upass,$structure_only,$crlf));
 echo "</PRE></BODY></HTML>";
?>

how can i store it in the $string variable????
malcolmboston
DevNet Resident
Posts: 1826
Joined: Tue Nov 18, 2003 1:09 pm
Location: Middlesbrough, UK

Post by malcolmboston »

cant you just use chown/chmod on that directory, or is that not an option?
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post by gurjit »

i tried that but it never worked.
Post Reply