SwiftlyTilting: usability, reusability

Tuesday, March 7, 2006

phc-win 0.2.1 - bugfixes

As expected, there were some bugs with the first release of phc-win. The biggest problem occured whenever the path of the program file or any code contained a space: it simply wouldn’t compile the code. That has been fixed in this version. Some other minor bug fixes as well. PHC-WIN is compatible with PHP 5.0.5

phc-win 0.2.1 rar archive
Downloaded 6179 times
phc-win 0.2.1 upgrade rar archive
Downloaded 1765 times
For the latest version, check the phc-win category.


Dear Sir,

I use sockets on my php file.
I already uncomment the php-embed.ini for the extension php_sockets.dll and also already copy the extension php_sockets.dll to the executable directory
but still it seems to be not working
Here is the error
The procedure entry point _zval_copy_ctor_func could not be located in the dynamic link library php5ts.dll
I even already upgrade the php5ts.dll to be version 5.1.1
Any suggestion?

Thank you

Comment by Hermawan Haryanto — Sunday, May 14, 2006 @ 10:45 am


I’ve never seen that error before.. your script works fine before compiling?

Comment by swiftlytilting — Sunday, May 14, 2006 @ 12:40 pm


Yes, my script were working fine. I always test it using CLI method:

php -q myscript.php

And everything works as expected, until I compile it :D
I know this is sounds rediculous but I really need some help on this compiler down here.

Thanks man

Comment by Hermawan Haryanto — Sunday, May 14, 2006 @ 8:22 pm

hmm.. after you compile, you should have a file in the directory called myscript.phb.. try

php -q myscript.phb

if the script works, then the problem lies with the embeder step of phc-win. if it doesn’t work, then the problem is with bcompiler.

Comment by swiftlytilting — Tuesday, May 16, 2006 @ 7:17 am

Here is my php-embed.ini file

# Defaults from sapi/cli/php_cli.c

report_zend_debug= 0
;display_errors= 1

register_argc_argv= 1
html_errors= 0
implicit_flush= 1
output_buffering= 0
max_execution_time= 0

;include_path =
extension_dir = “”

===== end of php-embed.ini =====

If I turn off the php_sockets.dll extension, then the compiled file (myscript.exe) will work (no error) but of course it means I can’t do the functions that need socket to be enabled.
But if I turn it on, then it will throw me the error “The procedure entry point _zval_copy_ctor_func could not be located in the dynamic link library php5ts.dll”

I have tried to run php -q myscript.phb and it throw me the compiled ASCII/obfuscated code.

Does it gives you any clue?

Thank you

Comment by Hermawan Haryanto — Tuesday, May 16, 2006 @ 8:31 am

i’m suprised you were unable to run myscript.phb.. the bcompiler.dll should make it possible to use just like myscript.php

I will try with a test script that uses sockets and see if I can reproduce your error

Comment by swiftlytilting — Tuesday, May 16, 2006 @ 11:44 am

Is it possible because of PHP version? When I run php -q myscript.php, it uses PHP 5.1.1 But as I see your copy of php5ts.dll, it’s version is 5.0.5. I’ve replace it with mine but still got no luck. Just a thought.

Thank you

Comment by Hermawan Haryanto — Wednesday, May 17, 2006 @ 10:58 am

I have a very simple php script, with these lines of code:

When i compile it, it says OK.No problems. When i run it, i get these errors:

Warning: Unknown: failed to open stream: Invalid argument in main on line 1

Warning: Unknown: Failed opening ‘res:///PHP/RUN’ for inclusion (include_path=’.
;C:\php5\pear’) in main on line 1

The file is located in c:\Temp\mystuff\phc-win.0.2.1\projects\ , projects its a folder i made .

Any help would be appreciated. Thanks in advance.

Comment by Eemerge — Tuesday, May 30, 2006 @ 12:28 am

Seems the code has been removed from my previous post, i’ll try posting it here again:


i removed the php tags from the post, but they are present in the script.

Comment by Eemerge — Tuesday, May 30, 2006 @ 12:36 am

If you get that error it means the code was not embdeded into the exe file.

I just tried compiling the file and it worked fine..

Comment by swiftlytilting — Tuesday, May 30, 2006 @ 4:27 am

i moved the file to the root dir (c:\Temp\mystuff\phc-win.0.2.1), and it worked. Is there something i should change to make it work in another dir?

