Configure OpenGeo's Jetty to run php scripts - php

I am using OpenGeo package on windows to develop a web mapping application with sdk suite. I would like to create a submit form dialog box with a php script, which saves the data to the database. However, the problem is that it doesn't read 'submit.php' by Jetty server. When I check in firefox, the response shows the whole script only as belown. First, I tested with echo to return true. The created application was debugging on localhost at port 9080 while actual one is localhost:8060 which hosts Opengeo.
I have tried with Php/Java bridge also, however, it is still the same. It works on local host at port 8060/JavaBridge/ and shows the examples. I would really appreciate if you could suggest a way to configure Jetty with php in Opengeo package.
Cheers,
Zar Chi

We finally solved the problem by working with Ubuntu 12.04LTS and we wanted to share the solution in case is useful for someone else.
1- We installed opengeo following this process: link://suite.opengeo.org/docs/latest/installation/ubuntu/install.html
2-Then we found this blog: http://www.thomasknierim.com/140/java/
3- And we installed the apache using the fcgi option applying the configuration suggested in these files:
a) link: 2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html. It was also similar in these other blogs so I went ahead.
b) link: howtoforge.com/using-php5-fpm-with-apache2-on-ubuntu-12.04-lts
c) link: versatilewebsolutions.com/blog/2012/11/installing-apache-2-with-php-fastcgi-on-ubuntu-12-10.html
4- We followed the instructions here (link: /php-java-bridge.sourceforge.net/pjb/download.php):
Use a graphical packet installer to install PHP. Or download JavaBridge.war, which contains an embedded PHP binary. (I suggest you try again with PHP standalone directly, NOT with JavaBridge.war file)
Download and install Java 6 or above. (/usr/lib/jvm/java-6-openjdk)
Download and install the original tomcat servlet engine. (/var/lib/tomcat6)
There must be JavaBridge.jar, php-servlet.jar and php-script.jar files in your /usr/share/tomcat6/lib
Double-check again /var/lib/tomcat6/conf/web.xml
Retart Tomcat server and check it is working now?
5- If not, the problem could be related with the permissions of the jar.libraries. There should be accessed by tomcat6:tomcat6. Every deployment called these libraries to automatically create a Java folder which contains Java.inc and JavaProxy.php.

Related

Php java bridge Error : the procedure entry point php set error handling could not be located in dynamic link library C:\xampp\php\ext\php_java.dll

Integrating PHP java bridge, facing some issue while restarting Apache server as showing error:
The procedure entry point php set error handling could not be located in dynamic link library C:\xampp\php\ext\php_java.dll
I made the changes outlined below in my php.ini file and copied JavaBridge.jar and php_java.dll in C:\xampp\php\ext.
extension=php_java.dll
[java]
java.java_home = "C:\Program Files\Java\jdk1.8.0_131\bin"
java.java = "C:\Program Files\Java\jdk1.8.0_131\bin\javaw.exe"
java.class.path = "C:\xampp\php\ext\JavaBridge.jar"
java.library.path = "C:\xampp\php\ext"
java.log_level =2
Specific to your question:
First of all, the javabridge communication is not handled anymore by a php extension (I mean the php_java.dll or java.so).
So you simply don't need it, you can completly remove the "extension=php_java.dll" as this has been replaced by a pure php implementation known as the Java.inc client (or alternatively the soluble-japha client).
I believe you use a very old documentation... So don't spend too much time in this direction because you'll probably won't have support.
But if you want to work with the javabridge, just remember you'll have to install both:
a Java server that will expose the Java virtual machine on a network port (standalone or deployed on Tomcat)
a PHP client library on the PHP side that will establish communication with the server (Java.inc or soluble-japha)
I suggest you to read the docs on the official php-java-bridge website to get some insights about installation (or alternatively some docs for the unofficial soluble-japha project, they work pretty much the same way).
And first ensure, the php-java-bridge server is sucessfully running. The php-java-bridge files can be downloaded either:
Option 1: The war file (tomcat only) is here
Option 2: Individual files for cli/standalone server are here
Once it works, try to connect from PHP.
You'll probably face a lot of problems at first run, but from there it will be easier to answer your questions.
Good luck

