How to add a handler to embedded-jetty server in eclipse - php

I am developing with GWT in eclipse, its run ok and launch jetty server like spected, but when i try to communicate my gwt page with php i find jetty server handles php files like text files, just send file contents and does not executes php script.
I need jetty server for GWT code, and run apache/php for php code (in different ports), but jetty must redirect php calls to apache.
Searching in google i find a possible solution: a jetty handler could redirects php request to apache server running php.
Someone knows a better solution?
Someone knows how to add a handler to jetty server running embedded in eclipse?
is there a existing jetty handler what redirects calls (proxy) to another server?
Thanks in advance

Related

Does HTML5 wih php require a webserver?

I am studying on YouTube HTML5 forms with PHP files; the videos either start with a web page containing the form and link to a PHP file or they put everything in php files; I copy the instructors exact files; but they do not work: nothing is posted after filling the form and hitting the submit button.
I have had the files on a USB flash drive then tried them actually on the computer: nothing.
My question is then: "Do I need to have an actual server on my computer in order for PHP files to function?"
Yes. PHP requires a web server to run on.
You can run it on your own computer; the web server doesn't have to be connected to the internet while you are creating and testing your PHP scripts off your local machine. You can read more about this on the official PHP What do I need page
You can download one of the following local servers:
Windows: WAMP
OSX: MAMP
Linux: LAMP
XAMPP is also an option, it's cross-platform (as referenced by ATechGuy)
Here is a good explanation of Why a web server is required to run PHP. Basically it is because PHP is a dynamic server-side scripting language.
However if you just want to run simple PHP scripts, with no web pages. This is possible without a web server running. See this question: How can I run a php without a web server?
Yes, PHP will need to run on a server in order to execute. If you have a Mac, it should be equipped to run an Apache server. I found this article to be really helpful when developing with PHP - https://jason.pureconcepts.net/2015/10/install-apache-php-mysql-mac-os-x-el-capitan/
Yes. PHP files contain code that must be handled by an interpreter, that is, a program that reads the PHP code and outputs accordingly. This can be done without a webserver (using command line php) but PHP is most commonly used with a web server.
You want to setup some sort of stack with a web server and php. A lot of beginners use apache as a web server, and since you are comfortable using youtube for learning, a simple search for "apache php" and your operating system.

Running websocket server on amazon EC2

I've written a web socket server that listens to a specific port. In order to run it I log in to EC2 instance with putty and run:
php server.php
I was wondering if this is the only and the right way to do. Normally copy my php files to the host via ftp would be enough, I don't understand why the php command needs to run the server.
Any help is appreciated.
This question is not about any particular coding problem, so is considered off-topic in terms of StackOverflow.
The way PHP works - is just a script file. Same as bash (.sh), python (.py), node.js (.js) or any other similar.
They all in fact have to be executed. In common world, Apache, nginx or any other web server will do execute those scripts for you for each request is made to web server.
As you are creating socket file, you need to create it yourself, as it creates one socket and php script will continue working as long as it will by it self. It is not executed per each request. In fact make sure it is not executed by apache so do not put in usual website directory.

PHP page only works when launched from compiler

I created a real time plot with flot and I made it work finally but there is one particularity: It only works if I launch the page from WebMatrix IDE.
This code has a PHP script to acquire data and then plot it. When I'm on the IDE, I use the option "preview in browser" and it works but if I close WebMatrix, go to the folder and double click to start "index.php" on Firefox it does not work.
Why is that?
It looks like you aren't running a server. PHP is a server-side scripting language, and as such it needs to run on a server to do anything. Google "Apache web server" or alternatively "IIS web server".
PHP is a server-side scripting language. You can't just open the file like an static HTML webpage. You should use a web-server (such as XAMPP) to view it correctly.
Your WebMatrix IDE previews your file correctly because it process the PHP file for it's output.

How to run php code from an application hosted on Marklogic Server?

I have created a HTTP Server on Marklogic to run my application. Now my application has a xqy page. Form that xqy page I want to call a page which is written in PHP. How can I execute PHP page from Marklogic? I have also installed Wamp Server for PHP on my machine. From within the Wamp server that PHP code executes but I want to run that php script from my application which is hosted on Marklogic.
Make an http request via xdmp:http-request().
I think Eric must mean xdmp:http-get().

how basic server in php works

I want to ask a conceptual question: how a server written in php works?
Actually I want to know when I write a simple php code to get some information from a client, how does the whole process happen?
In java I have to start server first. Server listens to the port. When any client knocks then connection creates. Is it similar to php? Before running client application do I have to run my php code or server will do that for me? I am using localhost.
see this article: http://kevin.vanzonneveld.net/techblog/article/create_daemons_in_php/
Before running client application do I
have to run my php code or server will
do that for me.
This depends on your server architecture, you can use something like inet.d which invokes your script only if there is access on that port, or you have the standalone version, where you start the php from console und it waits for connections.
Does it similar to php ?
Yes.
Before running client application do I have to run my php code or server will do that for me.I am using localhost.
If you are writing a server in PHP then your PHP code is the server.

Categories