Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Win32 PHP extension development

What are first steps creating a loadable DLL module extension for PHP to create native support for my own library on Windows?

Would it require re-compiling PHP on windows? What are the tools needed? I don't want to have to use exec and the command line.

like image 999
Olaseni Avatar asked Mar 26 '10 08:03

Olaseni


People also ask

How do I enable PHP extensions in Windows?

On Windows, you have two ways to load a PHP extension: either compile it into PHP, or load the DLL. Loading a pre-compiled extension is the easiest and preferred way. To load an extension, you need to have it available as a ". dll" file on your system.

What is a PHP extension?

php file extension refers to the name of a file with a PHP script or source code that has a ". PHP" extension at the end of it. It's similar to a Word file with a . doc file extension.

Where are PHP extensions located?

extension_dir = <PATH TO EXTENSIONS>: The extension_dir points to the directory where the PHP extensions are stored. The path can be fully qualified (for example, C:\PHP\ext ) or relative (for example, . \ext).


2 Answers

See for the basic steps to compile PHP or PHP extensions:

https://wiki.php.net/internals/windows/stepbystepbuild

like image 63
Pierre Avatar answered Sep 21 '22 10:09

Pierre


Q. Would it require re-compiling PHP on windows?
A. Not necessarily, but it is the simplest way.

The command line is your best friend (apple, after years of GUI improved MACOS by ... readding the shell back)

I would try the following:

A. Setup a mingw-msys build system on win.
B. Follow PHP Extension Manual:
1. Download PHP Source code
2. Build PHP for Extension Development using the above MSYS
3. Generate a extension skeleton using ext_skel your extension will reside in ext/ directory
4. Edit the config.w32 (is a javascript macro system for Makefile generation similar to m4)
...
Continue by following these:
http://www.php.net/manual/en/internals2.php
http://talks.somabo.de/200610_zend_conf_php_extension_development.pdf

like image 20
clyfe Avatar answered Sep 25 '22 10:09

clyfe