Using php as a desktop application [duplicate] - php

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
PHP as a Desktop Programming Language
I have developed a sales application with php (codeigniter framework). i am using xampp to run this application in local PC's browser. now i want 2 things:
is there any way to run this application as a desktop application? something like an icon will open the app and run without any browser. also without xampp to be set up.
also i want to protect the code from unauthorized using. someone can easily copy the code and run it on other computer. i want to prevent this.
please help me about these issues. thanks in advance.

PHP is not really suitable for either of these things. You're going to need a browser either way, but you could if you really wanted to use some kind of custom browser (e.g., you can use Java or .NET to create a window that has a basic browser page with only whatever controls you want to add on it rather than a full browser).
You won't be able to prevent people copying it, but you could try googling for a PHP obfuscator to make the code hard to read and you could add whatever checks you may wish to determine the PC is one you've approved (perhaps some kind of license file and you could activate it against a MAC address or something).

You can use PHP/GTK+ to create a PHP Desktop Application, but the code protection is very difficult, you can try ofuscating the code, or you can use a php compiler like this: http://www.phpcompiler.org/
I would not use php to develop a desktop application as you like, try using another language, dont use scripting, use compiled codes.
Luck with you project.

PHP is a recursive acronym which stands for "PHP: Hypertext Preprocessor." At its core, PHP is designed to process information and output it as HTML ("Hypertext"). If you wish to output information primarily as something other than HTML, PHP is probably the wrong language.
PHP is also a scripting language. That means that it is not compiled (converted from source code to machine code). As such, the scripts are human-readable. Tools such as phc exist, but if you want a compiled application, PHP is probably the wrong language.
Can you use PHP as a desktop application? Yes. Can you compile PHP? Yes. Should you? Probably not, because you are circumventing the purpose and features of the language.

If you are interested in writing client-side applications with PHP, you have to use PHP-GTK. I don't know how flexible is that. In any case, you should try it to see what it can do for you ;)

Related

How to Make .exe file for P.H.P. offline Application with Security [duplicate]

