After uploading into cpanel Laravel 5.3 throwing InvalidArgumentException error - laravel

After Developing a test App using Laravel 5.3, When I uploaded to the Cpanel it throwing Invalid exception Error. According to error message the App looking for some files from my local PC.Even after clearing all files from Storage\framwork\session it behaves alike previous.
App link: http://autocomplete.bappasarkar.info/
NB: After first time uploading the app threw an error
The only supported ciphers are AES-128-CBC and AES-256-CBC
Then I generate key by the artisan command
"php artisan key:generate"
After generating key when the App uploaded for the second time , it's throwing the current Error.

You have permissions issue, the following commands are for *nix based OS's.
Try
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache

You can change the permission through ftp or file manager from Cpanel.

Related

403 error in Laravel storage directory only

I'm currently getting a 403 error on the storage directory.
I have tried the correct file path for both a php artisan link and the regular symlink from command line
The specific path is this one:
http://example.com/storage/app/public/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
This is linked to the storage directory:
to here: example.com/public/storage/*
I created the symlink like so:
ln -s /var/www/vhosts/example.com/httpdocs/storage /var/www/vhosts/mydomain.com/httpdocs/public
The above directory is for the symlink one but for php artisan link the url is slightly different.
the permissions set for storage before were executed running:
chmod -R 775 storage/
checking permissions I get this:
ls -la ./httpdocs
drwxr--r-- 5 pacer psacln 46 Apr 8 2021 storage
Everything else works except the storage directory. I've seen the other questions regarding 403 and have attempted those fixes but nothing is working. Any idea what I'm doing wrong?
The storage link points directly to the "app/public" folder.
So the link address will look like this :
http://example.com/storage/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
first : run commint
php artisan storage:link
http://example.com/storage/category/zASySdXhEtXBaeWoz4KLJoIVLVxm3W6jRr6gHQhN.jpg
After a while spent on this the error was caused because I ran the php artisan storage:link and ln -s link with root. Therefore the link was unaccessible by my server for public consumption.
My solution was to switch to user:
su myUser
Then run the php artisan storage:link

Laravel 7 deployment on Heroku failed - missing session

My Laravel 7 app deploys to Heroku without any errors during deployment. However, upon opening the app in the browser, I received the following Error Exception:
file_put_contents(/tmp/build_d3cb80e3d9d066f9486ad70783e0f0ba/storage/framework/sessions/BbnXCLFvgRPnTFSdQFvBYlmDhTfaIaesjbCsdVb8): failed to open stream: No such file or directory
I then ran artisan config:clear and redeployed (something which seemed to fix the problem for most others in Laravel 5) but no change.
I then went into config/session and changed 'expire_on_close' to true. I also changed lottery from [2,100] to [100,100] so that all sessions in storage would be swept on each request instead of only in 2% of cases.
I ran artisan config:clear again before redeploying. The Error Exception has now changed to the following:
Symfony\Component\Finder\Exception\DirectoryNotFoundException
The "/tmp/build_d5d0270f_/storage/framework/sessions" directory does not exist.
Note: I am deploying through Github.
I have successfully ran the following commands on the Heroku console:
chmod -R 770 bootstrap/cache
chmod -R 770 storage

Unable to configure Laravel storage symlink

Tired of searching :-(
Configuration:
AWS (Instance)
Ubuntu 14.04.6 LTS
Laravel 5.8
Project root -> Permission and ownership
Inside project root
php artisan storage:link
project/public
Browser console says:
The complete project is working fine, even I am able to upload as follows.
$request->file('picture')->store('profile_pictures', 'public')
You might want to try this.
cd /var/www/html/yourproject
chmod -R 755 storage
chown -R www-data:www-data storage
Thanks.

How to access Laravel Folder in Google Cloud

I received an error on my Laravel App
/app/storage/logs/laravel-2020-02-20.log" could not be opened: failed to open stream: Permission denied
So I google the error, and I discovered it a permission error.
chmod -R 775 storage
chmod -R 775 bootstrap/cache
Apparently, this fixes the error, but anytime I tried to run the command in the cloud console. It keeps saying
No directory found.
Can someone advice me on how to access storage directory.
From the tags, I can tell it is GAE flex on GCP. Flex gives you SSH access, but it is not advisable to execute read/write operations directly on the Instances as they are preemptive - can be restarted anytime by GCP. So any command you execute will have to be repeated whenever a new instance starts, which will of course defeats the purpose of scalability on GAE flex.
Try this instead:
On the composer.json file in your project directory, add the follow to the scripts:
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"#php artisan optimize",
"chmod -R 755 storage bootstrap\/cache" ]
For more info, check this community link: https://cloud.google.com/community/tutorials/run-laravel-on-appengine-flexible

Laravel 5.3 Cannot Find File Error

I've setup a project more than a month ago and all of a sudden (this afternoon) I started getting the following error:
ErrorException in Filesystem.php line 111: file_put_contents(/var/www/html/project/api/storage/framework/cache/d8/00/d800874b5dc22b961e0ee92f8d1c5a09c24ee911): failed to open stream: No such file or directory
I've done research and tried the following with no success:
php artisan cache:clear
chmod -R 777 storage (I know this is not ideal)
composer update
Nothing is working. Before the chmod I was getting a permission error. I'm tapped out of ideas. Does anyone know what is causing this and how to resolve it?
You gave 777 to /storage folder but did you also make sure it's in same group as apache server is running?
Generally apache is in www-data group, add storage and bootstrap folder to be written by this group:
chgrp -R www-data /storage /bootstrap
Assign current user and group permission to read and write:
chmod -R ug+rw /storage /bootstrap
I'm 99% sure this will do it.
My server runs CentOS 7 and somehow Selinux was set to enforcing which breaks Laravel for some reason. I remember changing it when I first set up Laravel, but somehow it reverted back.
So setting it to permissive or disabled fixed it for me.
https://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html

Resources