InvalidArgumentException : Cannot write to directory | running LaravelDefault file permissions for php user www-dataForceably set permissions when running rsyncError after upgrading Bugzilla from 4.0 to 4.0.2How to get access from nginx on host OS to files inside lxc-container?Permission denied when trying to write a file from bash script run from www-dataMysql error when running Laravel php migrations(Another!) question about www-data privileges and root - but with a twistEditing sudoers.d to allow www-data run a specific file
Why don't airports use arresting gears to recover energy from landing passenger planes?
How can I show the remaining time for a caffeinate command?
Would a hotel in Turkey question absence of entry stamp in passport?
Meaning of Swimming their horses
Prove that a convergent real sequence always has a smallest or a largest term
Can I travel to European countries with the Irish passport and without destination Visa?
Test to know when to use GLM over Linear Regression?
Does a large scratch in an ND filter affect image quality?
What 68-pin connector is this on my 2.5" solid state drive?
What was the ultimate objective of The Party in 1984?
Building Truncatable Primes using Nest(List), While, Fold
Difference between system uptime and last boot time in windows
Why is belonging not transitive?
Wrong Schengen Visa exit stamp on my passport, who can I complain to?
Access parent controller attribute from Visual force component
Has SHA256 been broken by Treadwell Stanton DuPont?
Unable to find solution to 6 simultaneous equations
How do we know that black holes are spinning?
Is "you will become a subject matter expert" code for "you'll be working on your own 100% of the time"?
What would happen if Protagoras v Euathlus were heard in court today?
Block diagram vs flow chart?
Shouldn't countries like Russia and Canada support global warming?
Make 1998 using the least possible digits 8
What was the motivation for the invention of electric pianos?
InvalidArgumentException : Cannot write to directory | running Laravel
Default file permissions for php user www-dataForceably set permissions when running rsyncError after upgrading Bugzilla from 4.0 to 4.0.2How to get access from nginx on host OS to files inside lxc-container?Permission denied when trying to write a file from bash script run from www-dataMysql error when running Laravel php migrations(Another!) question about www-data privileges and root - but with a twistEditing sudoers.d to allow www-data run a specific file
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
this may be an easy error but I've been stuck in this one for 3 days now.
I'm not a very experienced coder. It's my first time using Laravel too. I bought this script with a guide (at least something like a guide) that I follow but still get InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"when I run php artisan db:seed to populate the page and database with dummy data.
I'm running on 18.04 with LEMP stack and a user in sudo and www-data groups. What I did was upload the script into /var/www via SMTP and unzip and proceeded to run these commands in order (as given by the guide):
sudo chown myuser:myuser /var/www/blog
cd /var/www/blog
composer install
sudo chown -R www-data:www-data /var/www/blog/public
sudo chmod 755 /var/www
sudo chmod -R 755 /var/www/blog/bootstrap/cache
sudo chmod -R 755 /var/www/blog/storage
php artisan storage:link
sudo mkdir /var/www/blog/storage/public/products
sudo chmod -R 755 /var/www/blog/storage/public/products
sudo chgrp -R www-data /storage/public/products
sudo chmod -R ug+rwx /storage/public/products
And then I proceeded to fill .env with the database info and everything went fine from database configuration to migrating and then the last step is the db:seed to check, that where I got stuck. Been reinstalling OS several times, trying some ways I find on google... so here I am.
permissions sudo directory laravel
|
show 1 more comment
this may be an easy error but I've been stuck in this one for 3 days now.
I'm not a very experienced coder. It's my first time using Laravel too. I bought this script with a guide (at least something like a guide) that I follow but still get InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"when I run php artisan db:seed to populate the page and database with dummy data.
I'm running on 18.04 with LEMP stack and a user in sudo and www-data groups. What I did was upload the script into /var/www via SMTP and unzip and proceeded to run these commands in order (as given by the guide):
sudo chown myuser:myuser /var/www/blog
cd /var/www/blog
composer install
sudo chown -R www-data:www-data /var/www/blog/public
sudo chmod 755 /var/www
sudo chmod -R 755 /var/www/blog/bootstrap/cache
sudo chmod -R 755 /var/www/blog/storage
php artisan storage:link
sudo mkdir /var/www/blog/storage/public/products
sudo chmod -R 755 /var/www/blog/storage/public/products
sudo chgrp -R www-data /storage/public/products
sudo chmod -R ug+rwx /storage/public/products
And then I proceeded to fill .env with the database info and everything went fine from database configuration to migrating and then the last step is the db:seed to check, that where I got stuck. Been reinstalling OS several times, trying some ways I find on google... so here I am.
permissions sudo directory laravel
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
Well, then dogrep -r "public\products" *in your application root directory. Three backslashes.
– Jos
Apr 15 at 11:39
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products"database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false);it seems it cannot write into it, having an image of a dummy data.
– osozos
Apr 15 at 11:51
So there in/database/seeds/ProductSeeder.phpyou have a path with backslashes. Replace these by forward slashes (/) and try again.
– Jos
Apr 15 at 12:28
|
show 1 more comment
this may be an easy error but I've been stuck in this one for 3 days now.
I'm not a very experienced coder. It's my first time using Laravel too. I bought this script with a guide (at least something like a guide) that I follow but still get InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"when I run php artisan db:seed to populate the page and database with dummy data.
I'm running on 18.04 with LEMP stack and a user in sudo and www-data groups. What I did was upload the script into /var/www via SMTP and unzip and proceeded to run these commands in order (as given by the guide):
sudo chown myuser:myuser /var/www/blog
cd /var/www/blog
composer install
sudo chown -R www-data:www-data /var/www/blog/public
sudo chmod 755 /var/www
sudo chmod -R 755 /var/www/blog/bootstrap/cache
sudo chmod -R 755 /var/www/blog/storage
php artisan storage:link
sudo mkdir /var/www/blog/storage/public/products
sudo chmod -R 755 /var/www/blog/storage/public/products
sudo chgrp -R www-data /storage/public/products
sudo chmod -R ug+rwx /storage/public/products
And then I proceeded to fill .env with the database info and everything went fine from database configuration to migrating and then the last step is the db:seed to check, that where I got stuck. Been reinstalling OS several times, trying some ways I find on google... so here I am.
permissions sudo directory laravel
this may be an easy error but I've been stuck in this one for 3 days now.
I'm not a very experienced coder. It's my first time using Laravel too. I bought this script with a guide (at least something like a guide) that I follow but still get InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"when I run php artisan db:seed to populate the page and database with dummy data.
I'm running on 18.04 with LEMP stack and a user in sudo and www-data groups. What I did was upload the script into /var/www via SMTP and unzip and proceeded to run these commands in order (as given by the guide):
sudo chown myuser:myuser /var/www/blog
cd /var/www/blog
composer install
sudo chown -R www-data:www-data /var/www/blog/public
sudo chmod 755 /var/www
sudo chmod -R 755 /var/www/blog/bootstrap/cache
sudo chmod -R 755 /var/www/blog/storage
php artisan storage:link
sudo mkdir /var/www/blog/storage/public/products
sudo chmod -R 755 /var/www/blog/storage/public/products
sudo chgrp -R www-data /storage/public/products
sudo chmod -R ug+rwx /storage/public/products
And then I proceeded to fill .env with the database info and everything went fine from database configuration to migrating and then the last step is the db:seed to check, that where I got stuck. Been reinstalling OS several times, trying some ways I find on google... so here I am.
permissions sudo directory laravel
permissions sudo directory laravel
edited Apr 17 at 7:00
osozos
asked Apr 15 at 10:37
osozososozos
11 bronze badge
11 bronze badge
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
Well, then dogrep -r "public\products" *in your application root directory. Three backslashes.
– Jos
Apr 15 at 11:39
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products"database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false);it seems it cannot write into it, having an image of a dummy data.
– osozos
Apr 15 at 11:51
So there in/database/seeds/ProductSeeder.phpyou have a path with backslashes. Replace these by forward slashes (/) and try again.
– Jos
Apr 15 at 12:28
|
show 1 more comment
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
Well, then dogrep -r "public\products" *in your application root directory. Three backslashes.
– Jos
Apr 15 at 11:39
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products"database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false);it seems it cannot write into it, having an image of a dummy data.
– osozos
Apr 15 at 11:51
So there in/database/seeds/ProductSeeder.phpyou have a path with backslashes. Replace these by forward slashes (/) and try again.
– Jos
Apr 15 at 12:28
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
Well, then do
grep -r "public\products" * in your application root directory. Three backslashes.– Jos
Apr 15 at 11:39
Well, then do
grep -r "public\products" * in your application root directory. Three backslashes.– Jos
Apr 15 at 11:39
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products" database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false); it seems it cannot write into it, having an image of a dummy data.– osozos
Apr 15 at 11:51
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products" database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false); it seems it cannot write into it, having an image of a dummy data.– osozos
Apr 15 at 11:51
So there in
/database/seeds/ProductSeeder.php you have a path with backslashes. Replace these by forward slashes (/) and try again.– Jos
Apr 15 at 12:28
So there in
/database/seeds/ProductSeeder.php you have a path with backslashes. Replace these by forward slashes (/) and try again.– Jos
Apr 15 at 12:28
|
show 1 more comment
2 Answers
2
active
oldest
votes
Try to give write permission to www-data group on the products folder.
sudo chmod -R 775 /var/www/blog/storage/public/products
Still same errorInvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"
– osozos
Apr 15 at 10:53
add a comment
|
See the database seeds folder, look for the file that is responsible for filling with fake data (ProductSeeder)
find the line $ faker-> image (storage_path ('app public products') and change the slash in the opposite direction. Like this $ faker-> image (storage_path ('app / public / products')
add a comment
|
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1134045%2finvalidargumentexception-cannot-write-to-directory-running-laravel%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try to give write permission to www-data group on the products folder.
sudo chmod -R 775 /var/www/blog/storage/public/products
Still same errorInvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"
– osozos
Apr 15 at 10:53
add a comment
|
Try to give write permission to www-data group on the products folder.
sudo chmod -R 775 /var/www/blog/storage/public/products
Still same errorInvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"
– osozos
Apr 15 at 10:53
add a comment
|
Try to give write permission to www-data group on the products folder.
sudo chmod -R 775 /var/www/blog/storage/public/products
Try to give write permission to www-data group on the products folder.
sudo chmod -R 775 /var/www/blog/storage/public/products
answered Apr 15 at 10:41
Mohit MalviyaMohit Malviya
4362 silver badges7 bronze badges
4362 silver badges7 bronze badges
Still same errorInvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"
– osozos
Apr 15 at 10:53
add a comment
|
Still same errorInvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"
– osozos
Apr 15 at 10:53
Still same error
InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"– osozos
Apr 15 at 10:53
Still same error
InvalidArgumentException : Cannot write to directory "/var/www/blog/storage/apppublicproducts"– osozos
Apr 15 at 10:53
add a comment
|
See the database seeds folder, look for the file that is responsible for filling with fake data (ProductSeeder)
find the line $ faker-> image (storage_path ('app public products') and change the slash in the opposite direction. Like this $ faker-> image (storage_path ('app / public / products')
add a comment
|
See the database seeds folder, look for the file that is responsible for filling with fake data (ProductSeeder)
find the line $ faker-> image (storage_path ('app public products') and change the slash in the opposite direction. Like this $ faker-> image (storage_path ('app / public / products')
add a comment
|
See the database seeds folder, look for the file that is responsible for filling with fake data (ProductSeeder)
find the line $ faker-> image (storage_path ('app public products') and change the slash in the opposite direction. Like this $ faker-> image (storage_path ('app / public / products')
See the database seeds folder, look for the file that is responsible for filling with fake data (ProductSeeder)
find the line $ faker-> image (storage_path ('app public products') and change the slash in the opposite direction. Like this $ faker-> image (storage_path ('app / public / products')
answered May 4 at 16:06
Александр СтоляровАлександр Столяров
1
1
add a comment
|
add a comment
|
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1134045%2finvalidargumentexception-cannot-write-to-directory-running-laravel%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where do the back slashes () come from? They shouldn't occur in a proper Ubuntu path.
– Jos
Apr 15 at 10:58
I don't know as well, tbh.
– osozos
Apr 15 at 11:30
Well, then do
grep -r "public\products" *in your application root directory. Three backslashes.– Jos
Apr 15 at 11:39
storage/logs/laravel.log:[2019-04-15 10:51:36] local.ERROR: Cannot write to directory "/var/www/blog/storage/apppublicproducts" {"exception":"[object] (InvalidArgumentException(code: 0): Cannot write to directory "/var/www/blog/storage/app\public\products"database/seeds/ProductSeeder.php: $newImage = 'products/'. $faker->image(storage_path('apppublicproducts'),256,256, null, false);it seems it cannot write into it, having an image of a dummy data.– osozos
Apr 15 at 11:51
So there in
/database/seeds/ProductSeeder.phpyou have a path with backslashes. Replace these by forward slashes (/) and try again.– Jos
Apr 15 at 12:28