[Scottish] PHP configuration problem ?

Tom Shearer scottish at mailman.lug.org.uk
Mon Nov 11 21:44:01 2002


This probably a bit OT, but I'm not sure if it's a problem with my php code itself, or with the way I've got it and Apache configured. (The basic Mandrake 8 out of the box configuration in each case).

I'm trying to teach myself a bit of php, but I'm having problems getting it to write stuff to files with fopen() and fwrite(). I don't get a "permission denied", or "file not found " message: it seems to work perfectly, except that nothing gets added to the file.

I've chmodded the permissions on the target directory and target file to 777, so there shouldn't be any problems with file permissions.

The type of code which fails is:

	$outputstring= date("H:i, jS F")."\t".$criffel." Criffel \t".$deuchars." Deuchars \t".$hefe." Erdinger\t Price: ".$subtotal." plus VAT\t".$address."\n";
	$fp = fopen($targetfile, "a+");
 	if (!$fp)
      	 { echo "<strong>Your order could not be processed at this time.   ";
          	  echo    "It's the dilithium crystals. They're knackered.</strong>";}
	fwrite($targetfile, $outputstring);

If I manually enter some text into the output file, I've no problems reading it out with php.

Any idea where I'm going wrong ?

Tom Shearer

Email: mail@tomshearer.free-online.co.uk