Packing php, mysql and VB.net together - php

I've just finished designing a POS software using VB.net I've used mysql and php (to display a few important banners etc. And used inside VB.net using webbrowser fuction) . Is there a way that I can place all the php and mysql db inside the debug folder and avoid using xamp or any other localhost server tools? Basically I want to make the application free of any dependency of third party softwares. Is there a way to do it ?

Related

deploy website without source code

I have developed website in php. I want deploy it without source code. Is it possible with php?
Can I convert my website code to some intermediate form and then deploy it ?
You can use the Zend guard to encode your code so it can't be reverse engineered...
http://www.zend.com/en/products/guard/
PHP HTML and JavaScript are open source language so you can do nothing to encode them which can't be decode. One way is Zend Guard - Encode Your PHP Applications for php which can be decoded by sites like these: Websites for zend decoder online.
But the good news is if you always use the last version of Zend Guard
it can't be reversed, because still there is no decoder came for it.
Another way is, you buy a VPS (Virtual private server) or Dedicated Server and deploy your source code in there and you just sell your web application usage to your customers (not the source code). So just, you have the user and password of host and no one can see your application code.
Update
Recently, I've used ionCube. It's fine. However you need to change your deployment process a bit. Before transferring code to deployment server you need to encrypt it by ionCube. After that you should install ionCube loaders on the server by which php can load the encrypted codes.
if you are going to host your website on shared hosting or any thirdparty hosting, you may use zend encoder or ioncube php encoder, they will protect your source code.
http://www.zend.com/en/products/guard
http://www.ioncube.com/sa_encoder.php

Running PHP on iOS?

I have an app that uses a few php scripts to access a mysql database.
Can anyone advise on how to implement an offline version?
I understand it is easy to create an SQLLite database in the app and populate it when the web server is available? true?
When I want to query it, is it possible to do that using the pre-existing php?
thanks in advance
HMJ
It's important that you make the distinction between the components you are speaking of - PHP is a server side language that is meant to carry out the DB queries. SQLite is the iOS framework that allows us client-side DB management on the iOS operating system. On the iPhone you can carry out the same queries that are generated using your PHP but they are to be built using objective-c. There are some useful wrappers that do this, including FMDB.
Kodiak PHP runs on an iPad. It has PDO installed. You can create a local sqlite database. I tested it with this code:
<?php
error_reporting(E_ALL);
$db = new PDO('sqlite:test.sql');
$n = $db->exec('DROP TABLE IF EXISTS USER');
$n = $db->exec('CREATE TABLE user (login TEXT)');
$n = $db->exec('INSERT INTO user VALUES("joe")');
$r = $db->query('SELECT * FROM user');
foreach ($r as $row) {
echo $row['login']."\n";
}
?>
In regard to PH7... it just implements the PHP language and a some functions, it does not support all PHP functions nor extensions. For instance, PCRE is often used for regular expression processing. PH7 does support it. PH7 is a rewrite, intended for embedded applications, basically a more capable scripting engine such as Lua, but not as big a footprint as Javascript.
Kodiak PHP is an actual PHP port. Use phpinfo(); to see what is has compiled into it, it's quite a bit.
To run your SQL scripts in an iOS app, you'll need to compile a PHP engine into your iOS app and get Apple to allow it :) - Kodiak is able to do it because Apple allows exporting files written in their app, but Apple does not allow importing files into the app. Therefore, you must use copy/paste. The app is intended for writing and testing code not running a bunch of PHP script to create an app.
In short, the answer to your question is: Yes, it is possible to run PHP and write to an sqlite database in an iOS app. However, to do so you'll need to compile a PHP library into your app. Compiling PHP for iOS is no small feat (I haven't done it yet). Kodiak has done it, but I have not found a freely available PHP library for iOS yet.
I don't think you can "install" php on iOS. But, you may also, I can't tell.
What I would do, easier I think, is to create a local database with the same schema and stuff.
If offline, pull from the offline DB, online from the live DB (web).
How to ?
Write a script that will play the role of "Model". It's like in the MVC technic. Your script will only need to handle both DB. Since SQL is SQL, your queries will not really change so :
if(Offline){
// Offline
Use something similair to PDO but for SQLLite
} else {
// Online
Use something similair to PDO but for MySQL
}

