Curlftpfs mount can't reach files via apache webserver

941 Views Asked by At

I have mounted a directory via curlftpfs. I am trying to access the files from within this mount via a webserver.

The path to the mounted directory is

'/home/domain.nl/domains/cms.domain.nl/public_html/project/1/syslink/'

The strange thing is that PHP can read and write from/to that directory. But when i try to access the folder from my apache webserver, then i get the error:

403 Forbidden

You don't have permission to access /project/1/syslink/file.jpg on this server.

The output when I run exec('whoami') in php is:

urre

That is also the user that created the curlftpfs mount, so the rights are not the issue.

When I log in to the linux CLI with this user, I can access the mounted directory...

1

There are 1 best solutions below

0
On BEST ANSWER

Apache Webserver requires the user "www-data" to be able to read and write to a folder / document. You must change, either your FTP mount user to "www-data" or change your Apache running user.

In /etc/fstab

curlftpfs#user:pass@domain/directory fuse auto,user,uid=www-data,allow_other,_netdev 0 0

If you would like to set the group as well, you can add "gid=www-data" to fstab

This should allow Apache to read and write to your mounted FTP directory.