Home  >  Article  >  Backend Development  >  file_put_contents error: failed to open stream: Invalid argument One reason, invalidromcontents_PHP tutorial

file_put_contents error: failed to open stream: Invalid argument One reason, invalidromcontents_PHP tutorial

WBOY
WBOYOriginal
2016-07-12 08:51:412782browse

file_put_contents error: failed to open stream: Invalid argument One reason, invalidromcontents

When testing the nilcms system today, an error occurred, causing the cache to fail to be updated:

<p>file_put_contents(C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_APP\include_run/config_site.php): failed to open stream: Invalid argument C:\UPUPW_AP5.4\vhosts\d.tv\NilCMS_20160520\core\common.php 129</p>

The test environment uses win7 64-bit and uses the UPUPW environment suite.

The file_put_contents function is used to generate files. There is no problem in generating other files in this directory. Only config_site.php cannot be written. Tangled. . .

Analysis process:

1.config_site.php file will be loaded directly before the nilcms system is run. Will it affect writing? After testing, loading the file and then modifying it worked without any problems.

2. Looking for problems, struggling, and feeling speechless.

3. Found that the function used when importing the config_site.php file is require_once. After changing it to require, I found that there was no problem generating cache. Problem solved.

Some notes:

1. I have not encountered such problems when using the wamp environment (XWAMP) I built myself.

2. There is no such problem when using Linux virtual host environment.

3. I don’t know why replacing this function can solve this problem. Friends who know can share it.

4. I feel much better^_^

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1129140.htmlTechArticlefile_put_contents Error: failed to open stream: Invalid argument One reason, invalidromcontents appeared when testing the nilcms system today An error was reported, causing the cache to be unable to be updated...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn