Php includes

software development

#1

I’m having an issue with a client’s website. I didn’t build this particular website, and in fact, I’m a bit of a nube when it comes to php. I have been able to do some updates etc. to this site, but nothing too in depth. Please view the website in question at www.eamusic.org. This particular website was working properly and according to the client, Dreamhost moved the website to another server which apparently caused the problem. Now, the page doesn’t render properly. The problems seem to be with the php includes. None of them are rendering. This is one of the php includes:

<?php readfile($root_include . 'content/home/composition.php'); ?>

Am I reading this right? That there should be, in the root directory, a directory called content, containing a directory called home, containing a file named composition.php. I can’t find a file named content anywhere. Should it be in the root directory, or listed somewhere else? Could there be a problem with the fact that the command says readfile, rather than include? Is it possible that readfile worked on the first server, but not the new one? Could the tech that moved the website over to the new server, possibly have neglected to move the content directory? Any suggestions? Thanks in advance.raderwebdesign
Forum Newbie

Posts: 1
Joined: Wed Aug 25, 2010 2:16 pm
Private messageE-mail raderwebdesign


#2

readfile() reads a file and outputs it to the output buffer. It is essentially echoing the contents of a file. If $root_include is a URL and not a directory name, then you need to make sure that you have fopen wrappers enabled on the server you’re on.

Otherwise, you can just use include() and it might work, but ideally you want the file being referenced to be on the server you’re working on.


#3

My guess is that the value of $root_include is the problem. There is a fairly common problem where people have hard coded the name of the filer (the server that holds the files) into a path instead of using the relative path /home/username. During the move the filer changed and now $root_include doesn’t have the right path anymore. See if you can adjust it from something like /home/.blahblah/username to /home/username.

At any rate the value of $root_include will tell you where you’ll find (or should find) the rest of that path. So find where its defined at (probably a config file) and go from there.

Hope that helps.