Forum Moderators: coopster
It creates and writes a file to a directory. Each time it is called (with the correct parameters) it creates a file with a small amount of text and unique name and writes it to a subdirectory.
Sample of the code used (cut down from the original but tested)-
$now = getdate(); //get current date
$file = "./news/".$now[0].".txt"; //use current date and time to generate file name
$newsStr = "String of text"; //sample string
if(!$fileName = fopen("$file", 'w') ) //this is where the prob seems to be, line 14!
{
$error = TRUE;
}else
{
fwrite($fileName, $newsStr);
if(!fclose($fileName))
{
$error = TRUE;
}
}if ($error)
{
print "<div id ='error'>Error processing request</div>\n";
}
Warning: fopen("./news/1069260267.txt", "w") - Disk quota exceeded in testNews.php on line 14
Now I've checked my disk quota and I have more than 15M available, I'm sure the text file isn't that big. Also I have no probs uploading stuff via ftp, files both large and small.
I've checked the permissions and tried it with the directory's permissions set to 777, to no avail.
The script is being run on Apache 1.3.26 with php 4.1.2 on a Linux server.
Have I missed something obvious?
Have others encoutered this prob?
Is there meaning to the last hours spent searching in vain for answers?
How many apples are in a bushel?
RabidCarrot
If it is the permissions I just get a permission denied warning/error (I have tried the script with the the directory's permissions set to 755 and that is the warning/error I get).
How much more permision can I give the directory than 777?
(sorry, you must have edited your post while I was writing this one. lol)
RabidCarrot
If you are on a shared server, is it possible that a configuration mod to PHP or Apache has been made, which either affects your ability to write or perhaps the base directory of scripts which you are running?
<added>Serously. it solved one of my uploading problems,while the php code worked on one (/upl) server it did not work on another witout a path like /usr/site34/httpd/upl/</added>
[edited by: ikbenhet1 at 6:07 pm (utc) on Nov. 19, 2003]
Have I missed something obvious?
I don't think so, looks fine. This may be a question asked of your host. There may be some limit that you are unaware of.
Have others encoutered this prob?
no, haven't seen this one.
Is there meaning to the last hours spent searching in vain for answers?
It means you hadn't found WebmasterWorld yet
How many apples are in a bushel?
Not sure but if you mean how many can you stuff into a bushel basket then it really depends on how high you pile them. I do know there are 4 pecks in a bushel, but how many apples in a peck? How big are the apples? What time of year is it? What type of apples?
;)
I tried the full path and http: //www.etc/filename I've even given ftp: //etc/filename a go. No luck though. Although I did get some interesting warnings from the http and ftp. Warnings like "no errors" and "success" but still failing to write.
jatar_k,
It is some small comfort that my brain hasn't turned to mush yet and my code is correct.
Unfortunately my site's host is singularly unhelpful when it comes to anything to do with scripting. I was hoping to find a solution elsewhere before attempting the process of extracting support from them.
It would have been nice if someone else had encountered this prob previously, I'll let you know if I have success.
If all else fails I can do something with one previously created file with mutiple regularly updated entries rather than many small unique files.
There is one quarter of a bushel in every peck (so it would seem). Rather big apples actually. Soon to be winter. Red tasty ones.
:)
Shady,
Thanks for the info, I was thinking maybe it was a bug in my version of Apache or PHP, but if no-one else has encountered it previously that seems unlikely. I would have though writing to file would have been tested enough to have come across it before now.
Thanks for the input. I'll let you know how it fairs. Time for me to wander off to bed though now, it being quarter past 3 in the morning in my part of the world.
RabidCarrot
Aparently they have disabled the ability to create files from a php script.
Why would they do this?
Is php that much more insecure than perl?
How do you disallow php from creating files?
Can I get around it using a htaccess file I wonder?
Anyway, it seems I will have to save all my news to one previously created text file. Not a huge hassle but not how I first intended to do things.
Thanks for the input.
BTW After a bit of online research (not knowing any apple growers personally) it would seem there usually get about 100 apples in a bushel basket. Which would make a peck about 25 apples I guess. :)
Aparently they have disabled the ability to create files from a php script
:( Absolute nightmare! I have suffered many times with hosts making configuration changes! In my experience, on a shared server, things always change and they never inform you of the changes. Does anyone else have this experience?
Eventually, after many hours of debugging (like you), many times, I moved all my high traffic ecommerce sites to a dedicated server..... I just couldn't take it any more!
Now, I am in full control and although I have gone for an non-managed server, I have had no problems and do have a backup linux administrator should I need him.
In actual fact, it costs far less than I expected and you only have to worry about your own bad code hogging the server!
In addition, I have a few low cost accounts, to maintain the LPR of my structure, assuming this is in place! If it isn't I'd like to know where one of my sites disappeared to :-(
Best regards
Shady
Once I get a couple more sites I will probably set up a dedicated server. Until then I can't justify the cost and time.
Although many more probs like this from my current host and I may rethink.
What is LPR?
You managed to lose one of your sites? That's a bit of bad luck!
Thanks again for your input.
RabidCarrot
Basically, I understand it to mean that google will retrieve its limit of 1000 listings normally, then resort them using this LPR system. The basic difference being that the LPR attempts to remove the benefit of links which it believes are yours and therefore not the opinion of others.
Also, I am not certain that this is in play yet but I guess if google have patented it, it is only a matter of time! Does anybody know for sure?
Also, my apologies if I have misinterpreted this!