...

View Full Version : Weird Error



SDP2006
10-01-2003, 10:03 PM
With this code


<?php
$month = date(n);
$year = date(Y);
$actualmonth = date(F);
$today = date("l, F d, Y");
$num = cal_days_in_month(CAL_GREGORIAN, $month, $year);
echo "There are $num days in $actualmonth $year";
?>

I get an error on line six. Fatal error: Call to undefined function: cal_days_in_month(). I run the same code from one domain, it works fine. The other domain, it doesn't. This is strange. Anyone know why?

Spookster
10-01-2003, 10:12 PM
Well since that function is avaialable in PHP >= 4.1 then my guess would be that the server you are running it on where it doesn't work has an older version of PHP.

Nightfire
10-01-2003, 10:12 PM
What version of php do you have on the server it's not working on? It'll only work on 4.1.0 >

heh, fancy seeing you here le spook :p

mordred
10-01-2003, 10:16 PM
Why not use date('t') instead? That will give you the number of days in a month, the calendar functions are useful if you want to go beyond the UNIX epoch.

About your problem: It could also be that Calendar support was not compiled in. Check your phpinfo settings to make sure it's actually compiled into PHP.

SDP2006
10-02-2003, 01:38 AM
I'm have PHP Version 4.2.3 on my server....

Spookster
10-02-2003, 01:59 AM
Are you running both domains on the same server? The domain name will have no effect on this whatsoever.

SDP2006
10-02-2003, 03:01 AM
Actually the one that isn't working is my www.net-riches.com

The one that is working is the one running on my local machine...

Nightfire
10-02-2003, 03:07 AM
Is calendar support enabled on your host? *de javu* Check your phpinfo *de javu #2* :p

Spookster
10-02-2003, 04:11 AM
Ok are you running PHP >= 4.1 on the server where this is not working?

SDP2006
10-02-2003, 12:29 PM
I'm running 4.2.3 on the server that it isnt working...

firepages
10-02-2003, 12:57 PM
as mentioned already ...



<?php
if( !extension_loaded( 'calendar' ) ){
echo 'Calendar fuctions not available on in this build' ;
}else{
echo 'Calendar functions available';
}
<?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum