Hi

I have written a calender script for my website thats uses the line
'$num = cal_days_in_month(CAL_GREGORIAN, $month, $year);'

I had php 4.3.2 installed on my machine and now have upgraded to php5 and it worked fine on both. The problem is when i uploaded my script onto my isp and it came up with an error saying that the cal_days_in_month function isn't defined.

After looking at the php manual it says that this was included from php 4.1 onwards.

I am unsure when my isp plans to upgrade their php. Can anyone advise me if the function should be working with php 4.3.2 or not?

Looking at the phpinfo i can see theat my ISP has no additional modules installed. would this be my problem?

Thanks
Ian

    Your ISP is more than likely runnning a *Nix based box and their PHP was not compiled with the calendar enabled. YOu should contact them to find out, and ask them to recompile the PHP to have the calendar enabled. They should (hopefully) know what to do for this.

      Why not just use

      $num = date('t', strtotime($year.'-'.$month.'-1'));

      You lose the ability to specify the calendar type, but PHP offers other functions to convert calendars.

      And getting ISPs (especially large ones) to recompile software for you is like pulling teeth. 🙂

        Thanks defender, I have emailed my isp, but i am not holding out for them to do it, as i get the impresssion they rarely recompile their software to include any external modules unless in exceptional circomstances!:glare:

        Thanks Truckstuff

        I will put in the strtotime function instead. I wasn't aware that, strtotime would do the same thing, and i only need the standard gregorian calender so that would be good.

        Thanks again for your advice, I am always learning

          I hear you. PHP has just about all of the functions you need already, if you don't need different calendar types. Pursuing your ISP to reconfigure may be worth it though, to preclude someone else from having to go through this same thing you're going through... But either way, at least you can move forward with your design.

            Thanks guys

            I have replaced the cal_days_in_month function with the strtotime function and it works fine now.

            I am still waiting to hear from my ISP, but will still see what they will say.

            Thanks again for all your help 🙂

              Well worst case scenario, if you google it, you should be able to find the algorithms and equations used to convert your calendar in the future if you ever need to, but if you don't ever have a need to in the first place, then you should be good to go with the strtotime function anyhow...

                Write a Reply...