Share php files

Hi, I am hoping someone out there will be able to help me.

On our webserver we set up a couple of subdomains.

I want to be able to share the main functions.php to all the subdomains, saves duplication.

This used to work until the server crashed and i re-installed virtualmin.

for example.

<?php include('/home/intranet/public_html/classes/test_include.php'); ?>

gives the following errors
Warning: include(/home/intranet/public_html/classes/test_include.php) [function.include]: failed to open stream: Permission denied in /home/salesman/public_html/test_include.php on line 2

Warning: include() [function.include]: Failed opening ‘/home/intranet/public_html/classes/test_include.php’ for inclusion (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/salesman/public_html/test_include.php on line 2

I have searched the web and can not find a solution. can someone please help.

Thanks

Rob

Howdy,

Well, it sounds like you’re running into a permission issue of some sort.

Are all the domains you’re trying to load that content from located within the “/home/intranet” account? Or are they part of other accounts on the system?

-Eric

ps i have checked that the file has 0777.

Hi Eric,

They are all different accounts and which are different users and group.

Thanks Rob

Aha… I suspect the issue is related to directory permissions. One of the directories in the “/home/intranet/public_html/classes/” path isn’t likely accessible to the world.

My guess is that it’s “/home/intranet” in particular.

Try running:

chmod +x /home/intranet

After that, are you able to access your shared PHP?

-Eric

Thats great, Thanks you so so much :slight_smile:

Is secure give permision 751 (other: enter and execute) to /home/somefolder?
I have the same situation as “riking”

I have 3 diffrent accounts:

  • home/account-1
  • home/account-1/domains/account-3
  • home/account-2

I have a file php with critical information like user/pass for db access
I need share this file with these 3 accounts
The file is located: in home/account-2/api/functions.php

Setting 751 to home/account-2 and home/account-2/api
Can share home/account-2/api/functions.php

Another question is who has access to home folder?
root and all user created by root has access to home folder, someone else?

Thanks

750 is usually all that is needed.

Hi Joe,
If set 750, home/account-1& home/account-1/domains/account-3 can’t include(‘home/account-2/api/functions.php’)