PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 10th, 2012, 04:39 PM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Question PHP5 - Can't get require_once to work across domains on the same server - permission denied

Hi. I have a server with several websites on it and am in the process of building an admin system on one domain that produces files that will be used by the code on the other domains.

They are all on the same server.
The folders containing the file I want to use is 777 permissions
The folders and files belong to the same ground on both admin site and other domains
The basedir restrictions have been set to allow both admin domain and website domain paths - I think this is set correctly.

The error given is of the form:
PHP Code:
require_once(../../xxxxx.co.uk/httpdocs/domains/xxxxx.co.uk/faders/faderSwitches.php) [function.require-once]: failed to open streamPermission denied in /var/www/vhosts/xxxxx.co.uk/httpdocs/includes/templates.php on line 22 


Any help or further information required would be welcome...

Many thanks, Jim

Reply With Quote
  #2  
Old December 10th, 2012, 04:46 PM
rstoll rstoll is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 9 rstoll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m
Reputation Power: 0
Check that the open_basedir property is set properly in your php.ini file

Reply With Quote
  #3  
Old December 10th, 2012, 05:04 PM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
I will check again but it appears to be - in phpinfo. The message it displayed previously about still being in effect has gone...

I presume setting a basedir entry on the 'client' domain allowing the remote folder (on the administrative domain) to be accessed from the client domain is the correct course of action to follow...

Currently I have:

/var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/tmp

Jim

Reply With Quote
  #4  
Old December 10th, 2012, 05:13 PM
rstoll rstoll is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 9 rstoll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m
Reputation Power: 0
I do not really know in which file you are using your require_once. But maybe the problem has to do with the relative path.

try it with __DIR__ in front:
require_once __DIR__.'/../../xxxxx.co.uk/httpdocs/domains/xxxxx.co.uk/faders/faderSwitches.php';

Reply With Quote
  #5  
Old December 11th, 2012, 04:11 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by rstoll
I do not really know in which file you are using your require_once. But maybe the problem has to do with the relative path.

try it with __DIR__ in front:
require_once __DIR__.'/../../xxxxx.co.uk/httpdocs/domains/xxxxx.co.uk/faders/faderSwitches.php';


I tried it, but it didn't help, thanks for the suggestion though... I tried it with an absolute server path:

require_once ('/var/www/vhosts/xxxxx.co.uk/httpdocs/domains/xxxxx.co.uk/faders/faderSwitches.php');

but it hates that too...

Reply With Quote
  #6  
Old December 11th, 2012, 04:15 AM
requinix's Avatar
requinix requinix is offline
Still alive
Click here for more information.
 
Join Date: Mar 2007
Location: Washington, USA
Posts: 12,703 requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)requinix User rank is General 120th Grade (Above 100000 Reputation Level)  Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1Folding Points: 417516 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 5 Months 1 Week 4 Days 5 h 38 m 45 sec
Reputation Power: 8969
Send a message via AIM to requinix Send a message via MSN to requinix Send a message via Yahoo to requinix Send a message via Google Talk to requinix
Does this script have read+execute (xx5 or xx7) permissions on every folder between ./ and faders/? Don't quote me on this but I'm pretty sure it's not just the target directory that matters.

Reply With Quote
  #7  
Old December 11th, 2012, 04:49 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by requinix
Does this script have read+execute (xx5 or xx7) permissions on every folder between ./ and faders/? Don't quote me on this but I'm pretty sure it's not just the target directory that matters.


I 777'd all the directories below httpdocs to the file (and the file itself) yes but no joy.

Reply With Quote
  #8  
Old December 11th, 2012, 04:55 AM
rstoll rstoll is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2012
Posts: 9 rstoll User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 3 m
Reputation Power: 0
I still believe it has to do with open_basedir. What system is used for your hosting? If plesk is used, than make sure that open_basedir is not just set correctly on the global config but also in the indiviual domain specific config (could be that the global config is overwriten in the domain specific one).

Reply With Quote
  #9  
Old December 11th, 2012, 05:00 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by rstoll
I still believe it has to do with open_basedir. What system is used for your hosting? If plesk is used, than make sure that open_basedir is not just set correctly on the global config but also in the indiviual domain specific config (could be that the global config is overwriten in the domain specific one).


Yes, it is a Plesk system.

The basedir I showed is from the local php.ini which displays in the phpinfo for the client domain. I wonder if I should set the global config to the same in case that aspect of the local php.ini is being ignored. Is that possible?

I'd be happy if I could just figure out a way for the admin domain to write the files to the client domain, but I can't seem to get past security any way.

Is it significant that I am running php as a fast-cgi? I mean the local .ini seems to be right, but if the global ini is different... Just tried it as an apache process instead - no difference.

I am starting to think that you are right about the settings not being correctly used or reported.

Reply With Quote
  #10  
Old December 11th, 2012, 06:38 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Could it be the other way around (that the local config is being ignored in favour of the global one)?

There doesnt seem to be a basedir entry set globally though :/

Reply With Quote
  #11  
Old December 11th, 2012, 06:59 AM
Northie's Avatar
Northie Northie is offline
Square Peg in a Round Hole
Click here for more information.
 
