Compdigitec Labs

« How to use dd to copy, move and erase disks | Home | Stopping the “PHP Fatal error: Internal object missing in” error in PHP-GTK2 »

Embeder - a free PHP to EXE solution

By admin | August 15, 2008

If you’re looking for a PHP to EXE solution that supports PHP5, Embeder is one rarely mentioned application that will convert your PHP applications into a Windows executable file, although it will only work with PHP 5.0.3. Below are the steps to set it up on your system. (Will run under Linux with Wine, too.)

  1. Download embeder and it’s php-embed.ini.
  2. Download PHP and php_win32std.dll. (Do not use the PHP binary provided on php.net)
  3. Extract PHP to a directory (preferably short with no spaces). Put embeder.exe and php-embed.ini inside the directory.
  4. Put php_win32std.dll inside the ext directory.
  5. Add the directory to your PATH.
  6. You’re done! To test it, compile the following test program (save as test.php):
    <?php
    echo “Testing…\r\n”;
    ?>

    Run these commands to make test.exe:
    Windows:
    embeder new test
    embeder main test test.php
    Linux:
    wine embeder.exe new test
    wine embeder.exe main test test.php

Notes:

  1. If you are using Wine, you can safely ignore these messages:
    fixme:msvcrt:MSVCRT__sopen : pmode 0×01b6 ignored
    fixme:advapi:DeregisterEventSource ((nil)) stub
  2. (Wine users only) If you experience the crash wine: Unhandled page fault on read access to 0×00000000 at address 0×100c5619 (thread 0009), starting debugger…, it means that you are not using PHP 5.0.3. See full log for details.
  3. (Windows users only) If you experience the following crash dialog, it also means that you are not using PHP 5.0.3.
    Embeder Crashing on Windows XP with PHP 5.2.6

So as you can see, Embeder is an good solution to use for PHP to EXE or php2exe problems. You can even combine it with bcompiler to create commercial software. If you found this article or guide useful, please help us spread the word or leave a comment. Don’t forget to subscribe to Compdigitec Labs for more interesting articles!

Topics: Linux, PHP, Windows |

Comments