By Shola
Hello everyone,
I encounter two issues with my laravel web app each time I “git push” to the server. Everything works fine on the local machine (Mac). I am running nginz server on DigitalOcean.
1- Each time I “git push” to remote, all the pictures only the website get broken. The only way I solve this is, cd to public/storage, delete the storage folder and then run php artisan storage:link. This is tedious because I have to do it every time I “git push” to remote.
2- Each time I “git push” to remote and when I try to updating/populating any of my tables, I receive this error after the table has been updated/populated:
(1/1) PDOException SQLSTATE[HY000]: General error: 8 attempts to write a readonly database
Sinc,e I am using TNTSearch package, I notice it tries to write to the index file. I figured out that I need to give permission to the database, so I solve this issue using: chmod -R 0777 /path/to/index . This solves the problem but it recurs when I “git push” to the remote.
How can I give a permanent write permission to public/storage (in the first case) so that I do not have to run the command each time I push to remote? Also, How do I give a permanent write permission to the database, so that I do not have to do that each time I push to remote?
Thank you in advance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
If you have specific tasks that must be completed (e.g. running php artisan storage:link) after each push to your production server, you might consider using git hooks to automate them. Placing a script at .git/hooks/post-receive will cause it to run on the git remote each time it receives a push.
Find out more details about using git hooks in this tutorial:
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.