Answer the question
In order to leave comments, you need to log in
How to solve the permissions issue for file_put_contents()?
The site is located in the folder /var/www/test.site/public_html/
Created a function to add content to the file
function writeDataToFile($data){
if(file_put_contents(ORDERS_LOG, $data, FILE_APPEND)){
return true;
}
return false;
}
Warning: file_put_contents(/var/www/test.site/public_html/eshop/inc/../admin/orders.log): failed to open stream: Permission denied in /var/www/test.site/public_html/eshop/inc/lib.inc.php on line 136
sudo chown -R serii:serii www
Answer the question
In order to leave comments, you need to log in
It is necessary that the web server user has access to all folders along the path to the file, make sure that this is the case, in this case to the var folder
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question