JODConverter 3 converter webservice - php

Has anyone built one of these on a stock Windows Server 2008 r2 ? I only ask because JODConverter 3 doesn't seem to have the web services that v2 had, and the references ot getting them running talk about .jar files which don't seem to exist. If it can't be done using TomCat or something similar, it might be possible to construct a .php wrapper that calls the command line - but that option seems to defeat the purpose. Any ideas gratefully welcomed.

If you grab the read only from svn there is an example web application that you can compile with maven.
Executing the .jar from php using exec was unreliable at best when I tried it, it's not how it was intended to be used.
Here is an example php class someone made for use with a the web service method.
After fiddling around I've decided that a java application was the best route for us, but that is mainly due to restrictions of my project (not being allowed to run a TomCat server for example).

Related

What's the most painless way to have a python-only server up and running on amazon EC2?

I've recently launched a linux EC2 instance with Apache + php. My php code eventually watered down to merely calling python from the shell, and nothing more. It's quite an ugly solution, but it works. So, basically my questions are:
Just how bad/inefficient/silly is it to have a php code that
repeatedly calls exec(python my_script.py) rather than a solution
that's more native to python? I'm assuming it's wasteful, but I'm trying to understand if I ought fret about it or just keep on chugging.
I managed to get bottle.py up and running, and was just on the brink of replacing my "stupid" solution with a continuously running bottle script, that seems more natural. But I failed to integrate this solution with Apache via mod_wsgi, I think it has to do with python versions incompatibility issue that I'm loath to deal with.
Considering (2), what are the repercussions of bypassing Apache entirely and simply calling a bottle script with a "run" command to listen to all incoming communication? It seems ugly, but is it inefficient or bad in any way? If not, I'll just go ahead and call that my solution... But I'm concerned that there might be a reason for people to integrate with Apache.
Any input would be appreciated. A decent amazon AMI that already runs python 2.7 and processes incoming request by python by default would be nice. Someone saying authoritatively that I shouldn't mess about with this whole apache/mod_wsgi business and just call "bottle" as a script would be best :-)
EDIT: I have python 2.7 running bottle with paste as my webserver. Do I have any REAL reason to prefer apache over this solution? and while I'm at it, does anyone have experience with enabling ssl in this enviornment?
Cheers,
Uri
Why don't you just spin up a Beanstalk instance with Python and let Amazon deal with those details? Beanstalk runs on EC2. Seams silly to make your own spaghetti when Amazon has already made you penne vodka! Lame metaphors aside, I think you'll save yourself the added stress and no need to mix PHP/Python.
If you need to update python version on beanstalk I would recommend two options:
Create custom ami based on standard ami of beanstalk. Good article here: http://blog.jetztgrad.net/2011/02/how-to-customize-an-amazon-elastic-beanstalk-instance/
Customize instance with help of elastic beanstalk configuration files. Have a look here: http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers.html.
Disclaimer: I work for OpDemand.
Most painless would be to use a pre-rolled AMI, but those become impossible to manage.
If you're looking for something more flexible, OpDemand offers EC2 templates for Python applications that you can deploy with one click. They're vanilla Ubuntu 12.04 LTS boxes with Nginx in front of Procfile-defined web workers. It's a lot like Heroku, but it's all run out of your own EC2 account. The example Python application uses Flask, but it's trivial to switch to Bottle.
Best of luck!

Integrate a php module in a Java web application

I am having one enterprise application developed using j2ee technology. I also have some php application. I want to merge the php application in my enterprise application to enhance the functionality without rewriting the code in j2ee. Could anyone please suggest me how to do this. I did some research on this and found following options
PHP & Java bridge - In this I will run tomcat behind apache server. The php module will be in apache and j2ee app in tomcat. This seems to be the opposite of how I would want my app to run. As the user registers in j2ee app and will also use the module build in php. So I would want my tomcat server to be oin front.
Install php on tomcat and run the php module in tomcat server. I tried many times to configure this with PHP5+ and tomcat6+ but not able to do that. I also could not find proper php & tomcat version combination which works together.
Please help me to find the best option (open for any new options as well) keeping application performance in mind.
running the PHP part on Apache httpd and the java part on Tomcat "behind" it is not that wrong. The fact that Tomcat is behind apache server is only a matter of connection flow, but from a user POV /forum/page.php will be handled by PHP, while /supercomputation/dothat will be handled by java.
The only problem is how you put the two together on the same page, if you need to, cause in this case only server side includes, iframes or javascript pop on my mind.
Another approach is to install PHP on a separate server, even another httpd on a different port, eventually listening only on 127.0.0.1, and then use a java server side component to "fetch" PHP output and merge it in the page generated by tomcat.
It might sound a hack, but it's not that hard at all, is already supported by many frameworks, and I've seen enormous web sites in production with a java based "frontend" that aggregated contents coming from other PHP and Python subsystems.
Whatever solution you decide to adopt, you'll need to setup some coordination between the two systems ... for example, single authentication for users. How to do that heavily depends on how those applications are designed, and will probably need some tuning here and there.

