Home  >  Article  >  Backend Development  >  ucenter - php file_put_contents a strange problem

ucenter - php file_put_contents a strange problem

WBOY
WBOYOriginal
2016-08-04 09:19:161104browse

The company's project requires the use of ucenter. I installed one independently on my local computer. After installing dz, I found that the communication in ucenter failed. I checked step by step and found that the data/cache/apps.php cache in ucenter was not updated, causing the communication to fail. After deleting apps.php Communication successful.
ucenter uses the file_put_contents function to update the apps.php cache, and a strange problem is discovered:
ucenter operates application management, after adding, deleting or modifying applications, file_put_contents fails to update the cache and returns false, and then I manually put apps. If the content in php is modified or deleted, the update will be successful. Then I operated the application management again. After adding and deleting the application, the cache update file_put_contents still failed

Computer win7 php version 5.6

Reply content:

The company's project requires the use of ucenter. I installed one independently on my local computer. After installing dz, I found that the communication in ucenter failed. I checked step by step and found that the data/cache/apps.php cache in ucenter was not updated, causing the communication to fail. After deleting apps.php Communication successful.
ucenter uses the file_put_contents function to update the apps.php cache, and a strange problem is discovered:
ucenter operates application management, after adding, deleting or modifying applications, file_put_contents fails to update the cache and returns false, and then I manually put apps. If the content in php is modified or deleted, the update will be successful. Then I operated the application management again. After adding and deleting the application, the cache update file_put_contents still failed

Computer win7 php version 5.6

Have you checked the permissions? Does the user/user group that provides network services have read and write permissions for the website's home directory, temporary files and cache directories?

  • Make sure the path to the file is correct

  • Whether the file directory has write permission set

If the file path is correct, it is most likely a permission problem. Try setting 777 permissions and you will know

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