SwiftlyTilting: usability, reusability

Thursday, December 17, 2009

phc-win 0.3.1 - a PHP EXE compiler

The bugs in bcompiler seem to have been worked out since phc-win 0.3.0. Unlike 0.3.0, this release has the standard PHP DLLs (for PHP 5.3.1) and separate Winbinder, win32std and bcompiler DLLs. I’m hoping to be able to get a smaller DLL with all of the required extensions going, but for now this is better than the buggy bcompiler version.

If you find php-win useful, please consider making a small donation.

View the phc-win documentation.

Download phc-win 0.3.1
Downloaded 1234 times

Note to XP users:
You may need to install the Microsoft Visual C++ 2008 Redistributable Package (x86) for EXEs to run correctly.

Note to Windows 2000, 9x Users
Due to a change in 5.3.x series of PHP, phc-win does not work on Windows 2000 or 9x machines. There are no plans to compile a 5.2.x series binary for phc-win. If you cannot upgrade your OS, I recommend using phc-win 0.2.1 which uses PHP 5.0.5.

Check the phc-win category for the latest version.

33 Comments Leave Comment

Does it support UPX?

Comment by KoczkaHUN — Wednesday, December 30, 2009 @ 11:10 am

I believe so, but I haven’t tested to confirm.

Comment by swiftlytilting — Wednesday, December 30, 2009 @ 8:05 pm

Jeez.. I am new to programming but I learnt how to use imacros and therefore I thought of making an app and perhaps giveaway or sell it online but I don’t know how to convert files into exe..

I tried to convert it into VBS form and couldn’t find an opensource vbs to exe.. later I thought, hey why not convert to php and then exe.. I came across many posts. Only your webpage looked genuine and I tried hell lot of unknown programs, don’t know how to operate them. What advice would you give me? Php to exe or vbs to exe or c# to exe?

And, I have downloaded older phc version.. trying to figure out things still. But, I am looking forward for your advice :)

Thanks and have a nice year ahead.

Comment by Rockstar Sid — Friday, January 1, 2010 @ 12:50 am

Hi Sid

If you are trying to pick a language to learn and make EXEs, PHP might not be the best option. If you already know PHP and would like to make tool using PHP, then phc-win is very useful. But in general PHP isn’t well suited for application building.

By the way, Microsoft gives away a “lite” version of Visual Studio, perhaps there is a VB version?

Comment by swiftlytilting — Sunday, January 3, 2010 @ 10:14 pm

Hi all,
I must say phc-win seems to be a quite good product but seems even to miss right what I’d need :(
The missing DLL that seem not to be supported are (at least):

- php_shmop.dll (necessary fir IPC Inter-Process-Communication)
- php_win32service.dll (necessary for creating Windows Services that respond to start/stop WinServiceManager commands)

For both I receive the infamous error:

PHP Warning: PHP Startup: win32service: Unable to initialize module
Module compiled with module API=20060613
PHP compiled with module API=20090626
These options need to match

Fatal error: Call to undefined function shmop_open() in
test.php on line 124

The php-embed.ini of course contains:
—— cut here ——-
—— cut here ——-

That’s really a sin.
I’ve extracted the (dated 25-09-2008) from the phpV530 distribution.
Instead, the “php_win32service.dll” (dated ‎06-08-2008) from pecl5.2-win32-200808060430.zip found googling around on:

Unfortunately I don’t have more recent pecl DLLs neither for “php_win32service.dll” nor for “php_shmop.dll”.

BTW it could be nice to be able to run phc from the command prompt or at least have drag-n-drop enabled (drag a PHP to get the exe) in order to automatize the exe production.

Thanks a lot in advance for any eventual hint!

P.S. Sorry for the possible cross-posting (I wasn’t able to find back my already sent msg).

Comment by Luca Regoli — Sunday, January 31, 2010 @ 4:13 am

Hi Luca

That means you must compiled the DLL with VC9, not the VC6 version. I guess the ones currently on the pecl website are compiled with VC6.

As for command line, I plan on offering that in my next release :)

thanks for the using phc-win

Comment by swiftlytilting — Wednesday, February 3, 2010 @ 8:28 am

win32service is available here: http://downloads.php.net/pierre/ download a version with VC9 in the name. Choose the thread safe versions (TS)

