本文介绍了PHP错误的文件描述符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我们最近已将服务器从PHP 5.4.15升级到5.5.1,并已开始在日志中获取此错误
We've recently upgraded our servers from PHP 5.4.15 to 5.5.1 and have started getting this error in the logs
我已经跟踪到了这一点,该代码打开了另一个小的PHP脚本,该脚本将文件上传到后台的S3中.
I've tracked it down to this bit a code that opens another small PHP script which uploads a file to S3 in the background.
// Grab uploaded file and assign a working name
$fileTemp = $_FILES['file']['tmp_name'];
$pathToWorkingFile = tempnam($g_TmpDirectory, "TR-");
// Move the file to our working area
if (move_uploaded_file($fileTemp, $pathToWorkingFile) === false)
throw new Exception("Cannot move file to staging area.", 1011);
// Where the file will end up on S3
$s3Bucket = "test.bucket.com";
$uploadDest = "/uploads/image123.jpg";
// Create process to upload file in background
popen("/usr/local/bin/php /path/to/uploadScript.php $pathToWorkingFile $s3Bucket $uploadDest &", 'r');
推荐答案
事实证明,此错误是由我们在PHP升级过程中启用的OPcache配置引起的.当我通过从php.ini中删除此设置来禁用命令行操作时,一切正常.
It turns out that this error was caused by our configuration of OPcache which was enabled during the PHP upgrade process. When I disable it for command line operations by removing this setting from php.ini everything works fine.
opcache.enable_cli=1
这篇关于PHP错误的文件描述符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!