Writing a PHP extension

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ever Olano

    Writing a PHP extension

    Hi. I have the following questions regarding writing a PHP extension.
    You don't have to answer all questions. Please answer everything you
    can. I'd really appreciate it.

    1. What is the most common version that's used out there? If I wrote
    an extension for PHP 4, would it work for PHP 5? Also, is PHP 3 very
    different?

    2. My extension will need to use an external C++ (not C) library.
    That should be all right, right?

    3. When/where/how do I specify whether or not I want my extension to
    be built-in or external? I know (actually, more like, think) that it
    is in config.m4 but I don't know exactly how to specify it?

    4. This is probably more a C/C++ question, when/where/how do I specify
    whether or not my library is to be shared/dynamic or static? Also, is
    that decision relevant only for external extensions?

    Thanks! That's all for now (I'm sure more will come). I'd really
    appreciate any help.
    Ever
  • Asgeir Frimannsson

    #2
    Re: Writing a PHP extension

    Ever Olano wrote:
    [color=blue]
    > 1. What is the most common version that's used out there? If I wrote
    > an extension for PHP 4, would it work for PHP 5? Also, is PHP 3 very
    > different?[/color]
    I think it's very safe to ignore php3. It's very very rarely used out there.
    You can build extensions that work for both php4 and php5. For php5, you can
    add object oriented syntax to your library, which might be useful if you're
    making use of eg some c++ library.
    [color=blue]
    > 2. My extension will need to use an external C++ (not C) library.
    > That should be all right, right?[/color]
    Yes, that's no problem. I have an url to a simple tutorial how to get
    started on this:


    you might want to check out the php.pecl.dev or php.internal mailing
    lists/newsgroups.

    regards,
    asgeir

    Comment

    • Ever Olano

      #3
      Re: Writing a PHP extension

      Hi, Asgeir. I actually chanced upon your tutorial after I posted my
      message. Very good. Thanks for that and for this reply! I really
      appreciate it.

      Ever

      "Asgeir Frimannsson" <a.frimannsson@ student.qut.edu .au> wrote in message
      news:40b519ee$0 $16600$5a62ac22 @freenews.iinet .net.au...[color=blue]
      > Ever Olano wrote:
      >[color=green]
      > > 1. What is the most common version that's used out there? If I wrote
      > > an extension for PHP 4, would it work for PHP 5? Also, is PHP 3 very
      > > different?[/color]
      > I think it's very safe to ignore php3. It's very very rarely used out[/color]
      there.[color=blue]
      > You can build extensions that work for both php4 and php5. For php5, you[/color]
      can[color=blue]
      > add object oriented syntax to your library, which might be useful if[/color]
      you're[color=blue]
      > making use of eg some c++ library.
      >[color=green]
      > > 2. My extension will need to use an external C++ (not C) library.
      > > That should be all right, right?[/color]
      > Yes, that's no problem. I have an url to a simple tutorial how to get
      > started on this:
      > http://bugs.tutorbuddy.com/php5cpp/php5cpp/
      >
      > you might want to check out the php.pecl.dev or php.internal mailing
      > lists/newsgroups.
      >
      > regards,
      > asgeir[/color]


      Comment

      • Ever Olano

        #4
        Re: Writing a PHP extension

        Hi, it's me again. In your tutorial, to make the extension dynamic, you
        recommend using phpize, which is part of PEAR (right?). Some of our
        customers may not necessarily have PEAR (right?), in which case, what is the
        alternative?

        Also, do third-party extensions usually supply the source code and let the
        customer build it? If so, then that probably means that the customer
        decides whether or not to make my extension static or dynamic. Right?

        Thanks again,
        Ever

        "Asgeir Frimannsson" <a.frimannsson@ student.qut.edu .au> wrote in message
        news:40b519ee$0 $16600$5a62ac22 @freenews.iinet .net.au...[color=blue]
        > Ever Olano wrote:
        >[color=green]
        > > 1. What is the most common version that's used out there? If I wrote
        > > an extension for PHP 4, would it work for PHP 5? Also, is PHP 3 very
        > > different?[/color]
        > I think it's very safe to ignore php3. It's very very rarely used out[/color]
        there.[color=blue]
        > You can build extensions that work for both php4 and php5. For php5, you[/color]
        can[color=blue]
        > add object oriented syntax to your library, which might be useful if[/color]
        you're[color=blue]
        > making use of eg some c++ library.
        >[color=green]
        > > 2. My extension will need to use an external C++ (not C) library.
        > > That should be all right, right?[/color]
        > Yes, that's no problem. I have an url to a simple tutorial how to get
        > started on this:
        > http://bugs.tutorbuddy.com/php5cpp/php5cpp/
        >
        > you might want to check out the php.pecl.dev or php.internal mailing
        > lists/newsgroups.
        >
        > regards,
        > asgeir[/color]


        Comment

        • Asgeir Frimannsson

          #5
          Re: Writing a PHP extension

          Ever Olano wrote:
          [color=blue]
          > Hi, Asgeir. I actually chanced upon your tutorial after I posted my
          > message. Very good. Thanks for that and for this reply! I really
          > appreciate it.
          >
          > Ever[/color]

          Hi, it's not my tutorial sorry. And I haven't made an extension myself
          yet :) Just fiddled with it a bit a while ago. But yes, it's a great
          starter-tutorial, and i thought it would be useful for you.

          regards,
          asgeir

          Comment

          Working...