View Full Version : Weird Error

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

$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?

10-01-2003, 11: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.

10-01-2003, 11: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

10-01-2003, 11: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.

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

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

10-02-2003, 04: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...

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

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

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

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

if( !extension_loaded( 'calendar' ) ){
echo 'Calendar fuctions not available on in this build' ;
echo 'Calendar functions available';