PHP WinBinder 2: Introduction

From The Uniform Server Wiki
Jump to: navigation, search
PHP WinBinder 2 :  Introduction | WinBinder portable | Add code | PHC-Win | Resource

 

Contents

UniServer 5-Nano
PHP WinBinder 2.

WinBinder Part 2

Introduction

I like alternatives and options! In my original WinBinder tutorial, I avoided compiling because there was no real need and it would have introduced another level of complexity.

In reality that complexity is a myth, because there is an excellent utility called PHC-Win, a PHP compiler with a WinBinder front end. All it takes is a few mouse clicks to compile a complete project. This utility is an excellent piece of work by Andrew Fitzgerald (“frantic”). All PHP files are compiled into a nativePHP format, greatly reducing their size. These are then compiled into a single file.

You may be wondering how this relates to UniServer? My original tutorial concluded with an alternative Uniform Server controller that is modifiable to meet your own requirements. However the tutorial skipped a need to explore programming Windows applications independent of Uniform Server.

To address this I have repackaged the newest release of WinBinder and converted it to be fully portable. For completeness, I included PHC-Win as a separate download. These are not strictly plugins, but you will find them in the WinBinder plugin folder on SourceForge.

WinBinder Portable

WinBinder portable is a repackaged version of WinBinder for users that want a working version straight out of the box. Hence anything relating to compiling WinBinder has been removed. The folder structure was changed to be more compatible with Uniform Server. The excellent documentation, examples and licence have been retained.

Hand positioning windows controls is tedious; WinBinder contains a “form editor,” greatly reducing the tedium of this task. It takes a no-frills approach, uses a minimalist interface and is extremely easy to use. Downloading it is worth the effort just for this tool alone.


Phc-win

In the previous tutorial, compacting files into a single executable file, bat_to_exe was used. Although this gets the job done, each file needs to be extracted before the application can run. PHP files are not compiled, so their size remains unchanged.

PHC-Win on the other hand compiles each individual PHP file, greatly reducing their size. These along with any resource files are compacted into a single executable. The advantage of using PHC-Win is that the total number of files included in an application distribution is minimal.

Top

Download and Install

Note: all download file names provide an indication of package content. Once downloaded these can be renamed. This tutorial assumes you will be installing on "C" drive and into a folder named "us_wb". you can choose any other location and folder name; just substitute as appropriate in the tutorial description.

WinBinder Portable

Portable WinBinder has been packaged in two file formats the “exe” is a 7z self-extracting archive while the “zip” archive requires manual extraction.

Depending on the file format choose one of the following installation methods:

exe:

  • Create a new folder us_wb and copy WinBinder_531VC6TS_FULL_1.0.exe to it.
  • To extract double click on file WinBinder_531VC6TS_FULL_1.0.exe
  • A new folder is created WinBinder_531VC6TS_FULL_1.0 rename this to wb (or any name you prefer)
  • To save space delete WinBinder_531VC6TS_FULL_1.0.exe

zip:

  • Create a new folder us_wb and copy WinBinder_531VC6TS_FULL_1.0.zip to it.
  • Extract all files to this current folder.
  • Navigate down to folder named WinBinder_531VC6TS_FULL_1.0 and rename to wb (or any name you prefer)
  • Move this folder up to us_wb
  • To save space you can delete file WinBinder_531VC6TS_FULL_1.0.zip. and folder WinBinder_531VC6TS_FULL_1.0

Note:

Folder structure:

c:\us_wb\'''wb''' - Top level

c:\us_wb\wb\docs           - Includes manual in chm and html format
c:\us_wb\wb\examples       - All WinBinder examples have a corresponding batch file
                             double click this file to run an example.
c:\us_wb\wb\form_editor    - The form editor allows you to quickly layout controls for a
                             windows application. To run double click on batch file
                             '''Run_form_editor.bat'''
