Warning: ZipArchive::extractTo(/var/www/html/agendarpost/.env): failed to open stream: Permission denied in /var/www/html/agendarpost/install.php on line 71
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!
When running with mod_php on Apache your php processes will run as the user www-data as Apache itself does. This error would occur if you uploaded your files to the web server as the “root” user.
You can ensure that the correct ownership is set by running:
chown -Rf www-data:www-data /var/www/
Let us know if the problem persists after this change.
The “Permission denied” error you’re encountering when using ZipArchive::extractTo() indicates that the Apache user (typically www-data on Ubuntu or apache on CentOS) does not have the necessary write permissions to the target directory (/var/www/html/agendarpost/).
sudo chown -R www-data:www-data /var/www/html/agendarpost
sudo chmod -R 755 /var/www/html/agendarpost
www-data) owns the directory and has write permissions..env) you’re trying to extract can also be written by the Apache user. If needed, adjust the permissions:sudo chmod 644 /var/www/html/agendarpost/.env
ZipArchive: If you only want to give write permissions to ZipArchive operations without altering global permissions, consider changing ownership for the specific user or group responsible for Apache.sudo chown -R www-data:www-data /var/www/html/agendarpost
sestatus
If SELinux is enforcing, you can either adjust the SELinux policy or temporarily disable it to test if that’s the issue:
sudo setenforce 0
If this resolves the issue, you’ll need to adjust SELinux policies properly to allow Apache to write to the directory.
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.