Comment by swiftlytilting — Wednesday, February 3, 2010 @ 9:35 am

I found the necessary DLL and it does WORK with phc-win 0.3.1


It should be this:


or this:


I’ve already forgotten!
Anyway it works.

No way for the SHMOP unfortunately.

Now I’m trying to figure out how to read a configuration file in the same dir..



Comment by Luca Regoli — Wednesday, February 3, 2010 @ 10:39 am

Hey I found a very strange behavior of phc-win 0.3.1!
I compiled my test appl under my XP machine at work and it works. The same I did at home with Vista (argh!!!!) and it works (unbelievable! ;)).
Now that’s the foolish thing: at work I use 4 servers all of them are Windows Server 2003 Standard Ed. SP2 (as far as I remember).
Well let’s name them S1, S2, S3, S4 (S1 and S2 have 2 giga of ram, S3 and S4 have 4 giga of ram). Same Xion processors. All machines have the same load (very low only I/O). S1 and S2 are 4-processor. S3 and S4 are 8-processor machines.

Well my test executable works only on S3! On S1 won’t run saying it’s not an executable (I don’t recall exact error but I can tell you later). On S4 it runs only after a while. Let say I run it like “test.exe -h” at the command prompt (as it is a console application) I have to wait about 40 seconds then I get the output !!!!! Of course in S3 the help answer is immediate, less than a second to do the same operation. As expected and as it works on the clients!
Any ideas??
This morning if I have time I’ll try to build a win appl instead of console one so I can test if there is a problem in the EXE building as I’m lead to think.

BTW thanks for previous answers ..I saw them just now!


P.S. I do hope I’ll have time soon to look into the code to write a REDO button/menu item..

Comment by Luca Regoli — Tuesday, February 9, 2010 @ 9:50 pm

Hi Luca

Thanks for the report on different OS versions. I’m not able to offer much help as I’m not an expert in windows executables. It seems PHP 5.3.0 might only be 100% compatible with Windows XP SP2 and up. In the past the biggest complaint about phc-win is that it wasn’t up to date, so now I want to keep moving forward and not worry so much about backward compatibility.

Comment by swiftlytilting — Tuesday, February 9, 2010 @ 10:44 pm

Hi all,
with a long delay, I just wanted to advise that the strange misbehaviour happened right from the absence of the Microsoft Visual C++ 2008 Redistributable Package (x86) someone already adviced here!

I installed them on the machines where I had the absurd msg: “The system cannot execute the specified program.” and now the sw works perfectly!

Here is where you can download the package:


Greetings to all.
Luca Regoli

Comment by Luca Regoli — Wednesday, March 3, 2010 @ 7:27 pm

