为什么 Drupal 不能创建临时文件?
Why Drupal can not create a temporary file?
我从我的 drupal 站点克隆了一个存储库到本地环境 运行在 windows 机器上使用 MAMP PRO。所有文件和数据库都已正确设置。当我尝试 运行 Drupal 8 时出现此错误。我知道这是一个权限问题,但我不确定在哪里更改权限或做什么。我尝试了很多设置,但得到了相同的结果。
Drupal\Core\File\Exception\FileWriteException: Temporary file 'temporary://filF92B.tmp' could not be created. in Drupal\Core\File\FileSystem->saveData() (line 521 of core\lib\Drupal\Core\File\FileSystem.php).
Drupal\google_tag\Entity\ContainerManager->saveSnippets(Object) (Line: 77)
Drupal\google_tag\Entity\ContainerManager->createAssets(Object) (Line: 160)
Drupal\google_tag\Entity\ContainerManager->getScriptAttachments(Array) (Line: 70)
google_tag_page_attachments(Array) (Line: 297)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 273)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
转到管理员 -> 配置 -> 媒体 -> 文件系统 (/admin/config/media/file-system
) 以获取您的临时路径。确保它具有 Apache 用户的正确权限。
好的,看来不需要访问管理面板来更改临时目录。在 settings.php 中,我能够修改下面的行来设置它。清除 Drupal 缓存并添加 .htaccess 文件后,它起作用了。
$settings['file_temp_path'] = '/tmp';
我在本地使用 XAMPP 处理生产站点的副本时遇到了这个问题。
我解决了它添加到 settings.php:
$settings["file_temp_path"] = sys_get_temp_dir();
我从我的 drupal 站点克隆了一个存储库到本地环境 运行在 windows 机器上使用 MAMP PRO。所有文件和数据库都已正确设置。当我尝试 运行 Drupal 8 时出现此错误。我知道这是一个权限问题,但我不确定在哪里更改权限或做什么。我尝试了很多设置,但得到了相同的结果。
Drupal\Core\File\Exception\FileWriteException: Temporary file 'temporary://filF92B.tmp' could not be created. in Drupal\Core\File\FileSystem->saveData() (line 521 of core\lib\Drupal\Core\File\FileSystem.php).
Drupal\google_tag\Entity\ContainerManager->saveSnippets(Object) (Line: 77)
Drupal\google_tag\Entity\ContainerManager->createAssets(Object) (Line: 160)
Drupal\google_tag\Entity\ContainerManager->getScriptAttachments(Array) (Line: 70)
google_tag_page_attachments(Array) (Line: 297)
Drupal\Core\Render\MainContent\HtmlRenderer->invokePageAttachmentHooks(Array) (Line: 273)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 117)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
转到管理员 -> 配置 -> 媒体 -> 文件系统 (/admin/config/media/file-system
) 以获取您的临时路径。确保它具有 Apache 用户的正确权限。
好的,看来不需要访问管理面板来更改临时目录。在 settings.php 中,我能够修改下面的行来设置它。清除 Drupal 缓存并添加 .htaccess 文件后,它起作用了。
$settings['file_temp_path'] = '/tmp';
我在本地使用 XAMPP 处理生产站点的副本时遇到了这个问题。 我解决了它添加到 settings.php:
$settings["file_temp_path"] = sys_get_temp_dir();