Link to home
Start Free TrialLog in
Avatar of enyceexdanny
enyceexdanny

asked on

PHP wont write to a file residing on the same location

First, the code:

<?php
$filename = 'survey.txt';
$fp = fopen($filename, "a");
$date = date("l F dS Y h:i:s A");
$domain = GetHostByName($REMOTE_ADDR);
$string = "$date ($domain)\r\nName : $name\r\nSex : $sex\r\nWhich shopping method : $q1\r\nWhy : $q2\r\nRate : $q3\r\nWords : $q4\r\nHow to improve : $q5"."\r\n\r\n";
$write = fputs($fp, $string);
fclose($fp);
?>

When I test this on my local machine, it writes fine. But once I upload it to the server, it wont write at all. The weird thing is that I have a counter script that writes in almost the exact same way, yet it works.

Any Ideas?
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of Marcus Bointon
Marcus Bointon
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enyceexdanny
enyceexdanny

ASKER

i'm trying to change it via ftp (right click, and chmod 777). but it still doesn't work.
For some weird reason, it works fine on my own personal server.. ^_^
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just tried the script.. No errors.. but just doesn't write.... hmm
never mind.. I figured it out..
It wouldn't change the permissions via FTP.
So I had to use the control panel for the domain and change the permission of the folder.
Now it seems to work fine.

it's not much, but I'm going to split between all of you... Sorry ^_^
umm.. i just found out i can only split 20 points each... so i'll increase the points and split 20 each..