I am trying to write the contents of a variable to a .php file so that I can access that file later, through requite_once, and use that variable later.
The dir that I am trying to write to has 755 permission and I talked to my hosting provider who said that the dir can be written to by me now.
But, the file is not being written. Here is the code that I am trying to write the file with:
error_reporting(-1);
$elasticaObject = var_export($elasticaObject, true);
file_put_contents('theIndex.php', $elasticaObject);
echo "done!";
I get an output of done!done!done!
but, the file is not being written as I get a 404 error when I try to visit it and because it is not-existent in the dir listing.
This function returns the number of bytes that were written to the file, or FALSE on failure.
. You haven't checked what you got back from the function.