Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP Calendar Functions

  • 03-04-2002 5:35pm
    #1
    Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭


    Hey Guys,

    got a(nother) PHP question. I'm havnig problems with the calender functions in PHP. I'm running on rh 7.2, and the php install was from an rpm. Now, its my understanding that rpm's do blanket-installs, yes?

    At the moment I'm just trying to get a very basic gregorian-to-julian and vice versa conversion. My ultimate aim is to convert dates being stiored in Julian time (eg. 37348.39971626157) to something alittle more readable like dd/mm/yyyy@hh:mm:ss or some such.

    At the moment I'm getting the followign error:
    Fatal error: Call to undefined function: gregoriantojd() in /xxx/xxx/xxx/xxx/datetest.php on line 3

    Where this, and the rpm question meet is that I think that the calendar functions haven't been installed/enabled. Any thoughts or suggestions? :confused:


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    I'm running on rh 7.2, and the php install was from an rpm. Now, its my understanding that rpm's do blanket-installs, yes?

    If by "blanket" you mean that all the extensions are bundled, then I'm afraid not on Red Hat. In fact, Red Hat don't even include mysql and imap anymore, they're now in separate packages (php-mysql, php-imap).

    Where this, and the rpm question meet is that I think that the calendar functions haven't been installed/enabled.

    That's it I'm afraid. Have you a development box Lemming? If so, just configure PHP with '--enable-calendar' and make (don't make install), and the extension will be in the 'modules' directory. Assuming your versioning is correct, you can then just upload the module and add it in php.ini.

    If not, let me know your platform and PHP version and I'll compile it for you if I get a minute (and you're x86).

    adam


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Actually, now I come to think of it, Troels Arvin has packages for most of the PHP extensions, you could just get the calender one from there and extract the extension (`man rpm2cpio`). Have a look here.

    adam


  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    Cheers dahamsta the all-knowing-all-powerful :D

    Ok, I've just gone and done a ./config (with "--enable-calendar") and a make. If I go into the ext/calendar directory I'm looking at a calendar.la file (among the many others) which was mentioned at the end of the make routine. Is this the finished module I'm looking for??

    if so, where do I put it n'what do I do with the php.ini file?


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Ok, I've just gone and done a ./config (with "--enable-calendar") and a make.

    ./config? You mean ./configure, yeah?

    If I go into the ext/calendar directory I'm looking at a calendar.la file (among the many others) which was mentioned at the end of the make routine. Is this the finished module I'm looking for??

    Nah, the modules are in the 'modules' directory, like I said. It'll probably be called calendar.so.

    if so, where do I put it n'what do I do with the php.ini file?

    Open php.ini and look for 'extension_dir'. Move the extension (calendar.so) to that directory. Now add a line to php.ini, saying:

    extension=calendar.so

    When you restart Apache, your calendar functions should be available.

    adam


  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    Originally posted by dahamsta
    ./config? You mean ./configure, yeah?

    yup. Sorry - ./configure --enable-calendar

    then 'make'


    Nah, the modules are in the 'modules' directory, like I said. It'll probably be called calendar.so.

    Nope. Empty


    During the make process the following appears:
    Making all in calendar
    make[2]: Entering directory `/home/jamesg/packages/php/php-4.1.2/ext/calendar'
    make[3]: Entering directory `/home/jamesg/packages/php/php-4.1.2/ext/calendar'
    make[3]: Nothing to be done for `all-p'.
    make[3]: Leaving directory `/home/jamesg/packages/php/php-4.1.2/ext/calendar'
    make[2]: Leaving directory `/home/jamesg/packages/php/php-4.1.2/ext/calendar'

    Is that "Nothing to be done for 'all-p' possibly the reason why no .so file is appearing in the modules directory?


  • Advertisement
  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Because I made a no-no. Try this:

    ./configure --enable-calendar=shared

    adam


  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    /kids playground taunting voice

    hamsta made a no no!
    hamsta made a no no!

    /end taunting voice

    :D

    Cheers! I'll give that a go. Muchos appreciated :)


  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    Okkkk ....

    I've used the command ./configure --enabled-calendar=shared then issued the "make" command.

    This is what I'm looking at currently inside the modules dir
    [jamesg@LINUXTESTBOX php-4.1.2]$ ls modules/
    total 208
    -rw-r--r-- 1 jamesg users 204772 Apr 4 11:41 calendar.a
    -rw-r--r-- 1 jamesg users 678 Apr 4 11:41 calendar.la


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Odd. See, most modules have '--with-' flags, so you can build shared modules by doing '--with-wotsit=shared' or '--with-wosit=/path/to/wotsit,shared'. The '--enable-' one departs from this, but the fact that Troels Arvin has a Calendar package implies that it can be built as a shared module.

    If I was you, I'd take the lazy way out, get Troels package and extract the module from it using rpm2cpio. If you do a search for 'rpm2cpio' you'll find instruction for doing it (you'll probably find yourself in the MaxRPM docs on rpm.org).

    Alternatively, you could email Troels and ask him how he did it, he's a nice guy, very helpful. Or ask on php-general.

    adam


  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    Originally posted by dahamsta
    Odd. See, most modules have '--with-' flags, so you can build shared modules by doing '--with-wotsit=shared' or '--with-wosit=/path/to/wotsit,shared'. The '--enable-' one departs from this, but the fact that Troels Arvin has a Calendar package implies that it can be built as a shared module.

    If I was you, I'd take the lazy way out, get Troels package and extract the module from it using rpm2cpio. If you do a search for 'rpm2cpio' you'll find instruction for doing it (you'll probably find yourself in the MaxRPM docs on rpm.org).

    Alternatively, you could email Troels and ask him how he did it, he's a nice guy, very helpful. Or ask on php-general.

    adam

    Cheers dahamsta :)

    I had a sneaking suspicion that the "enable" rather than "with" might imply a few problems to be had.

    Thanks though all the same. I'll stick up a post later about how it goes


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 14,149 ✭✭✭✭Lemming


    ARGGGGGGGGGGGGGGHHHHHHH

    This is f*cked up :mad:

    The rpmdp.org isnt' around. The documentation i can find on rpm2cpio doesn't work and to top it all off, the rpm wont unpackage because its missing some other files - yet that calendar.so file is staring me int he face when I view the rpm contents :(

    F**************************CKKKKKKKKKK!!!


Advertisement