====== Embeder Tutorial ====== ===== Pre-requisites ===== All you need is: - The scripts below, cut'n paste them, all in the same directory. - [[php>downloads.php|php5ts.dll]] installed somewhere in your path (or at least in the current directory). - [[win32std:index|php_win32std.dll]] installed somewhere in your PHP extension path (see //php-embed.ini// in the embeder zip). - and of course [[win32std:embeder|embeder.exe]] (put //embeder.exe// and //php-embed.ini// in the same directory than your //php5ts.dll//) ===== The tutorial files ===== ==== make.bat: ==== @echo off embeder.exe new myapp embeder.exe main myapp main.php embeder.exe add myapp include.inc * The first line create a brand new exe file called ''myapp.exe'' * The second includes main.php and specify that it's the main script (the one to start with). * The third line include a PHP file needed by main.php. ==== include.inc ==== ==== main.php ==== 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): * the same directory than your exe * the same directory than php5ts.dll ===== 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 [[:downloads|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>downloads.php|PHP installer]]. **I dream** about something like a //PHP redistribuable// that will install PHP and the usefull extensions used in client-side scripting.