First thing first, you need to collect the tools:
- PHP Application that you want to bundle
- Portable Web Server, I use xampplite 1.7.3 as my web server because my PHP Application using PHP 5.3. There are other portable web server that you can use, server2go but I will tell it how to do with it later.
- Winrar.
- Backup your database application.
- Extract xampplite 1.7.3 to C:\. Why I choose C root directory, because this is normally installation folder location for windows operating system and this folder absolutely exist.
- Copy your PHP Application to htdocs in xampplite 1.7.3 extracted folder.
- Make sure that no one web server / mysql server running, then you can run apache and mysql by double clicking apache_start.bat and mysql_start.bat or you can run xampplite control panel to start apache and mysql.
- Access your phpmyadmin by type localhost/phpmyadmin using your favourite browser.
- Create new database and then restore your backed up database via phpmyadmin.
Open database_interface.lib.php located in C:\xampplite\phpMyAdmin\libraries, then comment at this line:
Then run
your phpmyadmin again. If you have restored the database, setting your
application then try to running your application via browser by type: localhost/myapplication. If everything's gonna be okay, then we can start to the next step.
Before bundle this application, we need to create batch file that will be executed after installation process was done. Create new file, filename.bat then open it with your favourite text editor, and add this codes,
call apache_start.batcall mysql_start.batif exist {"C:\Program Files\Mozilla Firefox\firefox.exe"} {
"C:\Program Files\Mozilla Firefox\firefox.exe" localhost/myapplication
}
Above code is used to run apache_start.bat, mysql_start.bat and run your web application using firefox (x86-windows 32 bit).
Now we have to create an .exe file to run your web application. You just need Winrar to do that. Select all folder under xampplite, right click then choose add to archive,
Fill archive name with application name, check create SFX archive and create soli, then move to Advanced tab, shown below,
I suggest
to fill this path to extract, same as the extracted xampplite folder
(C:\xampplite\), and don't change it, because if you change it, you
could change many files under xampplite folder with your custom folder.
Run after extraction is used to execute batch file (that has
created before) after extraction was completed. You can try to custom in
this advanced SFX options, like installer title, installer icon,
license and many more. If you have done to custom your installer, then
just click OK and wait the process, and when it done, just try to
install it to other computer (make sure there is not web server
running).
Conclusion
This
method usefull enough to create web application into an .exe file. This
is actually not create an application (like desktop application) but
just compress portable web server that include your application and
databases and then it could be portable.
If you have a question don't hestitate to comment below.
0 comments
Post a Comment