php_ext personnal

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alfred Wallace

    #1

    php_ext personnal

    Hi all,

    I would like to create a personnal dll as a php extension.

    I just downloaded devC++

    Can somebody help me to create a "helloworld " dll code?

    I want a my_helloworld() function, compiled in a dll:
    php_my.dll , with this functionnality:
    <?
    echo my_helloworld() ;
    ?>
    returns:
    <h1>hello World</h1>

    ###### here is C language ( or C++ ?)(? I don't know the exact syntax )
    string my_helloworld() {
    return "<h1>hello world</h1>";
    }
    #### what about "include stdio.h" ??? and main() function???
    #### I would like to know exact code to compile

    For yet devC++ gives me .exe, how to dll's?

    I go back. cu all


  • Mike Willbanks

    #2
    Re: php_ext personnal

    Alfred,[color=blue]
    > I would like to create a personnal dll as a php extension.
    >
    > I just downloaded devC++
    >
    > Can somebody help me to create a "helloworld " dll code?[/color]

    Zend has the hello world as an extension example on there site. Here is
    the URL:

    Comment

    • Alfred Wallace

      #3
      Re: php_ext personnal

      thanks Mike for your helpfull answer.


      According to this, u can create à dll file with notepad !!!
      (And compile it with php

      next ( first ) step for me:
      install php in command line.

      May it be possible on easyphp config?


      2th step:
      does
      $ phpize
      $ ./configure --enable-hello
      $ make
      function on windows platform? and How to make it work?I will perhaps
      answer some questions by myself, but i stay open for discuss


      Comment

      • Mike Willbanks

        #4
        Re: php_ext personnal

        Alfred,
        [color=blue]
        > May it be possible on easyphp config?[/color]

        Probably not as that is mostly a windows based. Those instructions are
        primarily *nix based.
        [color=blue]
        > 2th step:
        > does
        > $ phpize
        > $ ./configure --enable-hello
        > $ make
        > function on windows platform? and How to make it work?I will perhaps
        > answer some questions by myself, but i stay open for discuss[/color]

        No, you will need to download the php source and also have a compiler
        such as bloodshed devc++. (www.bloodshed.net)

        Then write your extension and build it against the php source.

        Mike

        Comment

        • Alfred Wallace

          #5
          Re: php_ext personnal

          I downloaded devC++ by myself,
          and visual C++ according to http://www.devnewz.com/090902b.html


          This tutorial explains creating some.dll with visual C++

          but my php_aa2.dll returns an apache error:
          unknow(): ( maybe not a PHP library )'php_aa2.dll'


          ???





          "Mike Willbanks" <pencap@gmail.c om> a écrit dans le message de news:
          WE4ie.3881$cP2. 1757@fe06.lga.. .[color=blue]
          > Alfred,
          >[color=green]
          >> May it be possible on easyphp config?[/color]
          >
          > Probably not as that is mostly a windows based. Those instructions are
          > primarily *nix based.
          >[color=green]
          >> 2th step:
          >> does
          >> $ phpize
          >> $ ./configure --enable-hello
          >> $ make
          >> function on windows platform? and How to make it work?I will perhaps
          >> answer some questions by myself, but i stay open for discuss[/color]
          >
          > No, you will need to download the php source and also have a compiler such
          > as bloodshed devc++. (www.bloodshed.net)
          >
          > Then write your extension and build it against the php source.
          >
          > Mike[/color]


          Comment

          • Mike Willbanks

            #6
            Re: php_ext personnal

            Alfred,



            You might want to take a look at the skeleton to make sure your code is
            working correct. I have never had an apache_error like that before.
            Mostly sounds like it didn't have any of the php functions implementing
            anything.

            Mike[color=blue]
            > I downloaded devC++ by myself,
            > and visual C++ according to http://www.devnewz.com/090902b.html
            >
            >
            > This tutorial explains creating some.dll with visual C++
            >
            > but my php_aa2.dll returns an apache error:
            > unknow(): ( maybe not a PHP library )'php_aa2.dll'
            >
            >
            > ???
            >
            >
            >
            >
            >
            > "Mike Willbanks" <pencap@gmail.c om> a écrit dans le message de news:
            > WE4ie.3881$cP2. 1757@fe06.lga.. .
            >[color=green]
            >>Alfred,
            >>
            >>[color=darkred]
            >>>May it be possible on easyphp config?[/color]
            >>
            >>Probably not as that is mostly a windows based. Those instructions are
            >>primarily *nix based.
            >>
            >>[color=darkred]
            >>>2th step:
            >>>does
            >>>$ phpize
            >>>$ ./configure --enable-hello
            >>>$ make
            >>>function on windows platform? and How to make it work?I will perhaps
            >>>answer some questions by myself, but i stay open for discuss[/color]
            >>
            >>No, you will need to download the php source and also have a compiler such
            >>as bloodshed devc++. (www.bloodshed.net)
            >>
            >>Then write your extension and build it against the php source.
            >>
            >>Mike[/color]
            >
            >
            >[/color]

            Comment

            • Alfred Wallace

              #7
              Re: php_ext personnal

              hi mike,

              I found a skeletton for win32 ( in ext/ext_skel_win32. php of php4.3.1
              package)

              wich didn't work because of the first 3 lines:



              if (php_sapi_name( ) != "cli") {
              echo "Please run this script using the CLI version of PHP\n";
              exit;
              }


              echo php_sapi_name() return "apache" !!!!!

              the doc said that "cli" is already installed on php 4.3.1

              how can i verify and/or install a "cli" version?





              Comment

              • Mike Willbanks

                #8
                Re: php_ext personnal

                Alfred,
                [color=blue]
                > if (php_sapi_name( ) != "cli") {
                > echo "Please run this script using the CLI version of PHP\n";
                > exit;
                > }[/color]

                I do not think you will need to add in these lines. This is for when
                you are making the extension only for PHP command line.

                Mike

                Comment

                Working...