PHP WinBinder: Project: Difference between revisions
(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 | 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 | # 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 | # 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 | # 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 | 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 | 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 | 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 | 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 | 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 | 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.
|
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
Test
Check that the configuration works by running test_4.bat
You now have a working project template. Use this to develop your application.
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.
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
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.
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 like filling in forms you can add version details. |
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.