Also, related to the upper posts with php_socket, i have the same problem …the same messages.

Comment by Eemerge — Tuesday, May 30, 2006 @ 4:41 am

the exe needs to have its associated dlls in the same directory or in the directory set by php-embed.ini. See the help on the wiki under Support files needed.

I still need to look into the sockets issue.. will do soon

Comment by swiftlytilting — Tuesday, May 30, 2006 @ 10:27 am

I just tried the sample sockets code on the php sockets manual page.. It worked as expected. I used the PHP 5.0.5 dll with the php 5.0.5 sockets dll.

If you need the php 5.0.5 files you can get them here: http://www.php.net/get/php-5.0.5-Win32.zip/from/a/mirror

Hopefully future versions will not be bound to php 5.0.5, but currently the dll that supports the embedding features does not work with newer versions. I’m hoping embedding will be supported by WinBinder which has a whole team behind it as opposed to embeder which has a single developer.

Comment by swiftlytilting — Tuesday, May 30, 2006 @ 11:34 am

i used the same version of php-sockets, from php 5.0.5 and i got that error…i’ll try again, maybe i’ll get lucky :)

Comment by Anonymous — Tuesday, May 30, 2006 @ 2:33 pm

sorry, i forgot to fill in the name: eemerge :)

Comment by eemerge — Tuesday, May 30, 2006 @ 2:34 pm

just tested with php 5.0.5 dlls, works fine. by the way, the example from phpmanual needs removed the PHP_NORMAL_READ parameter …otherwise you’ll get an error (for those who might be itnerested).

swiftlytilting, could you post a little “tutorial” on what to do, if i want to have the scripts in a folder inside the PHC folder ( eg: C:\phc-win021\myfirstapp )? Thanks in advance :)

Comment by eemerge — Tuesday, May 30, 2006 @ 3:05 pm

- Copy all scripts and any files accessed within the program to C:\phc-win021\myfirstapp

- When including files, you must use the function exe_resource, like so:

function exe_resource($file)
{  return defined('EMBEDED') ? 'res:///PHP/'.strtoupper(md5($file)):(getcwd() . "/$file");


echo file_get_contents(exe_resource('./mydata.file'));

- All files must be referenced with a relative path starting with ./ . Currently phc-win will only compile files in directory selected and sub directories of that directory.

- Then run phc-win and select compile directory. Select the directory, and then select the main program file.

- When recompiling, the compiler will skip over any files if it finds a compiled phb file already existing. So if you want to recompile only one file, just delete the filename.phb file, and recompile.

Comment by swiftlytilting — Tuesday, May 30, 2006 @ 3:27 pm

newer versions of phc doesn’t have “wrap-console.exe” or “wrap-window.exe” like previous version.

Is that correct ??
why ??


Comment by alfredo — Tuesday, September 5, 2006 @ 2:29 pm

The difference between those two files is just one byte so in this version the compiler will just edit the file as needed.

Comment by swiftlytilting — Tuesday, November 14, 2006 @ 3:13 pm

Hi Swiftlytilting,

First of all thank you for this great compiler.

I’m trying to use this compiler to compile PHP-GTK2 apps.

So I tried to replace the dlls by 5.1.4 dlls


But I get a windows error. I cannot start the program (phc-win.exe).

Here is the error report :



Do you know how to make the program works with new versions of PHP ?
Or maybe you know how to use it to compile PHP-GTK2 ?

Thank you in advance for your answer.

David V.

Comment by David V. — Thursday, January 25, 2007 @ 10:54 am

PHC-WIN doesn’t work with newer versions of PHP because one of the PHP extensions used hasn’t been updated. :(

Comment by swiftlytilting — Monday, January 29, 2007 @ 2:24 am

Sweet :)

Comment by Nikolas — Tuesday, January 30, 2007 @ 9:12 am


Thank you for replying about the newer version of PHP.

Could you please be more precise ?
Wich PHP extensions hasn’t been updated ?

David V.

Comment by David V. — Wednesday, January 31, 2007 @ 11:27 am

win32std, which is needed for the embedding process, has not been updated in a quite a while and the developer has indicated he’s not planning an update :\

Comment by swiftlytilting — Sunday, February 4, 2007 @ 6:31 pm

Anybody have any luck with pear? I use a few different packages from there and I’d hate to have to go modify everything to make it work.

Comment by Francis — Thursday, November 15, 2007 @ 12:03 pm

Validate XHTML | Word Press