By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,717 Members | 1,413 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,717 IT Pros & Developers. It's quick & easy.

php_ext personnal

P: n/a
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
Jul 17 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Alfred,
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?


Zend has the hello world as an extension example on there site. Here is
the URL:
http://www.zend.com/php/internals/ex...n-writing1.php
Jul 17 '05 #2

P: n/a
thanks Mike for your helpfull answer.
http://www.zend.com/php/internals/ex...n-writing1.php

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
Jul 17 '05 #3

P: n/a
Alfred,
May it be possible on easyphp config?
Probably not as that is mostly a windows based. Those instructions are
primarily *nix based.
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


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
Jul 17 '05 #4

P: n/a
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" <pe****@gmail.com> a écrit dans le message de news:
WE*****************@fe06.lga...
Alfred,
May it be possible on easyphp config?


Probably not as that is mostly a windows based. Those instructions are
primarily *nix based.
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


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

Jul 17 '05 #5

P: n/a
Alfred,

http://cvs.php.net/cvs.php/php-src/ext/skeleton

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
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" <pe****@gmail.com> a écrit dans le message de news:
WE*****************@fe06.lga...
Alfred,

May it be possible on easyphp config?


Probably not as that is mostly a windows based. Those instructions are
primarily *nix based.

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


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


Jul 17 '05 #6

P: n/a
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?

Jul 17 '05 #7

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


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
Jul 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.