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 0x01b6 ignored
    fixme:advapi:DeregisterEventSource ((nil)) stub
  2. (Wine users only) If you experience the crash wine: Unhandled page fault on read access to 0x00000000 at address 0x100c5619 (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!

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles!

Topics: Linux, PHP, Windows | 14 Comments »

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

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

    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 17:01

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

    what do yuo mean by that????

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

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

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

    @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 21:41

    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 22:45

    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 22:54

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

    The instruction at “0x000000001” referenced memory at “0x000000001”. The memory could not be “read”.

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

  8. Alan Says:
    March 28th, 2010 at 05:45

    Hello,

    This is good tool.

    I installed and follow all steps and works seems fine. with cli commands displays:
    >embeder new test
    ‘.\test.exe’ created
    >embeder main test test.php
    Updated ‘res://.\test.exe/PHP/RUN’ with 33 bytes

    but when i double click/ launch the test.exe
    then crash error:
    “test.exe has encountered a problem and needs to close. We are sorry for the inconvenience.”

    OS: winxp.

    Could you please tell where i am missing.

    Regards,

  9. Alan Says:
    March 28th, 2010 at 06:05

    Hello,

    I had downloaded the PHP 5.0.3 and all files from your site links.

    — i extract the php in new folder in that folder i put the embeder.exe and php-embed.ini inside the directory and php_win32std.dll inside the ext directory and Added the directory to system environment Variable PATH

    then run cli commands displays:
    >embeder new test
    ‘.\test.exe’ created
    >embeder main test test.php
    Updated ‘res://.\test.exe/PHP/RUN’ with 33 bytes

    but when i double click/ launch the test.exe
    then crash error:
    “test.exe has encountered a problem and needs to close. We are sorry for the inconvenience.”

    can we use higher version than PHP 5.0.3 and what kind of php have to download from php.net in case need to work with higher version.

    — and how can i include mysql with same exe , in case database i used with php application.

    Regards,

  10. brindha Says:
    May 6th, 2011 at 03:22

    Hello

    I use php5.2.7 how to add embeder and it’s php-embed.ini. please Did u explain me?

  11. zzee Says:
    October 15th, 2012 at 14:41

    Interesting tool. Does it make console or gui exe?

  12. gullit Says:
    May 7th, 2016 at 00:07

    je vous compred pas quesqu’on peut executer par la suite

  13. gullit Says:
    May 7th, 2016 at 00:08

    je vous compred pas quesqu’on peut executer par la suite pour tapez les commandes ?

  14. gullit Says:
    May 7th, 2016 at 00:10

    what we can execute after that process ?

Comments