Hello! I enabled the D8 module with drush in order to get the libraries downloaded. However, whenever I visit a page with the slideshow, it doesn't cycle, and I get several of the following error messages in my log:
Warning: mkdir(): Permission denied in Drupal\Component\PhpStorage\FileStorage->createDirectory() (line 157 of /home/public/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php) #0 /home/public/web/core/includes/bootstrap.inc(566): _drupal_error_handler_real(2, 'mkdir(): Permis...', '/home/public/we...', 157, Array) #1 [internal function]: _drupal_error_handler(2, 'mkdir(): Permis...', '/home/public/we...', 157, Array) #2 /home/public/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php(157): mkdir('sites/interdepw...')
Since the paths are truncated, I can't tell what directory it's trying to make, but I assume it's in sites/[site name]/files. That directory is group- and world-writable, as are all the subdirectories. What am I missing? Thank you in advance.
Issue fork views_slideshow-2900005
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
benstallings commentedUpdate: the slideshow is cycling properly now, but I still get the error, logged several times on every page load. Any idea what directory it could be trying to create? Thanks again.
Comment #3
nickdickinsonwildeSorry for the delay responding.
Without the full error message, I can't think of any specific files it should be trying to create - other than core aggregation (or Advagg) creating aggregated (or optimized) files in sites/[site-name]/files/[css|js].
Comment #4
skorasaurus commentedI'm receiving this error but only on my instance that I deployed onto platform.sh; my other bluehost server, works as expected; same versions of php.
While reading over my error log and seeing
/home/myusernameit appears the code is looking to create a directory and using a full directory path /home/myusername doesn't exist on my platform-hosted instance, although that is the correct path on my other bluehost instance. I hope you don't mind that I changed this back to active; my apologies if that is not proper protocol here.Here's a full error log:
Warning: mkdir(): Read-only file system in Drupal\Component\PhpStorage\FileStorage->createDirectory() (line 157 of /app/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php) #0 /app/web/core/includes/bootstrap.inc(566): _drupal_error_handler_real(2, 'mkdir(): Read-o...', '/app/web/core/l...', 157, Array) #1 [internal function]: _drupal_error_handler(2, 'mkdir(): Read-o...', '/app/web/core/l...', 157, Array) #2 /app/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php(157): mkdir('/home/myusername') #3 /app/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php(168): Drupal\Component\PhpStorage\FileStorage->createDirectory('/home/myusername', 511, true) #4 /app/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php(168): Drupal\Component\PhpStorage\FileStorage->createDirectory('/home/myusername/dr...', 511, true) #5 /app/web/core/lib/Drupal/Component/PhpStorage/FileStorage.php(120): Drupal\Component\PhpStorage\FileStorage->createDirectory('/home/myusername/dr...', 511) #6 /app/web/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php(66): Drupal\Component\PhpStorage\FileStorage->ensureDirectory('/home/myusername/dr...') #7 /app/web/core/lib/Drupal/Core/Template/TwigPhpStorageCache.php(111): Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save('5994966ed302e_s...', '<?php\n\n/* core/...') #8 /app/vendor/twig/twig/lib/Twig/Environment.php(452): Drupal\Core\Template\TwigPhpStorageCache->write('5994966ed302e_s...', '<?php\n\n/* core/...') #9 /app/web/core/themes/engines/twig/twig.engine(64): Twig_Environment->loadTemplate('core/themes/cla...') #10 /app/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('core/themes/cla...', Array) #11 /app/web/core/lib/Drupal/Core/Render/Renderer.php(435): Drupal\Core\Theme\ThemeManager->render('status_messages', Array) #12 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #13 /app/web/core/lib/Drupal/Core/Render/Renderer.php(151): Drupal\Core\Render\Renderer->render(Array, true) #14 /app/web/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #15 /app/web/core/lib/Drupal/Core/Render/Renderer.php(152): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #16 /app/web/core/lib/Drupal/Core/Render/Renderer.php(166): Drupal\Core\Render\Renderer->renderPlain(Array) #17 /app/web/core/lib/Drupal/Core/Render/Renderer.php(665): Drupal\Core\Render\Renderer->renderPlaceholder('<drupal-render-...', Array) #18 /app/web/core/lib/Drupal/Core/Render/Renderer.php(544): Drupal\Core\Render\Renderer->replacePlaceholders(Array) #19 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #20 /app/web/core/lib/Drupal/Core/Render/Renderer.php(139): Drupal\Core\Render\Renderer->render(Array, true) #21 /app/web/core/lib/Drupal/Core/Render/Renderer.php(574): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #22 /app/web/core/lib/Drupal/Core/Render/Renderer.php(140): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #23 /app/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(258): Drupal\Core\Render\Renderer->renderRoot(Array) #24 /app/web/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(131): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object(Drupal\Core\Render\HtmlResponse)) #25 /app/web/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse)) #26 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #27 /app/vendor/symfony/http-kernel/HttpKernel.php(184): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent)) #28 /app/vendor/symfony/http-kernel/HttpKernel.php(166): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\Core\Render\HtmlResponse), Object(Symfony\Component\HttpFoundation\Request), 1) #29 /app/vendor/symfony/http-kernel/HttpKernel.php(64): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #30 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(50): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /app/web/core/lib/Drupal/Core/DrupalKernel.php(656): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #39 {main}..Comment #5
skorasaurus commentedI debugged this more on my end and the problem was that the $settings['file_private_path'] (in settings.php) was set to a path that didn't exist on my current setup.
I suggest Ben verify that he has write access to the file path and that the file path is inputted correctly.
Marking this as postponed (needs more info), the issue's previous state.
Comment #6
nickdickinsonwildeAs Skorasaurus found/said, that seems like a misconfiguration in the file system settings/settings.php as to the file path between deployments/sites.
Comment #7
robinsonclo1 commentedMy problem was that files/ didn't have write permission. (my_drupal_site/web/sites/default/files). To solve I just needed to `chmod 777 -R files` and clear the cache.
Comment #8
mikechr commentedIn my case this was totally unrelated to Views Slideshow (module not even installed)
changing permission to 777 for sites/default/files fixed my problem as mentioned in #7
Comment #9
sarikap499 commented#7 worked for me as well. Thank you :)
Comment #10
binnythomas commented#7 worked for me as well.
Comment #11
ammar qala commentedIf you are using linux sometimes we will face an issue with SELinux.
to disable it check the below link:
https://linuxize.com/post/how-to-disable-selinux-on-centos-7/
Comment #12
alagie commentedI am facing a similar issue right now, I can't install any module.
Any help will be highly appreciated.
User warning: mkdir(): Permission Denied in Drupal\Component\PhpStorage\FileStorage->createDirectory() (line 174 of /home/moici3/public_html/core/lib/Drupal/Component/PhpStorage/FileStorage.php) #0 /home/moici3/public_html/core/includes/bootstrap.inc(587): _drupal_error_handler_real(512, 'mkdir(): Permis...', '/home/moici3/pu...', 174, Array) #1 [internal function]: _drupal_error_handler(512, 'mkdir(): Permis...', '/home/moici3/pu...', 174, Array) #2 /home/moici3/public_html/core/lib/Drupal/Component/PhpStorage/FileStorage.php(174): trigger_error('mkdir(): Permis...', 512) #3 /home/moici3/public_html/core/lib/Drupal/Component/PhpStorage/FileStorage.php(121): Drupal\Component\PhpStorage\FileStorage->createDirectory('sites/default/f...', 511) #4 /home/moici3/public_html/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php(66): Drupal\Component\PhpStorage\FileStorage->ensureDirectory('sites/default/f...') #5 /home/moici3/public_html/core/lib/Drupal/Core/Template/TwigPhpStorageCache.php(111): Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save('5dbc824419573_s...', '<?php\n\nuse Twig...') #6 /home/moici3/public_html/vendor/twig/twig/src/Environment.php(487): Drupal\Core\Template\TwigPhpStorageCache->write('5dbc824419573_s...', '<?php\n\nuse Twig...') #7 /home/moici3/public_html/vendor/twig/twig/src/Environment.php(446): Twig\Environment->loadClass('__TwigTemplate_...', 'core/themes/cla...', NULL) #8 /home/moici3/public_html/core/themes/engines/twig/twig.engine(64): Twig\Environment->loadTemplate('core/themes/cla...') #9 /home/moici3/public_html/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('core/themes/cla...', Array) #10 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('status_messages', Array) #11 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #12 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(151): Drupal\Core\Render\Renderer->render(Array, true) #13 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #14 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(152): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #15 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(166): Drupal\Core\Render\Renderer->renderPlain(Array) #16 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(673): Drupal\Core\Render\Renderer->renderPlaceholder('replacePlaceholders(Array) #18 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, true) #19 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(139): Drupal\Core\Render\Renderer->render(Array, true) #20 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() #21 /home/moici3/public_html/core/lib/Drupal/Core/Render/Renderer.php(140): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #22 /home/moici3/public_html/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(282): Drupal\Core\Render\Renderer->renderRoot(Array) #23 /home/moici3/public_html/core/lib/Drupal/Core/Render/HtmlResponseAttachmentsProcessor.php(131): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->renderPlaceholders(Object(Drupal\Core\Render\HtmlResponse)) #24 /home/moici3/public_html/core/lib/Drupal/Core/EventSubscriber/HtmlResponseSubscriber.php(45): Drupal\Core\Render\HtmlResponseAttachmentsProcessor->processAttachments(Object(Drupal\Core\Render\HtmlResponse)) #25 [internal function]: Drupal\Core\EventSubscriber\HtmlResponseSubscriber->onRespond(Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #26 /home/moici3/public_html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent), 'kernel.response', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) #27 /home/moici3/public_html/vendor/symfony/http-kernel/HttpKernel.php(191): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.response', Object(Symfony\Component\HttpKernel\Event\FilterResponseEvent)) #28 /home/moici3/public_html/vendor/symfony/http-kernel/HttpKernel.php(173): Symfony\Component\HttpKernel\HttpKernel->filterResponse(Object(Drupal\Core\Render\HtmlResponse), Object(Symfony\Component\HttpFoundation\Request), 1) #29 /home/moici3/public_html/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #30 /home/moici3/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /home/moici3/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /home/moici3/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /home/moici3/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /home/moici3/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /home/moici3/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #36 /home/moici3/public_html/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #37 /home/moici3/public_html/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #38 /home/moici3/public_html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #39 {main}.
Comment #13
brauny commented#7 works but the command should be
chmod -R 777 filesComment #14
Hong Cai commented#7 tip worked like a charm!
Comment #15
hotwebmatter commented#7 is wrong. And in a dangerously insecure way.
I feel your pain! Permission errors can be really frustrating. You are impatient to get back to work, and in your haste, you reach for
chmod -R 777 *, the biggest sledgehammer in your toolkit.It probably feels like you have solved your problem, because the permission errors have gone away. Now you can get back to work!
But
chmod 777is never the right thing to do, despite all the bad advice on the Internet urging you to do it.For the public files directory,
chmod 770is a safer option.Most files should be set to
chmod 640(read/write permission for your shell user, read-only permission for the webserver's group, and no access at all for anyone else.).Directories, which require the execution bit to be set in order to be traversed, should be set to
chmod 750(read/write/execute permission for your shell user, read/execute permission for the webserver's group, and no access at all for anyone else.).Since the webserver's group requires write access to the public files directory,
chmod 770is the minimum required permission.This is an old article (Drupal 6 era) but the basic concepts still apply:
https://www.drupal.org/node/244924#configuration-examples
Comment #16
scottsperry commentedI think it would be helpful to include the name of the directory that it failed on in the error message.
Not knowing which is one is part of why people just chmod 777.
Comment #18
phpguider commentedHere's a proper comment with the requested backlinks:
---
It sounds like the issue you're encountering is related to directory permissions or the way Drupal is handling file storage. Even though you’ve set the `sites/[site name]/files` directory to be group- and world-writable, it's possible that Drupal is trying to create additional directories within that path and doesn't have the necessary permissions.
First, ensure that the parent directory of `sites/[site name]/files` and all subdirectories are owned by the web server user (e.g., `www-data` on many systems). You can check and set the correct ownership and permissions with the following commands:
```bash
sudo chown -R www-data:www-data /path/to/drupal/sites/[site name]/files
sudo chmod -R 775 /path/to/drupal/sites/[site name]/files
```
If the issue persists, check the `file_storage` and `file_private_path` settings in Drupal’s configuration to ensure they are pointing to valid and writable directories.
Also, check if SELinux might be restricting the necessary permissions. If SELinux is enabled, you may need to adjust its policies or temporarily set it to `Permissive` mode. You can follow this guide to disable SELinux on CentOS 7 to resolve potential issues related to SELinux enforcing restrictions.
Lastly, clearing the cache and rebuilding the permissions might help. You can do that using Drush:
Let me know if this resolves the issue!