I use php5.6 and Apache2.4.6 in centOS7.5
I put a php file in /var/www/html
like this :
<?php
echo (__DIR__ . "/test.text");
file_put_contents(__DIR__ . "/test.text","test text");
when I access this file through web browser(google chrome), file_put_contents do not function.
but,when I execute this file in console, file_put_contents do function. it make test.text
file.
Is this problem due to server setting? or some php function doesn't work in access by a browser?
this is httpd/error_log
[Tue Oct 30 13:35:13.191011 2018] [:error] [pid 15037] [client XX.XXX.XX.XXX:29220] PHP Warning:
file_put_contents(/var/www/html/test.text): failed to open stream: Permission denied in /var/www/html/fpc2.php on line 3
but, this file's permission is 777.