c:\us_wb\wb\php            - PHP bineries and WinBinder files
c:\us_wb\wb\php\extensions - PHP dll's. Including '''php_winbinder.dll''' required for all
                             windows applications.
c:\us_wb\wb\php\include    - WinBinder files - Required for all applications
c:\us_wb\wb\php\resources  - Images used in examples. Optional, if you delete the
                             examples folder you can delete this folder. 
c:\us_wb\wb\us_tutorial    - Support files for this tutorial. 

File download options

There are two file options: VC6 or VC9. These refer to the compiler that was used to create the binaries. The reason for including both is to allow you to compare the speed of your application when run on either.

If you are using PHP with Apache 1 or Apache2 from apache.org you need to use the VC6 versions of PHP

VC6 Versions are compiled with the legacy Visual Studio 6 compiler. VC9 Versions are compiled with the Visual Studio 2008 compiler. The VC9 versions require you to have the Microsoft 2008 C++ Runtime (x86) or the Microsoft 2008 C++ Runtime (x64) installed.

Note: In Uniform Server, all components (Apache, MySQL and PHP) currently use VC6 binaries.

File option:

Like Uniform Server they only extract to a folder and sub-folders. There is no install program, so nothing is placed in the registry. To uninstall, just delete the folder and all its content.

WinBinder extension compatibility

Please note that the WinBinder extension php_winbinder.dll is compatible across a PHP series. That means the included dll will run on PHP versions 5.3.0, 5.3.1 and 5.3.2RC1, etc.

Phc-win

Phc-win has been packaged in two file formats the “exe” is a 7z self-extracting archive while the “zip” archive requires manual extraction.

Download from SourceForge.

Depending on the file format choose one of the following installation methods:

exe:

  • Create a new folder us_wb and copy V55_PHCWIN_531VC9TS_1.0.exe to it.
  • To extract double click on file V55_PHCWIN_531VC9TS_1.0.exe.
  • A new folder is created V55_PHCWIN_531VC9TS_1.0 rename this to phc (or any name you prefer)
  • To save space delete V55_PHCWIN_531VC9TS_1.0.exe

zip:

  • Create a new folder us_wb and copy V55_PHCWIN_531VC9TS_1.0.zip to it.
  • Extract all files to this current folder.
  • Navigate down to folder named V55_PHCWIN_531VC9TS_1.0 and rename to phc (or any name you prefer)
  • Move this folder up to us_wb
  • To save space you can delete file V55_PHCWIN_531VC9TS_1.0.zip and folder V55_PHCWIN_531VC9TS_1.0.


Folder structure:

c:\us_wb\'''phc'''             - Top level contains the executables

c:\us_wb\phc-winbinder-example - Includes an example application ready for compiling.

c:\us_wb\source                - Files used to create phc-win

c:\us_wb\us_example            - Uniform Server tutorial example

File download options

Phc-win does not provide a VC6 version. It is released with VC9 binaries only.

This is not a real restriction, but you must include the binaries an application was compiled with.

PHC-Win does not install anything on your PC's system path or registry other than extracting to a folder. Hence the program is inherently portable. To uninstall just delete the folder and all its content.

Top

Acknowledgements

I would like to express my thanks to Alec Gorge, WinBinder forum name "alecgorge," for allowing inclusion of his binaries.

Also may thanks to Andrew Fitzgerald (WinBinder Wiki name Frantik) for allowing publication of PHC-Win (I have made only a small modification; it essentially it remains unchanged).

The above two chaps are dedicated to the WinBinder project and its advancement.

Alec's binaries have been uploaded to mediafire for safekeeping:

Note 1:

This WinBinder forum thread is the source of original material.

Note 2:

If you like scripting with PHP, Alec published a full version of php5ts.dll, where he statically compiled most of the PHP extensions including the kitchen sink. It has a footprint of 3.8 MB. You also have a choice of using the mini version that has a footprint of 3MB.

Below is a list of modules included:

Full Version - 3.8MB     Mini Version - 3MB

Core
PDO
Phar
Reflection
SPL
SQLite
SimpleXML
bcmath
bcompiler
bz2
calendar
com_dotnet
ctype
date
dom
ereg
exif

filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring 
mcrypt
mhash
mysql
mysqli
mysqlnd
odbc
openssl

pcre
pdo_mysql
pdo_sqlite
soap
sockets
sqlite3
standard
tokenizer
wddx
win32std
winbinder
xml
xmlreader
xmlwriter
zip
zlib

 

Core
PDO
Phar
Reflection
SPL
SimpleXML
com_dotnet
ctype
date
filter
ftp
gd
hash
iconv
json

libxml
mbstring
mcrypt
mhash
pcre
pdo_sqlite
soap
sockets
standard
tokenizer
win32std
winbinder
xmlwriter
zip
zlib

Hence the above forum thread is worth a visit.

Top

Summary

The real reason for including the above downloads is to provide a consistent reference source for Uniform Server users.

Specifically those users that would like to design and compile alternative control or other Windows application to run the servers or start associated applications.

The remainder of this tutorial provides a quick introduction to these tools. First to be covered is WinBinder portable.

Top


Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox
Uniform Server