Free Web Hosting Forum
(#1 (permalink))
Old
Junior Member
getem is on a distinguished road
 
Posts: 11
Join Date: Oct 2010
Default Warning: filemtime() [function.filemtime] - 08-07-2011, 03:55 AM

Hello guys,

I'm getting this error message on my template. Due to this my time and date become outdated [Wednesday, 31 December, 1969, 7:00 PM Posted by]

~~~~~~Error Message~~~~~~~~~~~~~

Warning: filemtime() [function.filemtime]: open_basedir restriction in effect. File(/usr/local/apache/htdocs/kw1-kw2/index.php) is not within the allowed path(s): (/home/:/usr/lib/php:/tmp) in /home/a58458/public_html/headerFunctions.php on line 280

~~~~~~End~~~~~~~~~~~~~~~~~~~

I have no problem running this on the other Server. What could be the reason.

I've created /tmp on root but it seem no change.

This is on line 280

~~~~~~~~~~headerFunctions.php~~~~~~~~~~

function show_post_time(){
$filePathRel = $_SERVER['PHP_SELF'];
$docRoot = $_SERVER['DOCUMENT_ROOT'];
$filepath = $docRoot.$filePathRel;
$modTime = filemtime($filepath);
$formattedTime = date('l, j F, Y, g:i A',$modTime);
echo $formattedTime;
}

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Looking forward to hear from you guys.
Reply With Quote
Sponsored Links
(#2 (permalink))
Old
Senior Member
Sogo7 is on a distinguished road
 
Posts: 238
Join Date: Dec 2010
Default 08-07-2011, 04:08 AM

Heads still swimming from day of Python coding but would hazzard a gues that $filepath is pointing to the wrong place so would backtrack docroot and filepathrel variables.


Reply With Quote
(#3 (permalink))
Old
Junior Member
getem is on a distinguished road
 
Posts: 11
Join Date: Oct 2010
Default 08-07-2011, 04:35 AM

Unfortunately I'm not a coder

But I do noticed if the page in on root directory /public_html it display correcty

but if the page is on the directory /public_html/kw1-kw2/ then this error appear

What should I change?
Reply With Quote
(#4 (permalink))
Old
drums's Avatar
Senior Member
drums is on a distinguished road
 
Posts: 579
Join Date: Aug 2010
Location: Oz
Default 08-08-2011, 12:39 AM

What about this?

PHP Code:
function show_post_time(){
$modTime filemtime(__FILE__);
$formattedTime date('l, j F, Y, g:i A',$modTime);
echo 
$formattedTime;

I haven't tested, so not sure if it will give you the same/similar error but it's certainly a less complicated way of achieving the same result.

drums
Reply With Quote
(#5 (permalink))
Old
Junior Member
getem is on a distinguished road
 
Posts: 11
Join Date: Oct 2010
Default 08-08-2011, 02:24 PM

Quote:
Originally Posted by drums View Post
What about this?

PHP Code:
function show_post_time(){
$modTime filemtime(__FILE__);
$formattedTime date('l, j F, Y, g:i A',$modTime);
echo 
$formattedTime;

I haven't tested, so not sure if it will give you the same/similar error but it's certainly a less complicated way of achieving the same result.

drums
Drums, What should I do to appreciate your help :-)

It works!
Reply With Quote
(#6 (permalink))
Old
drums's Avatar
Senior Member
drums is on a distinguished road
 
Posts: 579
Join Date: Aug 2010
Location: Oz
Default 08-09-2011, 03:00 AM

A "thanks" and some karma always does the trick for me. :-)
Reply With Quote
(#7 (permalink))
Old
Junior Member
getem is on a distinguished road
 
Posts: 11
Join Date: Oct 2010
Default 08-12-2011, 02:20 PM

Quote:
Originally Posted by drums View Post
A "thanks" and some karma always does the trick for me. :-)
Thanks a lots Drums
Reply With Quote
Reply

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.5.2
vBulletin Skin developed by: vBStyles.com