I'm running a server on CentOS 7.
User apache | Group apache has 775 permissions on /var/www/html
When I execute a PHP file that wants to create a new file in root dir (/var/www/html/) I get the following error
Warning: file_put_contents(file.bin): failed to open stream: Permission denied in /var/www/html/file.php
PHP code:
<?php
ini_set('display_errors', 'on');
$file = 'file.bin';
$content = "Content";
file_put_contents($file, $content);
?>
I will update the question with more data but since I'm new I don't know too many things about debugging server errors.
What I tried:
- For executing scripts (php..) I saw the user to be apache so I gave 'apache' ownership on /var/www/html/ 
- tried - 777on- ./html(and reversed action after it didn't work to 755)
- Also tried - cd /var/www/html- chmod -R 775 .(from comments)
 
    