Configuring php desktop chrome for allowing it to connect to sql server

I wanted to convert my php application into desktop application to run it as an .exe file by just double clicking on it. For this I found many third party softwares like bamcompile,wapache,Php desktop chrome,etc. From these the most compatible and the one which fulfilled my requirements to accountable extent was php desktop chrome.The rest both had their drawbacks-
1.Bamcompile-It runs the application on commandline and does not show GUI,so I was not comfortable with that.
2.Wapache-It runs the application but it run it in Internet explorer browser so it cannot run the framework supported by my application.I need Google Chrome for that.
3.Php desktop chrome- This fulfills my requirement to a great extent but the problem is that it does not supports sql server database.I thought about using sql server as database because I don't want to install xampp/wamp on every machine where I want to use my application.I added the drivers needed for using sql server to php desktop/ext folder but I am not finding the php.ini in php desktop application where I can add extension to it.So it there any way that I would not have to install xampp/wamp or any other application on client machine to run my application.
Problem with converting the application into exe file is solved with php desktop. That means when I start only mysql from xampp my application runs perfectly fine ,there is no need to start apache for that.So now I want to do something that can include my database as well in the php desktop chrome folder and supporting application into it as well.So that I don't need to start phpmyadmin always.Or is it possible to install only phpmyadmin/MySQL without xampp and if yes how to configure that?Because I installed that individually but I don't know why is it showing Access denied.
Thanks in advance.
I have tried to provide as much details as possible ,in case you need to know anything else,please let me know. I have tried all possible way please help me out.
Your need is quite exotic. Try phpinfo() in your application - then you will find where your php.ini is served from. That might put you on track. Another thing to try, if your database is not too big, SqlLite database in your project, because it is bundled with php and does not require a separate server.

which server to install for phpEclipse and how to do it?

I know this is a newbie question, but i want to study php. i have phpeclipse and its running well, the problem is when i run a simple html file with the default server the page says cant display this page and thats it. i dont know if i need to install a new server or is there something wrong with the server configurations. ive tried installing tomcat on my computer but i cant see it under windows->preferences->server->runtime enviroments->add. iv also tried under the same page to fetch geronimo v2.2 and 3.0 and the dependencies were wernt satisfied. iv also tried the repository for zend debugger. what do i need to do in order to compile and see php and html pages with php eclipse?
You don't need to compile PHP.
Depending on your operating system and PHP version there are a few options.
As of PHP 5.4+ you can run your application using PHP's built in server, on the command line, if you cd into your website root directory (i.e. where the index file is) and then run the following
php -S localhost:8989
Then if you navigate to http://localhost:8989 in your browser you should see your application.
If you are unable to run the inbuilt web server, you need to look at Apache2. Most PHP websites run inside the Apache 2 web server. You will generally need a *AMP (WAMP/LAMP) environment.
L/W (Linux / Windows)
A pache (Web server)
M ySQL (Database)
P HP
Hope this is enough of a pointer ;)

How to set up/view PHP server pages in Eclipse with the PDT plugin (for php)

