Turn PHP Program with MySQL Database into .exe file - php

So I have this php program that I can run on my computer locally using WAMP. However, I would want it to be accessed by another person in his own computer. Some of the things I've read include dealing with the IP address. However, in my specific situation, I think it would be better to turn it into an executable file (php + the mysql database I used).
Is it possible? If yes, how?
If not, what is the best or easiest way for it to be accessed by, for example, a client.

There is no .exe natively with PHP. PHP does support PHAR archives that are executable and you can use an SQLite database which is portable.
This is what you will see with applications like Composer.
http://php.net/manual/en/intro.phar.php

just create an executable program with vb or something, then connect it to the database,,,

Related

Is it possible to bundle/ship PHP+MySQL in standalone executable?

I am trying to create an application that has a sender and receiver. The entire application is only meant to be used on a LAN and can also possibly be done almost completely through the browser.
The "sender" part is an application of some sort that will need to run a local server on the person's computer and allow for php,html,css,js, and mysql to run.
On the "receiver" end, it is simply a person's browser accessing a webpage being served up from the "sender" application.
I have been looking into nodejs as a means of accomplishing the server part of this...but I am not sure if I can ship it as an exe with mysql and php installed and allow it to be execd from php. I am aware of being able to install these extensions using npm, but I want to ship a whole exe to the end user and not have them install node on their own.
Is this possible? If so, how? Thanks in advance.
You may want to look into XAMPP. It appears to be a portable(-ish) installation of Apache, PHP, MySQL, and a few other things (e.g., Perl). You way want to see if you can strip out the irrelevant parts and put your application code into it somehow.
I believe there is a sure way to this.
I came across server2go some few months ago and it does the work perfectly.
Just download server2go from here http://www.server2go-web.de/download/download.html
Run the application and a folder will be created to the location specified with all the needed files in it.
Just copy your php, html, css etc files to the www folder
Import your mysql database if you are using mysql
When all is set, zip the folder and then use
zipInstaller, you can get it here http://www.nirsoft.net/utils/zipinst.html
ZipInstaller creates an exe application.
Thanks

Best practices to let my web users download custom .exe from my site using PHP

