ZipArchive extractTo not extraction file on apache php7

Posted May 23, 2018 7.2k views
ApachePHPUbuntu 16.04

Warning: ZipArchive::extractTo(/var/www/html/agendarpost/.env): failed to open stream: Permission denied in /var/www/html/agendarpost/install.php on line 71

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

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.