PHP WinBinder 2: PHC-Win: Difference between revisions

Proofreading and grammatical changes; some minor reformatting
(New page: {{Nav PHP WinBinder 2}} '''''WinBinder Part 2 PHC-Win''''' After completing a project you will want to package and distribute it. An excellent application for this task is PHC-Win written...)
 
(Proofreading and grammatical changes; some minor reformatting)
 
Line 2: Line 2:
'''''WinBinder Part 2 PHC-Win'''''
'''''WinBinder Part 2 PHC-Win'''''


After completing a project you will want to package and distribute it. An excellent application for this task is PHC-Win written by Andrew Fitzgerald (WinBinder Wiki name Frantik). It is essentially a click and go program however a small amount of preliminary work is required before running this program.
After completing a project, you will want to package and distribute it. An excellent application for this task is PHC-Win, written by Andrew Fitzgerald (WinBinder Wiki name Frantik). It is essentially a click and go program. However a small amount of preliminary work is required before running this program.


The tutorial assumes you have extracted a copy of PHC-Win as explained on [[PHP WinBinder 2: Introduction#Phc-win  | '''this page''']].
The tutorial assumes you have extracted a copy of PHC-Win as explained on [[PHP WinBinder 2: Introduction#Phc-win  | '''this page''']].
Line 8: Line 8:
== Preliminary work ==
== Preliminary work ==
PHC-Win packages files that are contained in a folder and its sub-folder.
PHC-Win packages files that are contained in a folder and its sub-folder.
Any files outside this structure are not accessible and will not be packaged.


Any files outside this structure are not accessible hence will not be packaged.
Our application folder, C:\us_wb\'''my_app''', uses four files that are outside of this structure.
 
Our application folder C:\us_wb\'''my_app''' uses four files that are outside of this structure.


These are the four WinBinder files:
These are the four WinBinder files:
Line 20: Line 19:
Copy these files from folder C:\us_wb\wb\php\'''include''' to your application folder.
Copy these files from folder C:\us_wb\wb\php\'''include''' to your application folder.


For this tutorial copy them to folder C:\us_wb\'''my_app'''
For this tutorial, copy them to folder C:\us_wb\'''my_app'''


Our application needs to pick these up hence a single line requires changing
Our application needs to pick these up, so a single line requires changing:


Edit file C:\us_wb\my_app\'''z_basic.phpw''' (your application)  
Edit file C:\us_wb\my_app\'''z_basic.phpw''' (your application)  
Change this line
Change this line:
<pre>
<pre>
Include "../wb/php/include/winbinder.php";      // Location Of Winbinder Library
Include "../wb/php/include/winbinder.php";      // Location Of Winbinder Library
Line 33: Line 32:
Include "winbinder.php";      // Location Of Winbinder Library
Include "winbinder.php";      // Location Of Winbinder Library
</pre>
</pre>
That completes the provisional work test you application before proceeding by running the batch file C:\us_wb\my_app\'''z_basic.bat'''  
That completes the provisional work. Test your application before proceeding by running the batch file C:\us_wb\my_app\'''z_basic.bat'''  


'''''[[#top | Top]]'''''
== Run PHC-Win ==
== Run PHC-Win ==
{|
{|
Line 105: Line 103:
</pre>
</pre>
|}
|}
'''''[[#top | Top]]'''''


== Create distribution package ==
== Create the distribution package ==
Final part of the process is to create a distribution package. This requires copying all the required files into a folder.
The final part of the process is to create a distribution package. This requires copying all the required files into a folder.


Inside folder C:\us_wb, create a new folder named my_dis (any name you like). Inside this create another folder named final (again any name you like). You can always use a folder outside of us_wb.  
Inside folder C:\us_wb, create a new folder named my_dis (any name you like). Inside this, create another folder named final (again any name you like). You can always use a folder outside of us_wb.  


Reason for two folder levels is purely for testing. It will highlight attempts to access files outside of our flat structure.
The reason for two folder levels is purely for testing. It will highlight attempts to access files outside of our flat structure.


=== Build Distribuation ===
=== Build the Distribution ===
* First copy the executable C:\us_wb\my_app\'''z_basic.exe''' to folder C:\us_wb\my_dis\'''final'''
* First copy the executable C:\us_wb\my_app\'''z_basic.exe''' to folder C:\us_wb\my_dis\'''final'''


PHC-Win compiles only the PHP files hence any images used need to be copied
PHC-Win compiles only the PHP files so any images used need to be copied:
* Copy '''uslogo.ico''' to folder C:\us_wb\my_dis\'''final'''
* Copy '''uslogo.ico''' to folder C:\us_wb\my_dis\'''final'''
* Copy '''green.bmp''' to folder C:\us_wb\my_dis\'''final'''
* Copy '''green.bmp''' to folder C:\us_wb\my_dis\'''final'''
* Copy '''red.bmp''' to folder C:\us_wb\my_dis\'''final'''
* Copy '''red.bmp''' to folder C:\us_wb\my_dis\'''final'''


In order to run our application the following core binaries are required.  
In order to run our application, the following core binaries are required.  


From folder C:\us_wb\'''phc''' copy the following files to folder C:\us_wb\my_dis\'''final'''
From folder C:\us_wb\'''phc''' copy the following files to folder C:\us_wb\my_dis\'''final'''
Line 131: Line 128:
* '''php_bcompiler.dll''' - Bam compiler
* '''php_bcompiler.dll''' - Bam compiler


'''''[[#top | Top]]'''''
=== Test ===
=== Test ===
Perform a quick test double click on file C:\us_wb\my_dis\final\'''z_basic.exe'''  
Perform a quick test by double clicking on file C:\us_wb\my_dis\final\'''z_basic.exe'''  


That’s it, confirm your application runs then zip folder '''final''' and distribute.
That’s it! Confirm your application runs, then zip folder '''final''' and distribute.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''


== Summary ==
== Summary ==
In my original write up I implied compiling was difficult. After making a few minor changes to your code using PHC-Win all it takes is a few mouse clicks.
In my original write up I implied compiling was difficult. After making a few minor changes to your code using PHC-Win, all it takes is a few mouse clicks.


We added images to our final distribution package however take a closer look at what is added to the exe file! PHC-Win adds these and any other files contained in our application folder. This duplication is not required [[PHP WinBinder 2: Resource | '''next page''']] shows how to resolve this.
We added images to our final distribution package, however take a closer look at what is added to the .exe file! PHC-Win adds these and any other files contained in our application folder. This duplication is not required. The [[PHP WinBinder 2: Resource | '''next page''']] shows how to resolve this.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''