![突然间,TMP 文件无法通过 Zend 或其他 PHP 程序重命名](https://linux22.com/image/698199/%E7%AA%81%E7%84%B6%E9%97%B4%EF%BC%8CTMP%20%E6%96%87%E4%BB%B6%E6%97%A0%E6%B3%95%E9%80%9A%E8%BF%87%20Zend%20%E6%88%96%E5%85%B6%E4%BB%96%20PHP%20%E7%A8%8B%E5%BA%8F%E9%87%8D%E5%91%BD%E5%90%8D.png)
我们有几个使用 Zend Framework 2 的虚拟服务器。突然,当应用程序尝试将 TMP 文件重命名为其永久位置时,我们收到错误。
以下是错误消息的一个示例:
Message:
File '/tmp/php4i88d1' could not be renamed. An error occurred while processing the file.
Stack trace:
#0 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/File/RenameUpload.php(194): Zend\Filter\File\RenameUpload->moveUploadedFile('/tmp/php4i88d1', 'public/uploads/...')
#1 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/AbstractFilter.php(89): Zend\Filter\File\RenameUpload->filter(Array)
#2 [internal function]: Zend\Filter\AbstractFilter->__invoke(Array)
#3 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/FilterChain.php(225): call_user_func(Object(Zend\Filter\File\RenameUpload), Array)
#4 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-inputfilter/src/FileInput.php(70): Zend\Filter\FilterChain->filter(Array)
#5 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-inputfilter/src/BaseInputFilter.php(406): Zend\InputFilter\FileInput->getValue()
#6 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-form/src/Form.php(355): Zend\InputFilter\BaseInputFilter->getValues()
#7 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-form/src/Form.php(516): Zend\Form\Form->bindValues()
#8 /part2/sites/beta-ppa2/ZendSkeletonApplication/module/Admin/src/Admin/Controller/TemplateController.php(193): Zend\Form\Form->isValid()
#9 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): Admin\Controller\TemplateController->editTemplateAction()
#10 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#11 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#12 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#15 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#16 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#17 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#18 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#19 /part2/sites/beta-ppa2/ZendSkeletonApplication/public/index.php(23): Zend\Mvc\Application->run()
#20 {main}
Previous exceptions:
ErrorException
File:
/part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/File/RenameUpload.php:216
Message:
move_uploaded_file(): Unable to move '/tmp/php4i88d1' to 'public/uploads/templatedocumentmaster/11ff5789fdd6c52e860f2e12aba90c17.jpg'
Stack trace:
#0 [internal function]: Zend\Stdlib\ErrorHandler::addError(2, 'move_uploaded_f...', '/part2/sites/be...', 216, Array)
#1 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/File/RenameUpload.php(216): move_uploaded_file('/tmp/php4i88d1', 'public/uploads/...')
#2 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/File/RenameUpload.php(194): Zend\Filter\File\RenameUpload->moveUploadedFile('/tmp/php4i88d1', 'public/uploads/...')
#3 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/AbstractFilter.php(89): Zend\Filter\File\RenameUpload->filter(Array)
#4 [internal function]: Zend\Filter\AbstractFilter->__invoke(Array)
#5 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-filter/src/FilterChain.php(225): call_user_func(Object(Zend\Filter\File\RenameUpload), Array)
#6 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-inputfilter/src/FileInput.php(70): Zend\Filter\FilterChain->filter(Array)
#7 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-inputfilter/src/BaseInputFilter.php(406): Zend\InputFilter\FileInput->getValue()
#8 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-form/src/Form.php(355): Zend\InputFilter\BaseInputFilter->getValues()
#9 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-form/src/Form.php(516): Zend\Form\Form->bindValues()
#10 /part2/sites/beta-ppa2/ZendSkeletonApplication/module/Admin/src/Admin/Controller/TemplateController.php(193): Zend\Form\Form->isValid()
#11 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): Admin\Controller\TemplateController->editTemplateAction()
#12 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#13 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#14 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#15 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#16 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#17 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#18 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#19 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#20 /part2/sites/beta-ppa2/ZendSkeletonApplication/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#21 /part2/sites/beta-ppa2/ZendSkeletonApplication/public/index.php(23): Zend\Mvc\Application->run()
#22 {main}
知道为什么会突然发生这种情况吗?我们已经两天多没有更新二进制文件或服务器文件了 - 从那时起这两个独立的应用程序就运行良好。它们位于同一台服务器上,但应用程序不同。
这些是运行 Amazon Linux AMI 的 AWS 服务器上的站点。需要注意的是,这些相同的应用程序在开发服务器上运行良好。这只发生在生产服务器上。TMP 目录和目标目录都具有完全权限和适当的所有权 - 几个月来那里没有任何变化。
提前感谢你的帮助!
答案1
问题找到了。分区确实满了。我们读到的 25% 可用空间是不正确的 - 分区已满 100%。
这是答案,真傻。但也许这会对其他人有所帮助。
感谢所有提供帮助的人!