PHP WinBinder: Project: Difference between revisions

From The Uniform Server Wiki
Jump to navigation Jump to search
(New page: {{Nav PHP WinBinder}} '''''Windows Project''''' This page looks at creating a separate Windows application independent of Uniform Server. Applications produced using this method, are not...)
 
(Proofreading and grammatical changes; some minor reformatting)
 
Line 4: Line 4:
This page looks at creating a separate Windows application independent of Uniform Server.
This page looks at creating a separate Windows application independent of Uniform Server.


Applications produced using this method, are not compiled hence are not standalone executables they require several support files.  
Applications produced using this method are not compiled, hence are not standalone executables. They require several support files.  
 
That said, they are easy to program using PHP and Winbinder.
That said they are easy to program using PHP and Winbinder.




Line 16: Line 15:
|-valign="top"
|-valign="top"
|
|
# Create a new folder for example '''c:\project1''' – Can be any name and location you like
# Create a new folder. For example '''c:\project1''' – Can be any name and location you like
# Copy folder UniServer\plugins\'''winbinder''' to folder c:\'''project1'''
# Copy folder UniServer\plugins\'''winbinder''' to folder c:\'''project1'''
# Copy file C:\project1\winbinder\examples\'''test_4.bat''' to folder c:\'''project1''' – Runs your application rename if you like
# Copy file C:\project1\winbinder\examples\'''test_4.bat''' to folder c:\'''project1''' – Runs your application; rename if you like
# Copy file C:\project1\winbinder\examples\'''test_4.phpw''' to folder C:\project1\'''winbinder''' – this folder will contain all your script files, rename file test_4.phpw if you like
# Copy file C:\project1\winbinder\examples\'''test_4.phpw''' to folder C:\project1\'''winbinder''' – this folder will contain all your script files; rename file test_4.phpw if you like
# Delete folders C:\project1\winbinder\'''doc''' and C:\project1\winbinder\'''examples''' these are not required
# Delete folders C:\project1\winbinder\'''doc''' and C:\project1\winbinder\'''examples''' these are not required
# That completes the project structure (see image on right).
# That completes the project structure (see image on right).
Line 50: Line 49:
Include "php/include/winbinder.php";      // Location Of Winbinder Library
Include "php/include/winbinder.php";      // Location Of Winbinder Library
</pre>
</pre>
'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== 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:
<pre>
<pre>
start winbinder\php\php-win.exe -c winbinder\php\php-wb.ini winbinder\test_4.phpw
start winbinder\php\php-win.exe -c winbinder\php\php-wb.ini winbinder\test_4.phpw
</pre>
</pre>
When run will automatically close the command window and start your application.
When run, it will automatically close the command window and start your application.


'''''[[#top | Top]]'''''
'''''[[#top | Top]]'''''
== Create an EXE file ==
== Create an EXE file ==
Using a batch file to start your windows application produces an annoying flicker as the command window opens and closes. This can be avoided by converting the batch file to an executable it also provides an opportunity of personalising the file by including your own icon.
Using a batch file to start your windows application produces an annoying flicker as the command window opens and closes. This can be avoided by converting the batch file to an executable. It also provides an opportunity for personalising the file by including your own icon.


{|
{|
Line 96: Line 93:
|-valign="top"
|-valign="top"
|
|
'''''Note'':''' Steps G) and H) are optional only required if using an icon for the exe file.
'''''Note'':''' Steps G) and H) are optional and only required if using an icon for the exe file.
   
   


Line 110: Line 107:
'''''Test EXE file'':'''
'''''Test EXE file'':'''


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


If you wish you can delete files test_4.bat and test_5.bat they are no longer required.
If you wish you can delete files test_4.bat and test_5.bat. They are no longer required.




Line 125: Line 122:


== Summary ==
== Summary ==
The above has shown how to create an independent windows application project. Your PHP script or scripts can be run using an executable file however you do require all the additional support files.
The above has shown how to create an independent windows application project. Your PHP script or scripts can be run using an executable file however you still require all the additional support files.


If you want a single executable file the only way to do this is compile the project. However there is an alternative! It is more a slight of hand where you compact all the necessary files into a single executable file.
If you want a single executable file, the only way to do this is compile the project. However there is an alternative! It is more a sleight of hand where you compact all the necessary files into a single executable file.


I mentioned the included utility was small and powerful, it has the ability to perform the above. To implement this method requires a flat file structure this is covered in project 2 on the [[PHP WinBinder: Project2 | '''nest page''']].
I mentioned the included utility was small and powerful; it has the ability to perform the above. To implement this method requires a flat file structure. This is covered in project 2 on the [[PHP WinBinder: Project2 | '''next page''']].


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

Latest revision as of 18:28, 29 January 2010

 

UniServer 5-Nano
PHP WinBinder.

Windows Project

This page looks at creating a separate Windows application independent of Uniform Server.

Applications produced using this method are not compiled, hence are not standalone executables. They require several support files. That said, they are easy to program using PHP and Winbinder.


Project configuration

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

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

  1. Create a new folder. For example c:\project1 – Can be any name and location you like
  2. Copy folder UniServer\plugins\winbinder to folder c:\project1
  3. Copy file C:\project1\winbinder\examples\test_4.bat to folder c:\project1 – Runs your application; rename if you like
  4. Copy file C:\project1\winbinder\examples\test_4.phpw to folder C:\project1\winbinder – this folder will contain all your script files; rename file test_4.phpw if you like
  5. Delete folders C:\project1\winbinder\doc and C:\project1\winbinder\examples these are not required
  6. That completes the project structure (see image on right).

Top

Change paths

Paths in both test_4.bat and test_4.phpw need editing

Edit file C:\project1\test_4.bat

Change this line:

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

To:

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

Edit file C:\project1\winbinder\test_4.phpw

Change this line:

Include "../php/include/winbinder.php";       // Location Of Winbinder Library

To:

Include "php/include/winbinder.php";       // Location Of Winbinder Library

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:

start winbinder\php\php-win.exe -c winbinder\php\php-wb.ini winbinder\test_4.phpw

When run, it will automatically close the command window and start your application.

Top

Create an EXE file

Using a batch file to start your windows application produces an annoying flicker as the command window opens and closes. This can be avoided by converting the batch file to an executable. It also provides an opportunity for personalising the file by including your own icon.

How to create EXE file

The plugin includes a powerful little utility to accomplish this. Navigate to folder C:\project1\winbinder\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 Current Directory - Where temporary files are stored - (Note: No temporary files created)
  • F) Select Delete at exit - (Note: No temporary files created)

That completes the first page set-up

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


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


Test EXE file:

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

If you wish you can delete files test_4.bat and test_5.bat. They are no longer required.


Note:

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

Top

Summary

The above has shown how to create an independent windows application project. Your PHP script or scripts can be run using an executable file however you still require all the additional support files.

If you want a single executable file, the only way to do this is compile the project. However there is an alternative! It is more a sleight of hand where you compact all the necessary files into a single executable file.

I mentioned the included utility was small and powerful; it has the ability to perform the above. To implement this method requires a flat file structure. This is covered in project 2 on the next page.

Top