Excellent work :) Was using bamcompile before, but its not developed any more and the php 4 was getting hard to work with. I also tried Roadsend compiler but for Windows, overall, it was far too beta and buggy :(
But now I have found your application and I am extremely happy - a working frontend, and a working backend.
My only wish would be that it wrapped all the files into 1 single exe in a file similar in size to bamcompile can output. But I understand, from another forum I read, you are working on outputting a single file already? How is that progressing?

Comment by Xymod — Wednesday, May 26, 2010 @ 1:37 am

I recommend using phpack if you want a single exe. It’s a new ‘compiler’ from alec george. you can find it on winbinder.org forums

Comment by swiftlytilting — Wednesday, May 26, 2010 @ 3:33 am

SwiftlyTilting: How to make single exe: http://winbinder.org/forum/viewtopic.php?f=10&t=1178

Comment by KoczkaHUN — Sunday, May 30, 2010 @ 7:24 am

Hi, I’m writing a browser-based (using a web server on my PC) and I’m wondering if the compiled version of the PHP files would still work the same way. I tried to download the docs and got this:

Fatal error: Cannot use [] for reading in /homepages/27/d91760665/htdocs/tvwiki/w/extensions/MaintenanceShell/MaintenanceShell.php on line 85

I’m also curious if I compiled it on my XP machine, would someone using older or new versions of Windows would still be able to use it without installing additional runtimes.

Comment by RT Cunningham — Tuesday, June 1, 2010 @ 7:26 am


Sorry about that, I was working on some code and got distracted and apparently forgot that I broke the wiki. Thanks for letting me know the wiki was down. You should be able to read the documentation now.

As far as installing VC++ runtimes, I think XP and older versions of Windows will have to, but newer versions of windows include the runtime files in the Windows installation.

Comment by swiftlytilting — Tuesday, June 1, 2010 @ 4:14 pm

Where can I get a compatible version of php_sockets.dll? All I can find is 5.3.2 VC9. I tried using that module, but wouldnt work.

Comment by Trevor — Monday, July 5, 2010 @ 5:19 pm

Nevermind my last comment. I was able to use the 5.3.2 socket extension. The problem was I downloaded the non-thread safe version. After downloading the TS version, it ran just fine.

Comment by Trevor — Monday, July 5, 2010 @ 5:22 pm

Is there any forum ou more documentation about php-win? I’m having some trouble,

I can’t even run the demo code. It compiles without error, but when i run it, it closes silently.
Also, are there any documentation about building php oriented to window standalone apps?

Comment by José Sá — Tuesday, July 13, 2010 @ 8:52 am

Hi Jose

The forums at Winbinder.org might be able to help out.

Comment by swiftlytilting — Tuesday, July 13, 2010 @ 11:16 am


can you tell me how i compile phc with php5.3.3 ?

or can you release a new Version with php5.3.3 and the new Winbinder dll?

Best regards

Comment by Josef Fröhle — Thursday, October 14, 2010 @ 3:19 am

To use php 5.3.3 you can just copy the php_ts.dll file from PHP 5.3.3 over the PHP 5.3.2 file

You can also just copy the new php_winbinder.dll over the old one

Comment by swiftlytilting — Thursday, October 14, 2010 @ 3:40 pm

Is there a support forum or mail list for phc-win? Searching thru all the blog post comments is a little time consuming!

Anyway, my question involves passing arguments or parameters into the exe once it is created. How would this be done, and how would I setup the php to actually receive/read the parameters?


Comment by jsherk — Tuesday, November 9, 2010 @ 9:23 am

phc-win is a great tool, i use it for compile my php cli script,, thanks so much :)

Comment by securesh — Saturday, February 19, 2011 @ 6:52 pm

Hi,(sorry for my English)

please add some functions like:

phc-win.exe 1.php 1.exe -c -silent (where 1.php - source, 1.exe - out file, -c console, -silent mode … )


Comment by Alex — Wednesday, April 27, 2011 @ 2:35 pm

:) -> sorry, don`t see source !
I`ll create it my self!

Comment by Alex — Wednesday, April 27, 2011 @ 2:59 pm


Awesome app!

Problem I am having is trying to get MySQL to work, I have tried both mysql_connect and PDO connections, with and without including the libs in the php-embed.ini but no luck.

Your help will be greatly appreciated.

Using: PHP 5.3.5 and PHC-WIN 0.3.1

Comment by onyxg — Wednesday, December 21, 2011 @ 2:43 am


I’m trying to compile a code which uses fileinfo and xml module using the latest release of phc-win. I see that it is compatible with PHP 5.3.1 windows release so I also downloaded that package to get the module extensions. I did a simple test and somehow I can’t make it run properly (extension included in the ini file).

Am I missing something here? or are there any compatibility issues?

Comment by Ron — Monday, September 30, 2013 @ 1:38 am


I download your phc 0.3.1 when i compile single file or project directory its create the exe file but when i open the main file exe not open the fle in console or any window. i m using the windows 7… ..

please help???

Comment by Ahsan Khan — Sunday, March 23, 2014 @ 6:29 am

Hi Ahsann Khan

Does your program output anything to the console? If so it will not work in windows mode. Also you need to include the dll files in the same directory as the EXE

Comment by swiftlytilting — Sunday, March 23, 2014 @ 3:32 pm

Thanks man I really love this tool. I’ve been using it for about 3 years. I’ll make a fair donation soon!

Comment by Javier Fish — Wednesday, May 28, 2014 @ 4:09 pm

yep is possible, update this for php 5.5 or 5.4 and compatibly with VC9 and VC11 for windows7,8 Skin.

Comment by Zynx — Thursday, June 5, 2014 @ 2:35 am

Zynx, did you try to update it to 5.5 ?
If yes, how did you do ?

Comment by ZmotriN — Thursday, June 26, 2014 @ 9:01 pm

Leave a Comment

Validate XHTML | Word Press