Difference between revisions of "PHP WinBinder: Project2"

From The Uniform Server Wiki
Jump to navigation Jump to search
(New page: {{Nav PHP WinBinder}} '''''Windows Project 2''''' The Bat To Exe Converter from Fatih Kodak is a very solid utility that offers more than its name implies. One neat feature is its ability...)
 
(Proofreading and grammatical changes; some minor reformatting)
 
Line 2: Line 2:
 
'''''Windows Project 2'''''
 
'''''Windows Project 2'''''
  
The Bat To Exe Converter from Fatih Kodak is a very solid utility that offers more than its name implies. One neat feature is its ability to compress and add extra files to the exe created.
+
The Bat2Exe Converter from Fatih Kodak is a very solid utility that offers more than its name implies. One neat feature is its ability to compress and add extra files to the .exe created.
  
This combined this with WinBinder’s flexibility allows you to produce a windows application coded in PHP without the need for compiling. An entire windows project can be distributed and run as a single (exe) file.
+
This combined with WinBinder’s flexibility allows you to produce a Windows application coded in PHP without the need for compiling. An entire windows project can be distributed and run as a single (exe) file.
  
 
== Project configuration ==
 
== Project configuration ==
 
For quickness I will use [[PHP WinBinder: Tab Control | example 4]] as a template for the new application.
 
For quickness I will use [[PHP WinBinder: Tab Control | example 4]] as a template for the new application.
  
In order to package files into a single exe requires the file structure be flat. In this respect WinBinder places no restrictions just copy the files to a single folder and change paths accordingly. This step-by-step guides explains how.
+
In order to package files into a single .exe requires the file structure be flat. In this respect, WinBinder places no restrictions. Just copy the files to a single folder and change paths accordingly. This step-by-step guides explains how.
  
 
I have assumed you installed the plugin to Uniform Server's plugin folder.  
 
I have assumed you installed the plugin to Uniform Server's plugin folder.  
Line 68: Line 68:
  
 
== Test ==
 
== Test ==
Check the configuration works by running test_4.bat
+
Check that the configuration works by running test_4.bat
  
You now have a working project template use this to develop your application.   
+
You now have a working project template. Use this to develop your application.   
  
 
'''''[[#top | Top]]'''''
 
'''''[[#top | Top]]'''''
 
 
== New batch file ==
 
== New batch file ==
 
After completing your application create a new batch file named '''test_5.bat''' (or any name you like) with the following content:
 
After completing your application create a new batch file named '''test_5.bat''' (or any name you like) with the following content:
Line 79: Line 78:
 
php.exe -c php-wb.ini test_4.phpw
 
php.exe -c php-wb.ini test_4.phpw
 
</pre>
 
</pre>
When run will automatically close the command window after application is closed.
+
When run, it will automatically close the command window after application is closed.
  
 
'''''[[#top | Top]]'''''
 
'''''[[#top | Top]]'''''
 
 
== Create a single EXE file ==
 
== Create a single EXE file ==
 
The following step-by-step guide explains how to package all required files into a single executable.
 
The following step-by-step guide explains how to package all required files into a single executable.
Line 114: Line 112:
 
* '''G)''' Select '''include''' tab
 
* '''G)''' Select '''include''' tab
  
* '''H)''' Click '''Add''' button. With the exception of the two batch files select all files in folder C:\'''project2'''.
+
* '''H)''' Click '''Add''' button. With the exception of the two batch files, select all files in folder C:\'''project2'''.
  
  
'''''Note'':''' Depending on your application there may be resource files, include scripts and images these all nedd to be included.
+
'''''Note'':''' Depending on your application there may be resource files, include scripts and images these all need to be included.
 
|
 
|
 
[[Image:Bat2exe_4.gif]]
 
[[Image:Bat2exe_4.gif]]
 
|-valign="top"
 
|-valign="top"
 
|
 
|
'''''Note'':''' Steps I) and J) are optional only required if using an icon for the exe file.
+
'''''Note'':''' Steps I) and J) are optional and only required if using an icon for the .exe file.
 
   
 
   
  
Line 148: Line 146:
 
'''''Note 2'':'''
 
'''''Note 2'':'''
  
Project folder size is 7.58 MB and executable compresses to 2.59 MB this is reasonable for an un-compiled windows application.     
+
Project folder size is 7.58 MB and executable compresses to 2.59 MB. This is reasonable for an un-compiled windows application.     
 
|
 
|
 
[[Image:Bat2exe_5.gif]]
 
[[Image:Bat2exe_5.gif]]
Line 156: Line 154:
  
 
== Summary ==
 
== Summary ==
I have shown how to use this plugin independently of Uniform Server. It allows you o create Windows applications that are coded in PHP without the need for any compiling.
+
I have shown how to use this plugin independently of Uniform Server. It allows you to create Windows applications that are coded in PHP without the need for any compiling.
  
With this plugin installed to UniServer’s plugins folder it allows you to tap into 5-Nano’s control core. Advantage of this you can create a Windows application to provide an alternative control interface.
+
With this plugin installed to UniServer’s plugins folder it allows you to tap into 5-Nano’s control core. The advantage of this is that you can create a Windows application to provide an alternative control interface.
  
 
More importantly you can tailor an application to meet your specific requirements.
 
More importantly you can tailor an application to meet your specific requirements.
Line 164: Line 162:
 
UniController from UniServer 4-Mona series remains a popular control interface and makes an ideal vehicle for explaining programming techniques involved in producing an alternative controller.
 
