Table of Contents

Embeder Tutorial


All you need is:

  1. The scripts below, cut’n paste them, all in the same directory.
  2. php5ts.dll installed somewhere in your path (or at least in the current directory).
  3. php_win32std.dll installed somewhere in your PHP extension path (see php-embed.ini in the embeder zip).
  4. and of course embeder.exe (put embeder.exe and php-embed.ini in the same directory than your php5ts.dll)

The tutorial files


@echo off
embeder.exe new myapp
embeder.exe main myapp main.php
embeder.exe add myapp include.inc


<? function hello() { echo "Hello people !"; } ?>


function _f($file) { return defined('EMBEDED')?'res:///PHP/'.md5($file):$file; }
include _f('include.inc');

As you noticed the included file is wrapped by the _f function. This function returns the correct filename according to the EMBEDED constant which is automatically defined when your script is embedded in the exe.

Running the test

You can then run make.bat to create the executable file and you’re ready to run the exe.

If that fail it’s probably because the php-embed.ini is not in (in the correct order):

Making release

The DOS box

If you use a GUI you probably want to get rid of the DOS box, there’s currently no direct support for that in embeder but I’ve also released a port of Perl's exetype that has the abilty change the ‘type’ of an exe, in our case from CONSOLE (the default exe type created by embeder) to WINDOWS (console-less).

The PHP Binaries

Currently the only way to install the PHP binaries is to use the PHP installer.

I dream about something like a PHP redistribuable that will install PHP and the usefull extensions used in client-side scripting.

  win32std/embeder_tutorial.txt · Last modified: 2005/02/13 12:54
Recent changes RSS feed Powered by PHP Driven by DokuWiki