Why does put_contents () sometimes throw a "No error" error?

Why does this code sometimes give a warning No such file or directory , but in other cases a warning No error ;

 <?php file_put_contents('*bad*', 'hello world'); // Trigger illegal filename. ?> 

Usually throws this error warning;

 Warning: file_put_contents(*bad*): failed to open stream: No such file or directory in C:\root\noerror.php on line 3 

but if I wait a minute and run it again, sometimes it says this instead:

 Warning: file_put_contents(*bad*): failed to open stream: No error in C:\root\noerror.php on line 3 

Any ideas?

I am using Windows 7, PHP 5.5.11 and nginx 1.4.6. In my php.ini I have:

 error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off report_memleaks = On track_errors = On html_errors = On error_log = php_errors.log 

I think these are the normal normal default error settings, with the exception of error_log .

The same thing happens in the log file - sometimes it says No such file or directory when it says No error ;

 [11-Jan-2017 12:29:25 Europe/London] PHP Warning: file_put_contents(*bad*): failed to open stream: No such file or directory in C:\root\noerror.php on line 3 [11-Jan-2017 12:29:26 Europe/London] PHP Warning: file_put_contents(*bad*): failed to open stream: No error in C:\root\noerror.php on line 3 
+5
source share
1 answer

Try to grant full access to the user in a folder with a bad location

  • right click β†’ properties -Security β†’ Edit -select all and save
0
source

Source: https://habr.com/ru/post/1262637/


All Articles