ZipArchive extractTo not extraction file on apache php7

May 23, 2018 2.5k views
Ubuntu 16.04 Apache PHP

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

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.

Have another answer? Share your knowledge.