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?
<?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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I just tried the script.. No errors.. but just doesn't write.... hmm
ASKER
never mind.. I figured it out..
ASKER
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 ^_^
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 ^_^
ASKER
umm.. i just found out i can only split 20 points each... so i'll increase the points and split 20 each..
ASKER
For some weird reason, it works fine on my own personal server.. ^_^