I switched to VPS hosting and now I'm having a hard time finding the root path for "include" scripts. Its telling me the path is: /var/www/vhosts/hyperdeathbabies.com/httpdocs/ So let's say I go onto another site with the path of: /var/www/vhosts/youarehidden.com/httpdocs/ I create a file that is attempting to do this: include('/var/www/vhosts/hyperdeathbabies.com/httpdocs/test.php'); But it doesn't work. This, however, will: include('/var/www/vhosts/youarehidden.com/httpdocs/test.php'); So there isn't anything wrong with my coding, it just refuses to include a file from another site. Does anyone know why? Is there a way around this?
Your php installation is probably running in safe mode. This is common in shared hosting, else you'd be able to gain access to other people's files. run phpInfo() to check
Try this format "/home/httpd/yourdomain/httpdocs/www/your-directory/filename" Depending on where you use it the quotes might be single. The www may not be required for your server type. Under LxAdmin, it is required.
Thanks, but neither suggestions worked. I turned off safe mode and used the other format. Neither worked.
That won't help. I'm telling you that I already know the path. Its: /var/www/vhosts/hyperdeathbabies.com/httpdocs/ But when I use it, nothing shows up. But if I change the path to where its still in the directory that I'm in, it works. Let's say I have the file grab.php: /var/www/vhosts/youarehidden.com/httpdocs/grab.php Its going to open up this file: /var/www/vhosts/hyperdeathbabies.com/httpdocs/filetoopen.php It doesn't work. But if I open a file in the same directory: /var/www/vhosts/youarehidden.com/httpdocs/filetoopen.php It works. So I know there isn't anything wrong with the path. The path is perfect. It must be something else...
I'd also like to add that I'm using VPS hosting. Could that have something to do with? Maybe what I'm trying to do just isn't possible for me?
as suggested by : ecentricNick 1. It seems that you dont have permission to access others file. As it is restricted by the shared hosting itself. 2. Have you confirmed that the file exists on the both domains that you are including ?
It is early and the coffee has not kicked in. Some clarification please. Are you trying trying to use one file (the grab) to open another file? If so, the problem may be that the the first file can not find the path to the second file.
Your hosting provider has probably set up your php in safe mode. This will prevent you from including files which are not in the same folder or subfolder of the script. In other words, you cannot go back up the folder tree. More details... http://uk3.php.net/features.safe-mode
He already said that he tried with safe mode on and off. He is on a VPS. Something that occurred to me after the coffee kicked in; I wonder if it could be some with f_open? For Kennedy! Do you have phpinfo on your VPS? If not just create a file with this content, name it phpinfo.php and run it on your server. This will tell you how everything is set, which modules are running, etcetra.
I am using the "require()" method though. Which doesn't work. And yes, safe mode is off and I am using the proper path.