Compdigitec Labs

« | Home | »

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 | 7 Comments »

7 Responses to “Embeder – a free PHP to EXE solution”

  1. Szabó Róbert Says:
    April 18th, 2009 at 3:52 am

    Dear Compdigitec Labs,

    Embeder is a great php to exe converter and it works fine. But how can it includes extensions? Especially I’d like to use php_dio.dll to handle a serial port with open_dio() etc. functions.

    Could you please answer this question? It would be very important.

    Thank you very much
    Best regards
    Róbert Szabó

  2. Rita Says:
    July 9th, 2009 at 5:01 pm

    I dont understand = > Add the directory to your PATH.

    what do yuo mean by that????

  3. Rita Says:
    July 9th, 2009 at 5:16 pm

    i have php 5.2.8 it will work to??????
    but i have install php with appserv

  4. admin Says:
    July 10th, 2009 at 8:54 am

    @Rita:

    Add the directory to your PATH means that you must add the directory that you extracted PHP and Embeder to the PATH environmental variable. To do so, right click “My Computer” and select “Properties”. Then go to the “Advanced” tab and click the “Environmental Variables” near the bottom of the dialog window. In the “System variables” section, scroll down until you see the “PATH” variable. Once you get there click the “Edit” button and add a semi-colon, followed the full absolute path of the folder that you extracted PHP and Embeder to. Click OK in the dialog and also in the next dialog to apply the settings.

  5. Mohamed Says:
    August 15th, 2009 at 9:41 pm

    Yay It worked for me…
    You just have to put “php_win32std.dll” (without quotes) in the “ext” folder (without quotes) in the extracted folder (PHP) and it will work just fine

  6. jur Says:
    September 28th, 2009 at 10:45 pm

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

    how to do this? i dont get it. sorry

  7. jur Says:
    September 28th, 2009 at 10:54 pm

    Okay! i got it!
    but this is my another problem

    The instruction at “0×000000001″ referenced memory at “0×000000001″. The memory could not be “read”.

    Click on OK to terminate the program
    Click on Cancel to debug the program

Comments