Running PHP scripts without having to install software?

Is there anything I can use to have PHP execute in a self contained environment without having to install server software?
haven't learned other languages :-(
I wanted to write a simple php/XML webapp that can be used on a desktop machine with no admin rights. It's for daily data entry stuff myself and others have to do when certain tasks are completed. Its a work machine and security is super high so can't have the details traversing the internet to my hosting.
Any suggestions?
XAMPP Portable might be what you are looking for. You don't need admin rights to run it.
http://portableapps.com/apps/development/xampp
Regardless of what language you use, in order to have a webapp, you need a web server of some sort, to listen to requests and send a response back (even if it's just listening to localhost). It is possible to run php from a command line without a server, but I don't know if you want to convert your application to a command line one.
Assuming you're using Windows, there are solutions for compiling PHP into an exe file (a quick google search found Phc-win, for example). However, I've never actually done this myself so this be sure to fully investigate what this would entail! You'd most definitely need to rewrite your views to use some way of creating actual dialogs in Windows (ie. WinBinder, or wbObjects).
(Of course, if you wanted to convert it to a desktop app the best solution is to actually use a language meant for desktop development, but if you only know PHP and don't want to spend the time learning something else, this could suffice, I guess.)

Lightweight PHP server to bundle with application?

Does there exist some sort of PHP server that can be bundled with a locally-deployed application? It sounds wonky, but the end result is I can't use a remote web server to do anything. Clients will be downloading a package, and the plan is to use a Java backend that reads from a flat file. The flat file contains settings and is modified through a GUI written in HTML/JS, and this is where the server would come in. The forms in HTML should be able to submit to the server, which does a simple file write to the flat file.
Is there any simple, lightweight server that has that simple feature? When running the executable for the application, it would start the installation process for the server before moving the web GUI files to the appropriate locations.
Note that I'm doing this for a client, so I can't quite change the reqs and would rather not discuss their effectiveness. I would be ever thankful if people had suggestions for the server though!
You should check out roadsend php.
It can compile php scripts into a binary with its own build in server.
https://github.com/weyrick/roadsend-php
Nanoweb might do the trick for you, it's an HTTP server written in PHP. So long as the client has a PHP install you should be able to package things up nicely. In fact with a little extra effort you should be able to package up the PHP binary along with your code.
Nanoweb: http://nanoweb.si.kz/
Since PHP 5.4, PHP have a built-in web server and this works on any system where PHP binaries exists.
$ cd ~/public_html
$ php -S localhost:8000
I can't think of any lighter server...
http://php.net/manual/en/features.commandline.webserver.php
If you have a java backend, what do you need php for?
You could simply bundle a small java based webserver.
http://java-source.net/open-source/web-servers
A while ago I created a small web interface for Transmission (mac/linux bittorrent client) that needed to run a local web server with a custom PHP setup. I used lighttpd + php w/ fastcgi. When zipped up, I believe, it weighted in at <3MBs. If you don't need to run any PHP lighttpd is only a few MB's (and light on resources) and offers a very flexible configuration.
Source: http://svn.recurser.com/transmission/trunk/cocoa/
If you're already using Java, you may want to look at Quercus, an implementation of PHP and many common extensions in Java. It's a bit restrictive, but it may fit your needs.
Like unomi, I don't really understand the situation, but I'll assume you do...
Apache is by far the most popular and best-tested platform on which to run PHP, but in theory it should run on any web server that supports CGI/FastCGI. Alternatives include Lighttpd, nginx, and a few dozen others.
Whatever you choose, the key is to pre-configure it and keep it self-contained in its own folder. I think Apache would easily work here. Set it to port 43948 or something; remove all unnecessary modules; pare down the httpd.conf to its most basic requirements; allow only local connections; and write clickable scripts (.bat or .sh or what have you) to start and stop it.
This project is an interesting option...
An embeddable web server designed for (and written in) PHP. it handles
the control of the assigned port, setting common environmental
variables (such as $_SERVER, $_GET, $_POST and $_COOKIE) and calling a
function or method in your application to delegate the request.
The web server is able to be packaged in, and controlled from, your
application. Therefore eliminating the requirement that your user have
a standard web server installed and configured to use your web
application. Combined with a database such as a flat-file database, a
Berkley DB or SQLite, PHP Embeddable Web server can remove the need
for the user to have any specialised libraries installed, except PHP
(which is preinstalled in many Unix and Linux distros).
I have used this. It does work.. It is cool. As easy as...
# php server.php
You kind of have to get your hands dirty.. but it's TINY, a single file, and HIGHLY configurable... Word of warning though.. don't bother with this unless you know what a header, a class, a method, and an object, etc... And be prepared to apply that knowledge.

Run Apache / PHP / MySQL (CakePHP) application on a USB stick?

I have an existing CakePHP that runs on a LAMP environment and need to install it on a USB drive for mass public distribution.
There are a few requirements:
Protect the source code
No installation required
Windows support essential
MAC & Linux would be a bonus
Must run offline, without Internet connection
Ability to sync with server for data transfer and updates
I have conducted a large amount of research into the options and am keen to learn what other developers think.
Potential solutions:
- Flash / XML
- Adobe AIR app
- USB webserver (Server2Go, Portable Apps XAMPP)
Has anyone used any of the above, any comments would be greatly appreciated.
Thanks
Similar thread here :
Portable USB Webserver
If you ask me, XAMPP should do, because it offers a "plain unzip" version. There's lots of variety out there - Bitnami also offers a nice bunch of stacks, although they may not be good for this particular task.
To keep the same scripts in both Windows and Linux, you could consider using UnxUtils which is a port of all common Linux commands. This will be very handy if you are good at Linux bash shell scripting but not good at Windows batch files.
Protecting the source code is a bit troublesome. Do you really, really need to do so? Because there's a ton of great open source code out there which already does practically everything in most common business domains - sourceforge.net.
And if someone's taking your code and calling it their own, you can just name them on the internet if you can prove it. That itself will be bad publicity for them. That said, I obviously don't know your specific need. So that is just my opinion.
You will have problems with this, no matter how you go about it. Each step is a little more unusual it seems.
You'll need to use a source code obfuscator to protect your source. I recommend the one by Zend, not from experience, but because Zend makes awesome products. Never used a source protector myself.
You'll need three custom LAMP/MAMP/XAMP installs, one for each target OS. They should point to a directory that is shared on the USB drive. Make sure you configure them to use an unprotected port, otherwise the user will need admin privileges to run the server software. And getting the server stuff up and running will likely result in a few hiccups as well.
I would actually recommend finding something that will allow you to distribute a binary, or something like an AIR app that is intended for this type of distribution. You may have to rewrite lots of code, but it'll be easier to fix than all the niggling little install errors you'll see on the client end. To package scripts into binaries without rewriting stuff, check out http://www.scriptol.com/apollo.php and similar products.
But I'd suggest you make a standalone app in adobe air that will sync with your server (maybe even some google gears integration, to have it function offline). Don't try to force a PHP app into this distribution model, it'll create nightmarish problems.
This is what I used to run a CakePHP app from a DVD. Worked on USB too (while I was still developing it).
http://www.server2go-web.de/
Server2Go is a Webserver that runs out of the box without any installation and on write protected media. This means that web applications based on Server2Go can be used directly from cdrom, a usb stick or from any folder on a hard disk without the hassle of configuring Apache, PHP or MySQL.
Server2Go allows you to create a standalone working web site or PHP application on a CD-ROM.
It's really nice.
You can use MAMP for Mac, you'll just need to edit the config to properly point the sites directory.
however you would have the problem that the mysql db would not necessarily work with windows. if you switched the db to sqlite, you could sync the sqlite db file fairly easily.
XAMPP would work for the windows side
sorry dont know about the linux side.
Out there is a CakePHP InstaWeb Server
http://bakery.cakephp.org/articles/view/the-cakephp-instaweb-webserver
that runs on python and doesn't need an installation. This plus some additional goodies should get you already half the way.

Categories