UniController from UniServer 4-Mona series remains a popular control interface and makes an ideal vehicle for explaining programming techniques involved in producing an alternative controller.
  
Remaining part of this tutorial covers UniController for the 5-Nano series see [[PHP WinBinder: Alternative control 1 | '''next page''']] for an introduction.
+
The remaining part of this tutorial covers UniController for the 5-Nano series. See [[PHP WinBinder: Alternative control 1 | '''next page''']] for an introduction.
  
 
'''''[[#top | Top]]'''''
 
'''''[[#top | Top]]'''''

Latest revision as of 18:40, 29 January 2010

 

UniServer 5-Nano
PHP WinBinder.

Windows Project 2

The Bat2Exe Converter from Fatih Kodak is a very solid utility that offers more than its name implies. One neat feature is its ability to compress and add extra files to the .exe created.

This combined with WinBinder’s flexibility allows you to produce a Windows application coded in PHP without the need for compiling. An entire windows project can be distributed and run as a single (exe) file.

Project configuration

For quickness I will use example 4 as a template for the new application.

In order to package files into a single .exe requires the file structure be flat. In this respect, WinBinder places no restrictions. Just copy the files to a single folder and change paths accordingly. This step-by-step guides explains how.

I have assumed you installed the plugin to Uniform Server's plugin folder.

  1. Create a new folder for example c:\project2 – Can be any name and location you like
  2. Copy the entire contents of folder UniServer\plugins\winbinder to folder c:\project2
  3. Delete folder C:\project2\doc
  4. Move file C:\project2\examples\test_4.bat to folder C:\project2 - This runs your new script
  5. Move file C:\project2\examples\test_4.phpw to folder C:\project2 - This would be your new script
  6. Delete folder C:\project2\examples
  7. Move file C:\project2\php\libeay32.dll to folder C:\project2
  8. Move file C:\project2\php\php5ts.dll to folder C:\project2
  9. Move file C:\project2\php\php.exe to folder C:\project2
  10. Move file C:\project2\php\php-wb.ini to folder C:\project2
  11. Move file C:\project2\php\php-win.exe to folder C:\project2
  12. Move file C:\project2\php\ssleay32.dll to folder C:\project2
  13. Move file C:\project2\php\include\wb_generic.inc.php to folder C:\project2
  14. Move file C:\project2\php\include\wb_resources.inc.php to folder C:\project2
  15. Move file C:\project2\php\include\wb_windows.inc.php to folder C:\project2
  16. Move file C:\project2\php\include\winbinder.php to folder C:\project2
  17. Delete folder C:\project2\php
  18. That completes the project structure.

Top

Change paths

Paths need to be changed for the new flat structure:

File   Old Path   New Path
test_4.phpw  
Include "../php/include/winbinder.php";
 
Include "winbinder.php";
test_4.bat  
..\php\php.exe -c ..\php\php-wb.ini test_4.phpw
 
php.exe -c php-wb.ini test_4.phpw
php-wb.ini  
extension_dir = "./extensions"
 
extension_dir = "./"

top | Top]]

Test

Check that the configuration works by running test_4.bat

You now have a working project template. Use this to develop your application.

Top

New batch file

After completing your application create a new batch file named test_5.bat (or any name you like) with the following content:

php.exe -c php-wb.ini test_4.phpw

When run, it will automatically close the command window after application is closed.

Top

Create a single EXE file

The following step-by-step guide explains how to package all required files into a single executable.

How to create a single EXE file

Navigate to folder C:\project2\bat2exe and double click on file Bat_To_Exe_Converter.exe


  • A) Select options tab
  • B) Click button to right and navigate to the batch file to be converted. Select the file and click open.
  • C) The path and name of the executable is automatically generated. Change the file name if you wish.
  • D) Select Invisible application
    This hides that annoying flash by hiding the command window.
  • E) Select Temporary Directory - Where temporary files are stored - (Note: These are the additional files included)
  • F) Select Delete at exit - (Note: deletes additional files a cleanup operation)

That completes the first page set-up

Bat2exe 3.gif

  • G) Select include tab
  • H) Click Add button. With the exception of the two batch files, select all files in folder C:\project2.


Note: Depending on your application there may be resource files, include scripts and images these all need to be included.

Bat2exe 4.gif

Note: Steps I) and J) are optional and only required if using an icon for the .exe file.


  • I) Select Version information tab
  • J) Click button to right and navigate to the icon file you wish to use. Select the file and click open.
  • K) Click Compile button.
    A compile pop-up is displayed. Wait for this to close.
  • L) After the compile pop-up closes click Exit


Test EXE file:

Navigate to folder C:\project2 and double click on the file created test_5.exe

You can now distribute this single file or use as if it was a compiled.

Note: It appears to initially run slower this is because all additional files are decompressed and extracted to a temporary folder before the application is run.

Note 1:

If you like filling in forms you can add version details.

Note 2:

Project folder size is 7.58 MB and executable compresses to 2.59 MB. This is reasonable for an un-compiled windows application.

Bat2exe 5.gif

Top

Summary

I have shown how to use this plugin independently of Uniform Server. It allows you to create Windows applications that are coded in PHP without the need for any compiling.

With this plugin installed to UniServer’s plugins folder it allows you to tap into 5-Nano’s control core. The advantage of this is that you can create a Windows application to provide an alternative control interface.

More importantly you can tailor an application to meet your specific requirements.

UniController from UniServer 4-Mona series remains a popular control interface and makes an ideal vehicle for explaining programming techniques involved in producing an alternative controller.

The remaining part of this tutorial covers UniController for the 5-Nano series. See next page for an introduction.

Top