PHP - Opening a File or Die on Raspberry Pi PHP - Opening a File or Die on Raspberry Pi apache apache

PHP - Opening a File or Die on Raspberry Pi


You need to give PHP write permissions to the file

chown www-data:www-data /var/www/AvailableTickets.txtchmod 644 /var/www/AvailableTickets.txt


I had a similiar problem. Had the fopen in a function. Would not produce the file in the same directory. did all the pi:pi's and 777's, still no file.

About to throw the whole thing out when I thought of the optimizer. So moved the fopen(fptr, " filename"); and fprintf header into the main init routine out of a function and it worked!

Apparantly the optimizer decided it wasn't needed!!

Optimizers cause no end of mysterious problems for tiny gain.You don't need an optimizer you need a faster processor!

John