ColdFusion and PHP in same Flex application

I am working on a web application in Flex.
I have already used PHP as a "Flex Server", but now I need to add a mailing service and it seems that ColdFusion is the perfect tool for it.
I don't want to waste time and rewrite all the PHP services to ColdFusion, so I am wondering if it is possible to have PHP and ColdFusion in the same web app.
In the project properties for Flex Server I can only choose PHP or ColdFusion but not both.
Can I somehow manually connect to ColdFusion?
In the project properties for Flex Server I can only choose PHP or
ColdFusion but not both. Can I somehow manually connect to ColdFusion?
The Flex Server option is really meaningless in Flash Builder. I think it helps Flash Builder find the services-config file. I always leave it blank or select none and manually specify the services config file as a compiler argument.
I assume you are using AMF / Flash Remoting; is that correct? You can find the services-config file that is currently being compiled into your app and modify it to add a new destination for ColdFusion services. You may want to combine your current services-config file with the one that comes with ColdFusion.
You should look for the CF Serivces-config file in a directory similar to this:
C:\JavaServer\servers\CFInstanceName\cfusion.ear\cfusion.war\WEB-INF\flex
It'll be slightly different if you're using the standard edition of ColdFusion instead of the multi server edition. I'm not sure where to find the PHP config file; but the two files should be very similar.
Of course, I assume that PHP can also send email relatively easily and I'm not sure the short-term gains of building this will outweigh the long term headaches of dealing with two technologies side by side.

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

Transform my Flex application into Adobe Air. Running a PHP in Air

I'm a newbby in Adobe AIR/Flex.
I have developed a simple Flex web app. that through 2 Php's, can connect to a DB and return an XML result of the query. I uploaded the PHP and Flex files to my internet server, and the app. works fine.
My question is:
How can I make the same app. work in Adobe AIR? In other words, I have made a new AIR project, and I copy/paste the Flex code. When I run the project, it does not work and say things like:
[RPC Fault faultString="Error #2070: Security sandbox violation: caller cannot access Stage owned by ." faultCode="Client.CouldNotDecode" faultDetail="null"]
at mx.rpc.http::HTTPService/http://www.adobe.com/2006/flex/mx/internal::processResult()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\http\HTTPService.as:851]
at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:188]
at mx.rpc::Responder/result()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\Responder.as:43]
at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74]
at DirectHTTPMessageResponder/completeHandler()[C:\autobuild\3.2.0\frameworks\projects\rpc\src\mx\messaging\channels\DirectHTTPChannel.as:403]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at flash.net::URLLoader/onComplete()
So I think that in my AIR app. I cant write HTTP services. Or maybe I cant use the php file that connects to the DB, makes the query and then return an XML.
How can I transform the Flex app. in an AIR app. Do I have to use the SQLConnect and that stuff? Cant I use my php's files that work well?
Thanks.
My regards.
Alan
You can write AIR applications that connect to your PHP, I use coldfusion and java so not exactly sure what differences there will be but should be none on the server side.
The AIR application will require access, or compiled with, the services-config.xml and the three files it includes. For my AIR apps it seemed like the "includes" in the servies-config.xml file did not work and I had to copy the contents of those three files into the main file.
On the compile line you will require something like:
-services "C:\Blazeds\tomcat\webapps\chat\WEB-INF\flex\services-config.xml"
(sorry, I develop on a windows machine), but you will require the full path to your actual services-config.xml file. That line is in my Additional Compiler Arguments with my locale option.
This also requires you to create the project with a server side option.
You might want to also look at moving the code into a separate project, and then have both your AIR and web app use that third project with the code. Then one change in the code can affect both version, of course that means everything would have to be recompiled.
PS. I found the Adobe AIR Programming Unleashed to be a good book for this information.

Categories