im trying to implement on my site a system who let the user download a file that have to be change before the download.
I have a master file (a .exe program), that inside have a variable who has to be change for every different user.
The most simple solution is to change a variable inside a xml file every time the user want his personalized exe and then make the exe file to read the external file. BUT i dont want the user to download more than one file.
Is this possible? using php can i change a parametter inside a compiled program? Thanks for any help and suggestions!
If you really really know what you're doing and you know exactly the bits that need to be flipped inside the file, then yes, it's possible to modify the .exe file with PHP. Otherwise you have to make changes to the source or other files the .exe is built with and compile the program on the server before sending it to the user.
In theory it's certainly possible (PHP is turing complete), but as stated in other answers it will be hardly worth the hassle (considering the fact that you have to ask whether it is possible shows you'd have to investigate at last for days into the standard exe-format).
I'd recommend one of the following:
1) Zip the program with the configuration file; either use a separate launcher (e.g. Java [a JAR is a ZIP file]) or add a configuration file that is read by the program itself. There is a number of PHP libraries for generating ZIP files.
2) compile the program with the changed source on the server itself; however this can also become quite complicated depending on your server configuration and the programming environment you use. If you have never administered a virtual server I would not even slightly recommend that as an option.
3) If you can assume that the user got somewhat stable Internet access you might also consider to let hir download a standard executable, where additional configuration will be downloaded later on by the program itself (e.g. by transmitting the username to the server). However this creates dependencies you might want to avoid (your user probably can't use it on machines without Internet access and you should assert that your server is up most of the time).
While it's probably possible, I doubt it's worth the hassle. Unless you're trying to fight piracy or something. Why don't you just serve the user a custom .zip file with the .exe and a config .xml?
[edit after OP commented]
I presume what you're trying to edit is the facebook ID/username? Well, try to compile the base file with some unique string like "THISNEEDSTOBEREPLACED", then use some binary safe function to replace it. Though remember things can and will get tricky if the string lengths don't match.

Its possible to compile a php script and the mysql?

I have a php script who access a MySQL database, all running in my server. I know how to compile php scripts in order to generate a .exe program, but this is the first time I got a php script that uses a MySQL, and I dont know how to compile the entire think. I dont want the .exe to use a remote mysql because I need to use it offline.
Thanks for any help.
If you use PDO you might just switch to SQLite on the fly.
No, it is not possible to embed a MySQL server in a compiled PHP script. The best you will be able to do is either replace MySQL with something like SQLite (not sure how feasible that will be) or build an installer that ships MySQL and the appropriate database tables (much more feasible).

Convert PHP-MySQL web application to desktop app (exe)

I have developed a PHP-MySQL web application, which is a school-based project.
My client wants this application to be converted into a .exe file such that it can be installed on his desktop and use it.
How the PHP website can be converted to a .exe file and can it be run without the need of a database/server software?
Please advice.
The convenient solution is not to convert the website to .exe. I think it will be better if you have portable server/php/mysql and make the website work from a usb or CD with autorun.
NuSphere's PhpDock claims to do this: It serves as a deployment helper and comes with a bundled web server. However, I don't know about the database part, and it's not free.
PhpDock enables you to deploy any PHP web application as a Stand Alone Windows Desktop application w/o any changes in the code.
I don't know that particular product, but I have been using their IDE for years and am quite happy.
try using a site-specific browser. it will make a desktop app that is basically a portal running to your webapp. try this one:
https://mozillalabs.com/prism/
It allows alot of advanced features like system tray icons and such. I have used it many times!
Hope this helps, JL
Short answer: Not possible.
Long answer: It depends.
You could install a web- and database server on his machine (or create an installer that does it) and run the application locally on his machine.
or
You keep the application on a server and just provide a launcher that opens his browser and points it to the URL of the application.
As Artefacto mentioned, it might be a good idea to switch to SQLite instead of MySQL but depending on how your application is written it might require a lot of code and SQL Query changes.
No. You have at least to remove the dependency on MySQL (and use e.g. sqlite instead).
Then, you would either have to:
Convert the webpages to windows dialogs. This would completely change your application (e.g. what would originally be http "form submissions" would be someting completely different). At this point, it'd much easier to write a .NET application
Bundle a web server (e.g. Apache) with PHP installed.
Another try would be to turn your php project into PHP-GTK (http://gtk.php.net/).
Yet another one is to give HPHP a try (https://github.com/facebook/hiphop-php/wiki/) and try to turn the generated C code into something like a .DLL in .NET and use it for the logic while coding the UI in say, C#.
Just create a simple program in C or C++ that will just add icon in Start menu, desktop and Quickstart. If your client clicks the icon it will open the default OS browser and point it to URI of your application online.
That might fool your client :)
Or maybe it will be enough for him (he might be asking you to convert it to exe because he can't remember URI or something - ask him what is the reason).
You can use xampp open-source project to pack your PHP site into an executable file.
Use the following steps:-
1. Download Xampp source code.
Add your PHP file inside htdocs directory(Ref:- https://sourceforge.net/p/xampp/code/HEAD/tree/win32/xampp/htdocs/).
Now compile the XAMPP source code and distribute it.
For DATABASE creation and initial data loading in the database, you can code your site in such way that if database is not created, it redirects the page to install.php which do the database creation and data loading task using sql file provided(you need to add SQL file containing database structure and required data).
Don't forget to delete the SQL file post installation of database.
Not sure that's gonna be possible but have a look at:
WinBinder
WinBinder is a new open source
extension for PHP, the script
programming language. It allows PHP
programmers to easily build native
Windows applications.
(source: winbinder.org)
Solution 1:
There are several solutions to convert your web application into a desktop application, the one I prefer is the open source solution: PhpDesktop, but unfortunately it only supports SQLite.
Best Solution:
To convert your PHP application with MySQL I know a paid solution that does this: 'ExeOutPut For Desktop', it is the best for this job
Php desktop is the way to go, it's actually very simple to modify to the version of PHP you want to use and is open source too https://github.com/cztomczak/phpdesktop

Is it possible to build a remote file manager in PHP?

Is it possible to do file operations from a script running on a different server than the files being operated on? That is, upload, move, rename, delete, create new, modify, etc.
How would I go about doing this?
As far as I know, it can be done only by logging into the shell via the remote script and then executing the commands from within the shell, or maybe by using FTP from the remote script.
Another method would be:
Create scripts in the server which will accept parametres (POST data) and do operations based on the arguments that are supplied to it.
One way do to it would be through FTP.
You are basicallly describing WebDAV, which was created so that write-methods like those found in ftp could be done over HTTP.
I imagine it would be tricky to make a non-http file manager with PHP that was save and reliable.
There are several libraries for adding making WebDAV feasible in PHP, not that are core or standard extensions yet, though.
yes, this is either possible through php’s ftp functions or the native file system functions.
i wrote one myself (myftphp <-- advertisment :D)
using the native filesystem functions there are always restrictions on permission management, but for managing files in a public directory it’s perfect
See http://rosefinch.sf.net
A open source php file manager.
There is a fantastic remote filesystem manager available.
Just have a look at Flysystem.
It requires PHP 5.4 or higher.

Categories