Google search results suggested that it's possible via PHP/Java Bridge . This bridge requires Java Application Server. My host (bluehost) does not allow to run any Java Application Server. What are the alternatives in this case to make iText work? Switching a host is not viable option for me.
Thanks.
I know this is an old post, but for those still looking for an answer, may I suggest having Java do your work for you as a REST service using Jersey (JAX-RS), then just call the service from PHP. You can put your Java service on a host that does allow Java and you can call that service from PHP using cURL (or even file_get_contents if your host allows it and if you know what you're doing).
Loose coupling over RESTful services is allows you to have your Java service and your PHP app on separate hosts. Don't waste you time with a PHP/Java Bridge. It's perfectly sane to call a RESTful service with a Java back-end from PHP. This way, later if you decide, your would rather re-do the service in C# or something else, at least there will be 0 impact on the PHP app because you used a language neutral RESTful approach.
I have not had any performance issues using this approach myself, YMMV
(It's mostly a matter of design: It's usually better to "bolt" things together then "weld" them together.)
Also, Java with JAX-RS is very very simple (IMHO, but again .. YMMV)
There's always iTextSharp, a C# translation of iText. Will your host let you run C#?
It looks like you can call C# from PHP, as detailed here.
The ITEXT website specifically says JAVA and .NET, Wish they can also build the PHP or PERL version
I have used the Java Itext, Its superb!!
PDFtk is a command line tool installed on many Linux systems. It is a front end to the iText library. It may do what you need. You'd have to shell out to the command line to invoke it from PHP.
Related
Me and a friend are working on a C# windows application. He's in charge of designing the application, while I am in charge of the API.
I have created a DLL which will be used by the application for a majority of MySQL queries. I am also making a website to go along with the application and would like to make a smaller version of the app on the server (which is Linux, I should add) and have it run on the webpage.
So I am wondering if there is a way to call the methods from my DLL in a PHP page, or if I am better off just querying the database with PHP script or something of that nature.
You cannot use a Windows DLL on a Linux server. Maybe there's some way to hack stuff in with Wine... I'm not sure, but it's undoubtedly more hassle than it is worth.
You can use COM DLLs and .NET assemblies from within PHP. See the documentation: http://php.net/manual/en/book.com.php
If all you are doing is making MySQL queries, you are most certainly better off using PDO or MySQLi. This will simplify things greatly.
I would recommend having the DLL (I'd assume its a managed assembly) expose out REST or SOAP web services and consume those services via PHP.
I have developed a PHP web application, but a client insists on a real Windows application, since he doesn't like running the software inside a browser.
Are there any solutions for this, any compilers to turn a web project into a Windows exe ?
I have looked at Phc-Win , but that seems more suited for small command line utils, not for entire web-applications...
UPDATE:
just found this myself, both look quite promising...
http://www.zzee.com/phpexe/
http://www.exeoutput.com/index.php
There's no tool for this, short of a simple wrapper app that embeds a browser inside an otherwise normal application window. Your PHP app would have to be completely re-written to include ALL of the overhead code necessary to build a GUI - basically all the 'display' stuff that a browser does automatically, would have to added to your app.
Well some of you did not google good enough:
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
Supports most of the "web-languages" to write native Applications.
Tutorial Reference for Appcelerator: http://appceleratortitanium.com/tutorials/3-appcelerator-titanium-tutorial-beginners.html
Quote:
"Q: What languages can I use to make desktop apps?
A: Javascript, PHP, Python, Ruby, HTML, HTML5, and CSS."
Not exactly what you are looking for: http://www.roadsend.co/home/index.php?pageID=compiler
You may look into "HipHop" (made by Facebook): Converts PHP to compileable C++-
There's a tool for this. :-) I never used it but you can try this: Winbinder.
It is simple to compile your PHP source code into an executable. Facebook released a compiler for PHP in early-2010, called HipHop, which aims to create C++. You could then compile this code, for example using gcc, to machine-code.
The more difficult point for a complex Web-App like yours is the user interface. When compiling the way I described above, the application can be run from command line - this might work for simple tasks, but not, if your application returns HTML.
One possibility to solve this problem is PHP-GTK. PHP-GTK is a API for GTK (the graphical user interface used by Linux Ubuntu by default), written in PHP. Using this solution would have to read some documentation about this API, and you would need to rewrite some parts of your program, but it would probably be the most beautiful solution, because it would create a "native" experience.
Another possible solution could involve Adobe AIR, which lets your create programs for the desktop, using HTML, CSS and JavaScript, but I don't know if and how this would work together with your compiled PHP.
Please also note that it isn't absolutely necessary to compile your PHP for it to run on the client's computer; You could also ship the PHP-interperter right with your (uncompiled) PHP-script. Of course, compiling brings benefits, such as faster execution of the program.
-- André
I was search for a video platform which I can use as a web-service and install locally on my local server to my PHP website.
I know we can run PHP shell commands but I need to implement a solid system with the Transcoder.
So, it should provide a API using REST or SOAP to convert videos, convert videos in efficient way. Create video thumbnails. If it a ruby or Python then it would be great and should be a free and open source one.
I could see those Software on Github, seems its good but having limitations. https://github.com/streamio/streamio-ffmpeg.
Is this a bad idea to use Perl or Python written application using with PHP? what are the available FOS software
Is this a bad idea to use Perl or Python written application using with PHP?
A bad idea? No. But it can be annoying sometimes.
If you really want to use a web service for this instead of just calling exec/proc_open like the rest of the world, you can go ahead and do that without too much concern.
Another option available to you is Gearman a distributed work queue/RPC service with bindings for many languages, including PHP, Python and Ruby. You can easily write a daemon in Ruby that uses that ffmpeg wrapper, and call methods directly from your PHP code. Thanks to how Gearman works, you can easily scale out the video encoding services by just adding more workers.
You can use FFMPEG binary for conversion/thumb extraction with command line like exec() in PHP
Currently we're using PHP for our websites. Now we're thinking about writing the backend in Java, because of the type safety of the language, and the availability of all kind of tools for Java.
I've been reading about Java Bridge and now I'm wondering how to set this up.
We're using PHP already through Apache. I read that to use Java Bridge I need to install Tomcat as well. That means I have two servers (Apache and Tomcat), and I need to add security to the backend, because it is open to the whole wide world suddenly... Am I missing something? Is there another way to make the PHP-Java connection without an additional server? How is this usually done?
Any directions or links on how to to do this or any best practices on how to set it up are greatly appreciated. I didn't find the official Java Bridge site very clear.
Thanks!
I am currently testing the use of the Zend Java bridge. Two weeks ago, I did test the PHP/Java bridge open source solution. This one does require that you put your java classes into a war deployed in a web server (I did use Tomcat 6). The Zend solution does not require a web server. If you put your business logic in plain java classes, you simply wrap your classes in one (or several) jars. You then start the Zend java bridge daemon into a JVM, passing to the -classpath the Zend Java bridge jar aswell as your own jar's
Ex from a dos windows:
C:\Development\ToolsPHP\ZendServer\bin>java -classpath javamw.jar;mybusinesslogic.jar -Dzend.javamw.port=10002 com.zend.javamw.JavaServer.
Here, I had to specify a port since the 10001 port, which is the default for the bridge, was already in use (use netstat -a to detect port conflicts). Note that the Zend solution only works if your php script is executed on the Apache server managed by the Zend server (community or commercial edition) and that the Zend Java bridge service is running, with its port set to 10002 with the Zend server admin console.
To implement my business logic, I plan using simple Java pojo's, Spring, JPA and Hibernate.
You don't need tomcat. As per instructions you can start Java as
java -Djava.ext.dirs=lib -jar JavaBridge.jar HTTP_LOCAL:8080 2 logfile &
lib contains the Java libraries you want to use.
Peter
Ok, I am not expert on this. Basically, not even one-eyed. But afaik your options are pretty much the following
For the JavaBridge you have to have a TomCat server.
There is also a JavaBridge in Zend Server CE.
And there is Quercus
Well, and the old PHP4 extension
You can look at Gearman. its not exactly, what you are looking for, but it allows Clients and Workers in different languages. As a nice side effect it allows parallel processing with background jobs ;)
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.