Convert php code to native android application? - php

I am familiar with phonegap framework which convert html & jquery code to native app. But it does not support php. So i am looking for alternative.

with Zend Studio 10 you can make your app using PHP
Cloud Connected Mobile app is new entry for PHP Developers to make native apps(android, blackberry, windows phone) with just SINGLE click.
Zend CCM link

PHP is a server side language while jQuery and html being client side. What I mean is this that the PHP script is being interpreted on the server using the PHP plugin and compiler and so if it has to run on phone it need to be compiled in the phone with the required plugins.
Seems impossible to now because of that the PHP compiler is not available for android and for making such you should be able to port it to android.
Which I think takes a lot of time and digging the PHP compiler sources.

In my personal view, do not use a language designed specifically for web server-side purposes on a web client. Everything you can do with PHP locally on a phone you can also do with Javascript, and usually much easier because of its tight integration with the browser.
That said, there is a PHP for Android project which might provide what you want.

Related

Php and Java back end

I like php, and I'm beginning to like java. I heard that jsp is officially deprecated (on the oracle website) and I'm trying to figure out how I could get data from a php script (from field data, image uploads) send it to my java program and have the results sent back to my php script.
Now I know I could use php for everything but some websites (such as google) use multiple back ends such as C and python.
There are several possibilities to interface PHP and Java. To name a few you coud try:
Make a Webservice in Java and call this Webservice in PHP.
Use another RPC protocol, like Thrift.
There is also the PHP/Java bridge.
Quercus is a PHP implementation in Java. When using this, you can just write functions in Java and call them from PHP.
PHP has experimental support for integrating Java.

Is there any way to write php code and make it usable with same web-app which is in j2ee

I am using Eclipse to develop a website in html, css, js, ajax for client and jsp, servlets in the server side, using mysql. I want to write some modules in php. Is it possible to integrate php code in the architecture and run on tomcat ?
You could use Quercus or maybe create a bridge (effectively messaging) between a server running your PHP code and the Java application. I'd consider carefully if this is the best way to architect your application, or whether the php modules should be rewritten for Java.
Yes, look at PHP/Java Bridge http://php-java-bridge.sourceforge.net/pjb/
There is also a PHP runtime written in Java, but I don't remember the name at the moment.

php library iPhone

I'm wondering if anyone knows of a PHP library that I could compile into my app for the iPhone? Basically I'm wanting to allow the phone to display pages stored locally that have PHP in them and display them in a UIWebView.
Apple are extremely strict about not allowing 3rd-party code execution engines in apps, which would prohibit running a PHP interpreter.
If PHP is a true requirement, you'll have to host it on an external server and access the pages remotely.
Consider Javascript as an alternative language if you need to stay local, it's really the only way to execute run-time-generated code on the iPhone.
In order for that to work you would need:
A PHP compatible webserver running on your iPhone
Some sort of a PHP interpreter (not that there are so many different types of them out there) running on it too
I don't think this is/will be possible when thinking of Apple's strictness regarding 3rd party software and the low chances of someone even planning a port of PHP for the iPhone.
You mean like this PHP library? http://php.net/downloads.php
Running your debugged PHP code in an iOS app makes a lot of sense to me. Getting a PHP library in an iOS app and approved by Apple isn't easy, but it's been done. See: Running PHP on iOS? for details.

Should I use PHP or PHP + Java EE?

I'm going to start a new project with instant message support.
I find that there is no good long polling solution in PHP, but there is some good ones in Java EE.
I'm wondering if I can integrate PHP and Java EE to get the function? Or should I just use Java EE instead of PHP?
Keeping the number of development platforms to a minimum is always a good idea. It will keep deployment requirements low, gives less operational complexity and gives the best possible integration.
If you want to replace PHP by Java, you have lots of frameworks you can use to replace PHP. A good option would be the Stripes framework it’s an easy to use MVC framework that does not need much configuration.
An other very workable solution would be using Java in the backend for filling the database. And use PHP in the frond-end and use the database to retrieve data. This way the integration is limited to a shared database.
If you would like to have a direct integration between PHP and Java, things start to get more complex. It could be implemented by either web services or the faster php-java-bridge. But I don’t think you need this and if you do, I would seriously consider migrating the whole project to Java.
For an implementation example of the php-java-bridge see: How to share session between Java and PHP
You CAN build your application with PHP together with Java EE. The PHP is to generate HTML, and Java EE supports Comet.
Actually, Facebook generates HTML with Apache server. I bet Facebook web pages are written in PHP. And the Comet server of chatting is written in ErLang hosted in Mochiweb. Two languages & servers works fine together.
The decision is up to your own preference.

PHP for iPhone Native

Can I compile PHP to a native iPhone app?
No. You can, though, make web apps that look an awful lot like they're iPhone apps.
Take a look at Titanium Mobile.
I've used their desktop developer, which can use PHP but not the mobile version
Perhaps a bit of elaboration. You cannot "compile" PHP. It is a scripting language. Yes you can compress, obfuscate, and even turn it into an Apache Module etc. but it is an interpreted language so at some point will need the/a php interpreter and a web server. So to get it to run on any hardware platform mean having the php engine and/or an Apache server to be there.
So to make any self contained app you need to have a programming language that will compile and produce an executable file that is supported on the target hardware or is self supporting. But essentially produces a bundle containing all the resources required to run that app whether it is an iPhone, Palm Pre, Mac or PC. For the iPhone Objective-c is used to program, connect to the libraries and frameworks and produce the required bundle to install on the iPhone. You can use Mono via Monotouch to do the development work but it then compiles to the required bundle for installation.
If you want to use PHP then build a web based app that will be accessible via Mobile Safari on the iPhone. To make the app render well you will need quite a bit of HTML, JavaScript and CSS but as has been mentioned there are frameworks to ease this pain such as iUi, iWebkit, jQTouch etc.

Categories