使用symlink和php包括外部用户';s目录中的cPanel


Using symlink and php includes outside user's directory with cPanel

我有一个带cPanel的专用服务器,托管我们的自定义后端系统和多个网站。后端托管在一个单独的域上,并包含一个文件夹("共享"),该文件夹包含许多php类和图像,这些类和图像由后端控制的所有网站使用。

For example:
Backend: 'backend.com'
Website 1: 'website1.com'
Website 2: 'website2.com'
etc.

我从website1.com创建了一个符号链接,如下所示:

ln -s /home/backend/public_html/shared/ /home/website1/public_html/shared

然后,我在cPanel中禁用了website1.com的open_basedir保护,并创建了一个.user.ini文件来设置open_basedir值:

open_basedir = /home/website1/public_html/:/home/backend/public_html/shared/

当我试图通过(符号链接的)共享文件夹中的website1.com访问文件时,我收到一个500内部服务器错误。apache日志显示:

[Fri Nov 20 03:51:45 2015] [error] [client xxx.xxx.xx.xx] SoftException in Application.cpp:422: Mismatch between target UID (513) and UID (512) of file "/home/website1/public_html/shared/__debug.php"
[Fri Nov 20 03:51:45 2015] [error] [client xxx.xxx.xx.xx] Premature end of script headers: __debug.php

我知道用户/组之间不匹配,但有办法解决这个问题吗?

用Cpanel Addon域修复了它。这样,所有域都托管在同一个cPanel帐户中,并且不存在所有权问题。