PHP permissions on a VirtualBox Windows-guest shar

2019-08-30 07:45发布

I have a PHP website with a backend batch/CRON job that runs ever so often and processes photos. The web and database servers and RAID storage are Fedora 14 boxes and the photo software runs in a Windows 7 VirtualBox on the storage server.

The storage array is loaded as a shared folder and shows up as E:\ under Network Locations.

The PHP exec command runs every minute via PHP-CLI looks like this:

exec("C:\\service\\photo_edit.exe --input-file E:\\photos\\photo_example.jpg --effect crossprocess --output-file E:\\photos\\user\\finished_example.jpg")

Running the command directly in the command line works. The thing is, PHP can't seem to use E:\ at all, even though I can access it through the Command Prompt. I also have to keep Windows in a VirtualBox because I have more services that edit files and run in Linux.

I need PHP to be able to work with these files on the web storage inside Windows.

2条回答
乱世女痞
2楼-- · 2019-08-30 08:05

Does PHP have permission to access E:\? Just remember that when you run the command, you're probably an Administrator. PHP, on the other hand, is likely running with lower privileges.

查看更多
别忘想泡老子
3楼-- · 2019-08-30 08:16

It isn't a permissions issue. Network shares mapped to a drive letter are a per-user setting. The user Apache runs as does not have that share mapped as E:.

Alternatives include:

  1. Use the UNC syntax: \\vboxsvr\whatever
  2. Map the drive for current Apache user (LOCAL_SYSTEM?) — Does not seem possible
  3. Change the user the Apache service runs as
查看更多
登录 后发表回答