dawilson Posted January 2, 2005 Share Posted January 2, 2005 I've moving my domains from another server and find that one of my trivial PHP scripts is generating an error. Can anyone tell me what's up with this and how to correct the problem? I would rather not hardcoded the document root directory but will do this if necessary. The script generates a file modification timestamp and is: <?PHP echo "Page was last modified on: " . date ("F d Y H:i:s.", filemtime($_SERVER['DOCUMENT_ROOT'].$_SERVER['PHP_SELF'])); ?> It generates error: filemtime(): Stat failed for /usr/local/apache/htdocs/~fourcc/intro.php (errno=2 - No such file or directory) in /home/fourcc/public_html/intro.php on line 264. where intro.php is in my public_html directory and is the file which contains the script. It almost looks as if $_SERVER['DOCUMENT_ROOT'] is returning the wrong path? Thanks in advance for any suggestions. Regards, Dave Wilson Quote Link to comment Share on other sites More sharing options...
TCH-Don Posted January 2, 2005 Share Posted January 2, 2005 Hi Dave, I created a page and pasted your code into it and it worked for me. Have you tried to just create a small page with that code on it to see if it works? Quote Link to comment Share on other sites More sharing options...
dawilson Posted January 2, 2005 Author Share Posted January 2, 2005 Don, I'll give that a shot but I now suspect some transient effect related to running the script too soon after creating the account and uploading files. Trying to load the page now yields different and bigger problems (something to do with open_basedir apparently). Please could you let me know what the absolute path to a file in my public_html directory is so that I can fix the new problem? Come to think of it, if this info is somewhere else in the support section, I'd love to know where - I searched but couldn't find it. Thanks again, Dave Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted January 2, 2005 Share Posted January 2, 2005 Hi Dave, /home/username/public_html where username is your cpanel username. Quote Link to comment Share on other sites More sharing options...
dawilson Posted January 2, 2005 Author Share Posted January 2, 2005 Still no luck, I'm afraid. I posted as simple a page as I could which contains just the script and it still fails the same way even though the file it refers to seems to be there. You can find this at http://72.9.232.146/~fourcc/404.php. Can anyone offer any suggestions? Thanks, Dave Quote Link to comment Share on other sites More sharing options...
TCH-Andy Posted January 2, 2005 Share Posted January 2, 2005 Hi, The problem is that you are trying to get it to work before the domain name has propagated. You can do it, but you need to modify things a little. Do you need to get it working before propagation? (you will have to reset it after the domain name has propagated). Quote Link to comment Share on other sites More sharing options...
dawilson Posted January 2, 2005 Author Share Posted January 2, 2005 Andy, I'm trying to ensure that all my sites are moved correctly prior to updating DNS. In the cases of all other PHP sites, I have seen no problems as long as I remember to set the base URL to http://72.9.232.146/~<userid> temporarily (I will switch it back once I update DNS). In this particular case, the PHP is not critical to the site operation so, assuming you reckon I won't have a problem (a PHP error displayed on each page is not acceptable!), I'll go ahead and update DNS then keep my fingers crossed that everything works OK once the change has rippled through. Thanks, Dave Quote Link to comment Share on other sites More sharing options...
dawilson Posted January 5, 2005 Author Share Posted January 5, 2005 Just an update... Now that the DNS change has tricked through, the script runs fine. Thanks. Dave Quote Link to comment Share on other sites More sharing options...
TCH-Bruce Posted January 5, 2005 Share Posted January 5, 2005 Hi Dave, welcome to the family. Glad it's working now. Quote Link to comment Share on other sites More sharing options...
TCH-Don Posted January 5, 2005 Share Posted January 5, 2005 Official Welcome to the Family Dave and your new home! As you know, we really are like family here. So if you need anything, just ask your new family! We love to help Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.