是否可以从文本文件加载PHP函数?

I recently updated my server to use SuPHP to increase security.

One downside is that I used to be able to include files from my other domains hosted on my server using absolute paths to the file. This doesn't work anymore.

The file in particular that I include from other domains is my functions file which is huge and used on all my websites. For the sake of maintainability, I've been including a central file rather than uploading the file to each server every time I make changes.

I thought that saving the functions file as plain text and using file_get_contents() across domains might be the right way to go. But apparently this doesn't work.

Is there a way to make it work?

Or is there some other whizz bang function that can help me achieve my goal?

Cheers.

It sounds like you need configure open_base_dir in each of your websites vhosts so they are allowed to access the directory where these function files reside. You should put them in a common location.

open_basedir

Another alternative would be to use php_info() to check your include path to see if there is a suitable location already configured where you could place these files, then simply include using include()

include_path