I am trying to set up a PHP server on my localhost to run with the Eclipse PDT.
I want to be able to view the PHP site I am developing on something like http://localhost/MySite/index.php so that I can Run it straight from Eclipse.
I am using IIS 7.5 (windows 7 home premium) for the PHP server.
So far I have followed these instructions, but have not been able to get it to work:
Install CGI option in Windows Features
Install IIS Manager in Windows Features (so I can run inetmgr.exe)
Download the NTS-version of php and extract the zip to C:/php
Rename php.ini-development to php.ini and set the extension_dir variable
Run inetmgr and create a new website to run PHP applications (I removed the DefaultSite):
Site Name: My Site
Physical Directory C:/dev/MySite
Application Pool: DefaultAppPool
Bindings:
Host:
IP Address: All Unasigned
Port: 80
In inetmgr: Click on handler mappings and add a new Module Mapping:
Request Path: *.php
Module: FastCGIModule
Executable: C:/php/php-cgi.exe
Now I have many problems:
In IIS Manager, when I click Edit Site > Test Settings, there is a yellow exclamation-mark warning: Authorization: Cannot verify access to path (C:/dev/MySite):
The server is configured to use pass-through authentication with a built-in account to access the specified physical path. However, IIS Manager cannot verify whether the built-in account has access. Make sure that the application pool identity has Read access to the physical path. If this server is joined to a domain, and the application pool identity is NetworkService or LocalSystem, verify that \$ has Read access to the physical path. Then test these settings again.
When I try to load any .php file directly from the webroot (C:/dev/MySite) it displays as plain-text in my web browser
When I try to Run my project in Eclipse, it goes to http://localhost/MySite/index.php and there is a 404 Error: Website Not Found
When I go to http://localhost/ in my web browser, I also get a 404 Error.
If you download PHP 5.4.x you will be able to use the built-in web server for all of your development needs.
In your php folder, you would run:
php -S localhost:3030
Now you will be able to browse to http://localhost:3030/index.php
If you were using the Aptana IDE (or anything comparable), you would set this up like so:
Your run configuration would be:
I don't personally use Aptana (I did a few years ago); however, I thought it would be interesting to try this to find out if the integration would be seamless or not. I have to say, I am pretty impressed at how Aptana gets out of your way so you can do just about whatever you want.
Finally, if you are wondering about the "$HOME/local/php/versions" listed in my "Start command", I drive multiple PHP versions with a tool called php-version. Please be aware that this tool targets Linux/Mac users; however, if more people are interested, I may do a windows/powershell port (NOTE: I am the author).
I'm afraid I don't have an answer to you're question, but I wanted to share...
I never was a fan of running PHP on IIS or Apache. So I built a portable, no-install-required copy of nginx that I could move around with me or use on my Windows machines. (Just download the flavors of PHP, Nginx, and MySQL you want and start it). One of the reasons is that most production sites run nginx anyway, so this way I'm closer to what my server actually uses (unless you are on "shared-hosting" which still uses the Apache).
Second, I'm not sure why you need to "run" it from Eclipse. When you write PHP you usually are dealing with a lot of variables to get pages setup. I would say you need to worry more about adding Unit Tests to make sure things work right, and using a browser like Firefox (with firebug) for testing any requests you might be making. Things like AJAX, or dealing with session cookies often require more control than what Eclipse can give you.
Bottom line, I'm not sure why you think you need to do this.

How to bundle a php application with 1 click run/install

I create php application for small businesses. Some of the clients may prefer running the app on a local server, therefore my requirement is to create/bundle an app with apache/mysql/php with all the necessary confirguration and one click executable (be it a batch file) such that when the user opens it, it runs the apache server on some port say localhost:1234 and mysql as well.
and opens up the application in the default web browser.
To be more exact, Im looking for something like http://www.simpleinvoices.org/go, check their Simple Invoices for Windows which come budled with apache/php/mysql.
P.S - Im not sure if this question should be at SO or Superuser.
If you actually want to install a web server and a SQL server then Lars' solution would be a way to go. On windows you can generate a .msi installer containing the dependencies you need (like WAMP). An installer executable would be a cleaner solution than a batch file in my opinion, as it will also provide the user with an option to uninstall your software if they wish.
If you want to distribute your application in a standalone version, then you might also want to check a solution like NuSphere's PHPDock - http://www.nusphere.com/products/phpdock.htm
I had the same challenge and came across Uniform Server:
http://www.uniformserver.com/
You download it, add your application to it, start it and everything runs. Lovely.
Superuser would have been better. But depending on your requirements, you should just create a package to install. On windows, package it with WAMP, on linux, package it with either one-click-install or creating packages for the two biggest systems, namely APT and RPM. With the dependency-system on all of them you can make sure, that your application runs right off the bat.
PHP Desktop is the best option I found when researching this.
https://github.com/cztomczak/phpdesktop
PHP Nightrain is also an option:
https://download.cnet.com/PHP-Nightrain/3000-10248_4-76169308.html
Bitnami WAMP stack looks good as well:
https://docs.bitnami.com/installer/infrastructure/wamp/

Categories