This question already has answers here:
Convert a PHP script into a stand-alone windows executable
(7 answers)
Closed 9 years ago.
I have shown this Convert a PHP script into a stand-alone windows executable , but my problem is still remains :(
I have developed a Offline Application using Core P.H.P., now I want to Sell it to my client, but my problem is that I don't want to allow Client can see my Source code or can access my Source code, they can run my application on their system but cannot able to change the Code.
If I made the .EXE of my application, user cannot even copy my source code, if he/she had done this then it cannot remains useful for them,
AND ALSO THE MAIN THING IS I WANT A UNIQUE SECURITY FOR A PARTICULAR USER, EVERY USER SHOULD NOT HAVE THE SAME ACCESS KEY TO ACCESS THIS APPLICATION
I have found this on GOOGLE and also on this SITE also,but still I didn't get my answer perfectly.
Actually I have no idea about this in P.H.P, If somebody found mistakes in my question then you are pleased to suggest me.
You can use PHP LockIt Software. it will encode your code and your client can not modify your code.
Take a look at hiphop php. A good and reliable 'compiler' for PHP
http://en.wikipedia.org/wiki/HipHop_for_PHP
https://github.com/facebook/hiphop-php/
Check Zend Guard.
Zend Guard, the most widely accepted PHP encoding and obfuscation product on the market, protects your application from unlicensed use and reverse engineering.
Prevent reverse engineering & unauthorized modifications
Protect your code from unauthorized use
Zend Optimizer and Zend Guard Loader - the free runtime decoders for Zend Guard
It's really good solution to protect your project.

In PHP how to deliver website to client without giving them source code

As in JSP we give "WAR" file to clients and it contains .class files and other configuration files but not the source code, is there any way, in PHP, to deliver the project (website) to client without giving them source code.
Facebook created a project called HipHop php, a php compiler.
See this post:
Can you "compile" PHP code?
Short answer, not really.
I mean you can compile php into a single .phar file however anyone with moderate php knowledge can get the code from that.
There are also solutions http://www.ioncube.com/ though I don't know how easily someone can get the code from it however I would strongly advise against any solution like this as they generally require the user of this "compiled" code to you their proprietary software to run it.

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

How to call a php function within <script> tag from coldfusion 9

I have this nice big Dev Kit written in PHP, but the application I'm currently developing is in CFML.
In an attempt to avoid rewriting the PHP, I'm going to try to just wrap the PHP in CF <script> tags and call the PHP functions when I need them.
Does anyone have any idea how to call one of those PHP functions inline in CF?
There's no built-in way to do this, but using CFGroovy (which allows you to inline any Java Scripting API-compliant language implementation) and Quercus (a PHP implementation in Java), you may be able to pull off what you want/
CFGroovy: http://www.barneyb.com/barneyblog/projects/cfgroovy2/
Quercus: http://www.caucho.com/resin-3.0/quercus/
A simple example including source code:
http://www.barneyb.com/cfgroovy2/
You can't. It's a whole other app engine. You could use CFHTTP to call a PHP page - but it's a bit overkill. You can look at Sean's solution here:
http://corfield.org/entry/ColdFusion_8_running_PHP
Edward M. Smith is right. You may be able to mix PHP and CFML by using Resin as your JVM. While I have not done so, I do believe it is possible to have Resin interpret your PHP code from within the same context as a CFML (ColdFusion) Web site.
A .cfm/.cfc could not contain any PHP and a .php file could not contain any CFML/CFScript;
however, those files could live side by side within your www.something.com domain.
Resin http://www.caucho.com/ is a Web Server/PHP Interpreter that is very fast and written in Java. It is the bundled JVM for the open source CFML project Railo.
Hope this helps.
You can pass data back and forth by having php/coldfusion store/retrieve client array's or variables.
One other choice is to force coldfusion to parse through .php files, for any coldfusion inside there. How it would handle the mixture of coldfusion and php, I am not sure...

C++ Serve PHP documents?

I am writing a small web server, nothing fancy, I basically just want to be able to show some files. I would like to use PHP though, and im wondering if just putting the php code inside of the html will be fine, or if I need to actually use some type of PHP library?
http://www.adp-gmbh.ch/win/misc/webserver.html
I just downloaded that and I am going to use that to work off of. Basically I am writing a serverside game plugin that will allow game server owners to access a web control panel for their server. Some features would be possible with PHP so this is my goal. Any help would be appreciated, thanks!
The PHP won't serve itself. What happens in a web server like Apache is before the PHP is served to the user it is passed through a PHP parser. That PHP parser reads, understands and executes anything between (or even ) tags depending on configuration. The resultant output, usually still HTML, is served by the web server.
There are a number of ways to achieve this. Modules to process PHP have been written by Apache but you do not have to use these. PHP.exe on windows, installed from windows.php.net, will do this for you. Given a PHP file as an argument it will parse the PHP and spit the result back out on the standard output.
So, one option for you is to start PHP.exe from within your web server with a re-directed standard output to your program, and serve the result.
How to create a child process with re-directed IO: http://msdn.microsoft.com/en-us/library/ms682499%28VS.85%29.aspx however, you won't be writing the child process, that'll be PHP.exe
Caveat: I am not sure from a security / in production use perspective if this is the most secure approach, but it would work.
PHP needs to be processed by the PHP runtime. I'm assuming the case you're talking about is that you have a C++ server answering HTTP queries, and you want to write PHP code out with the HTML when you respond to clients.
I'm not aware of any general-purpose PHP library. The most straightforward solution is probably to use PHP as a CGI program.
Here's a link that might be useful for that: http://osdir.com/ml/php-general/2009-06/msg00473.html
This method is nice because you don't need to write the HTML+PHP out to a file first; you can stream it to PHP.
You need execute the PHP page to serve the page it generates.
The easiest thing for you to do would be to add CGI support to your webserver in some basic form. This is non-trivial, but not too difficult. Basically you need to pass PHP an environment and input, and retrieve the output.
Once you have CGI support you can just use any executable, including PHP, to generate webpages.

Categories