Join Date: Oct 2007
Location: North Yorkshire, UK
Posts: 3,420 Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 10 h 49 m 56 sec
Reputation Power: 3896
Given that you have a plesk server then do this

go to the

/var/www/vhosts/clientsite.co.uk/conf/

folder and create a file called vhost.conf (there will already be on called httpd.include - DO NOT EDIT this one)

in the new file put

Code:
/var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp


replace the path fore the other-site.co.uk website with the path to where you want to include from

you will then want to get that new configuration recognised. You can do this by one of a number of methods. Often the easiest way is to log into plesk, go the domain in question, go to web hosting settings and click save.

Then, the plesk process scans all the files in the conf folder and knows to include your new file in future requests
__________________
PHP OOPS! <?php DB::Execute(SQL::makeFrom($_GET))->fetchArray()->FormatWith(Template::getInstance('default'))->printHtml(); ?>

PDO vs mysql_* functions: Find a Migration Guide Here

[ Xeneco - T'interweb Development ] - [ Are you a Help Vampire? ] - [ Read The manual! ] - [ W3 methods - GET, POST, etc ] - [ Web Design Hell ]

Reply With Quote
  #12  
Old December 11th, 2012, 07:07 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Quote:
Originally Posted by Northie
Given that you have a plesk server then do this

go to the

/var/www/vhosts/clientsite.co.uk/conf/

folder and create a file called vhost.conf (there will already be on called httpd.include - DO NOT EDIT this one)

in the new file put

Code:
/var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp


replace the path fore the other-site.co.uk website with the path to where you want to include from

you will then want to get that new configuration recognised. You can do this by one of a number of methods. Often the easiest way is to log into plesk, go the domain in question, go to web hosting settings and click save.

Then, the plesk process scans all the files in the conf folder and knows to include your new file in future requests


Hi, thanks for the suggestion. When you say to put: /var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp in the vhost.conf do you mean:

open_basedir = /var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp

I am not being facetious, I am very unfamiliar with this stuff...

Reply With Quote
  #13  
Old December 11th, 2012, 07:12 AM
Northie's Avatar
Northie Northie is offline
Square Peg in a Round Hole
Click here for more information.
 
Join Date: Oct 2007
Location: North Yorkshire, UK
Posts: 3,420 Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 10 h 49 m 56 sec
Reputation Power: 3896
Quote:
Originally Posted by merrydown
Hi, thanks for the suggestion. When you say to put: /var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp in the vhost.conf do you mean:

open_basedir = /var/www/vhosts/clientsite.co.uk/httpdocs:/var/www/vhosts/administrativesite.co.uk/httpdocs:/var/www/vhosts/other-site.co.uk/httpdocs:/tmp

I am not being facaetious, I am very unfamiliar with this stuff...


Yes, i did mean that.

by all means look in the httpd.include one to see how the code is structured then copy and edit the relevant parts (into vhsot.conf).

The reason not to edit the existing one is that this is read and written to by plesk, and it is interned that you use the vhost.conf file to extend/overwrite the existing one

Reply With Quote
  #14  
Old December 11th, 2012, 07:16 AM
Northie's Avatar
Northie Northie is offline
Square Peg in a Round Hole
Click here for more information.
 
Join Date: Oct 2007
Location: North Yorkshire, UK
Posts: 3,420 Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level)Northie User rank is General 44th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 10 h 49 m 56 sec
Reputation Power: 3896
Here's one of mine, on my plesk server which allows me to symlink a local folder (part of xxxx.co.uk) to a folder (zzzz) on another website (yyyy.co.uk)

Code:
<Directory /var/www/vhosts/xxxxx.co.uk/httpdocs>
        php_admin_value open_basedir "/var/www/vhosts/xxxxx.co.uk/httpdocs:/var/www/vhosts/xxxx.co.uk/httpdocs/products/image/data/filemanager:/:/var/www/vhosts/yyyy.co.uk/httpdocs/new-site/filemanager/zzzz:/tmp"
</Directory>

Reply With Quote
  #15  
Old December 11th, 2012, 07:26 AM
merrydown merrydown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2005
Posts: 15 merrydown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 24 m 58 sec
Reputation Power: 0
Red face

Quote:
Originally Posted by Northie
Here's one of mine, on my plesk server which allows me to symlink a local folder (part of xxxx.co.uk) to a folder (zzzz) on another website (yyyy.co.uk)

Code:
<Directory /var/www/vhosts/xxxxx.co.uk/httpdocs>
        php_admin_value open_basedir "/var/www/vhosts/xxxxx.co.uk/httpdocs:/var/www/vhosts/xxxx.co.uk/httpdocs/products/image/data/filemanager:/:/var/www/vhosts/yyyy.co.uk/httpdocs/new-site/filemanager/zzzz:/tmp"
</Directory>


Hi Northie,

I tried that but nothing has changed. I tied going to web hosting settings and clicking ok, I also tried clicking on the domain name at the bottom of advancedoptions for website and domains on the required domain and okaying those settings.

I really appreciate your help, particularly being Plesk specific. May I PM you with a few more specific details which might help?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > PHP5 - Can't get require_once to work across domains on the same server - permission denied

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap