Merging php application into JSF application - php

Please help me in the solution of this problem
I have developed a JSF web app, say JSFApp. And the team has developed a php application, say phpApp.
We need to merge both applications and run them on same servers, apache tomcat(please refer if any other is preferable).
The two apps dont even need to communicate with each other.
We could have bought two different domain names for the two web apps but we want to deploy both under same domain name.
We want to do something like copying the phpApp into JSFApp's webcontent folder and accessing it as localhost:8080/JSFApp/phpApp. We haven't tried it yet.
Please suggest.

I have had to support legacy PHP applications on Tomcat before. The solution I went with was to use PHP/Java Bridge. See section "I want to use PHP for all tomcat applications. Apache and IIS are not available, but performance is important. How do I install it?" of the FAQ.
This works with Tomcat 6 and 7, it will not work with Tomcat 8.

Related

What's the best way to share and edit a PHP project in localhost?

I have a project in PHP and I work on three different computers, in two of them I use Windows 10 and XAMPP and in the third I use Ubuntu 20.04 with PHP and Mysql manually installed.
I shared on Google Drive the XAMPP htdocs folder that I use on one of the Windows 10 computers, however, access from other computers must be through localhost, not at: file:///G:/Anothers%20computers/My%20laptop/www/
For example, when I try to access the folder above, the php is not interpreted. Because access is not through localhost. Not to mention that as I said I use Windows and Ubuntu, and in the latter I don't use XAMPP.
Would GitHub be the easiest option to share a folder and use it on these 3 computers? Or is there a better option?
If you are developing this code on three different machines, I would suppose that GitHub is a pretty good solution. With git you have a very good way in documenting your changes and also have the possibility to revert your latest changes. But you have of course every time you leave one machine to remember to commit and push the changes. And on the other machine you have to pull the changes before you continue working on the code.
But every machine needs it own way to interpret the code.

Putting PHP code in the Glassfish docroot folder

Previously I used shared hosting, and the hosting company provided Apache Tomcat with PHP and MySQL. I have since switched to virtual private server hosting with Linux, so I can use a server of my choice, in particular Glassfish 4.1.1 for Java ServerFaces 2.2 applications, and have already deployed a war file for a particular application.
However, I have quite a lot of old code, including some PHP. I have put my old code in Glassfish's docroot folder and all the straight HTML5, JavaScript etc. work without any problems. How do I get the PHP code to work as before? In doing a Google search, it appears possible to deploy a war file from Quercus, but if this is done, how do I get PHP to work in the docroot folder?
I'm not aware of anybody who has done this before, so any advice would be most appreciated - thanks in advance.
I used GlassFish before with JSP. Now PHP has become the language of my choice. I feel like it's much more maintainable.
But to answer your question, in order to get PHP to work in the docroot server, you have to enable PHP on OracleGlassFish Server. From Oracle documentation :
1. Download the Quercus PHP interpreter from http://quercus.caucho.com/.
2. Deploy the downloaded WAR file to the GlassFish Server.
3. To verify that your PHP engine is working, enter the following URL in your browser:
http://localhost:8080/quercus-4.0.1/
4. Move your PHP application to a subdirectory of the Quercus directory.
5. To verify your PHP application is working, access your application from a browser.
For example, enter the following URL in your browser:
http://localhost:8080/quercus-4.0.1/myapp/
Also, this previous answer from SO may also help :
Allow Glassfish and PHP to work together in the same server using Apache

How to configure PHP on http-server

I'm doing a project that involves using a server to host files on the web. I'm very new to web hosting technologies and I found an angular tutorial that used a very simple server called http-server and with this tutorial I was able to get a site hosted to localhost. Getting something hosted using the tutorial required to know very little about how each individual step was working. I want to use PHP but also being new to that, I know that it's server side and I need the server to have PHP installed but I have no idea how or if it's possible given this tool.
I'm not sure if have to move to a larger scale web server with php installed by default like Apache, but I'd prefer to keep it simpler if possible. Here's a link to the tutorial and server utility if that helps at all
https://docs.angularjs.org/tutorial/step_00
https://github.com/indexzero/http-server
If you really want to publish anything "on the web", there's really no need to create a webserver on your own. Any provider you choose will have everything you need preinstalled for very little money, usually in the form of a LAMP stack. (Linux/Apache/Mysql/PHP). The DIY webserver you tested is a security risk at best if you're online with it. And simple as it may seem, the AngularJS server is surely more trouble than just using a pre-installed LAMP, especially when you think about maintenance. If you do not plan to use a commercial webhosting provider, tell us what your platform is, and somebody will be able to point you in the right deirection with a LAMP or WAMP install. It's not that difficult, really.

Is it possible to simulate Azure Websites locally for testing?

We're developing a dynamic website that is to be hosted on Azure Websites. Before going to the staging phase, I'd like to test it locally in an environment that is as similar to the production environment as possible. (By testing I mean clicking around and checking that things work, nothing fancy.)
Right now we're doing this with standard Apache, MySQL and PHP installations, but I fear that things that work on this setup might not work on the live web server (Azure Websites).
Ideally, we'd use our own computers to run virtual machines that would be exactly like the production server we will be deploying to. Is this possible? If so, how? If not, is there another way that is better than what we're currently doing?
Your best bet will be to perform a test deployment to an Azure Website instance. There isn't a local emulator or replica for Azure Websites and Azure Websites are more than just a vanilla instance of IIS.
To provide you with the best chance of success I would recommend:
Replace Apache with IIS locally.
Ensure the version of PHP you are using aligns with a supported versions on Azure Websites. Deploy the PHP "runtime" on your IIS setup locally.
MySQL - again check supported versions align with the version you are running. This isn't embedded in the Azure Websites feature - you could run your own on a VM or leverage one from ClearDB.

What is needed for a user to download and run a PHP application?

I'd like to develop a PHP application that users would download and then could run. The application will have a web service.
I assume they will need Apache, but my main question is what is needed for PHP to run on their machine? Is there something needed like the JVM in Java or the .Net framework in .Net? What is it called and how difficult is it for them to download (size, etc.).
Is anything else required that I did not mention?
Thank you,
They will need a web server with a compatible version of php. That's it.
Are you asking what is required to run a .php file on a windows machine? Do you mean like an executable or a web server script?
If like an executable need the php files:
Download the php installer from http://windows.php.net/download/, and then you can run php.exe script.php
If like a web site:
You need a webserver (like apache) and the php.exe files. I would suggest if testing to download a prebuilt webserver like XAMPP (download from http://www.apachefriends.org/en/xampp-windows.html)
It depends on the application. At a minimum it will need PHP.
Is there something needed like the JVM in Java or the .Net framework in .Net? What is it called and how difficult is it for them to download (size, etc.).
PHP. Presumably as difficult as it is for you, but it depends on the platform. OS X comes with it. Most Linux variants either come with it, or allow it to be installed with one command to the package manager. Windows users will have to download it seperately.
As for other things that might be needed…
If it has a GUI, it might need PHP-GTK.
If it expects to be accessed via HTTP then they will need a webserver which supports PHP. This could be Apache, IIS, or one of numerous other servers.
(It isn't clear if, when you say "The application will have a web service.", you mean "The application will access a web service" or "The application will provide a web service". If the latter, then a web server will be needed).
If you use any non-core modules, then they will be needed as well.
You need to describe your proposed application a bit better. Is there a reason the application must be in PHP? It may be possible, but it's certainly not common to code and distribute a desktop application written in PHP.
There are a few options.
If you are just writing a script (command line, etc) you don't need a webserver. You just need PHP installed to run it (there are even downloadable installers for it).
If you are writing a web-based tool, then you will need your users to have a webserver if they are meant to run it on their physical machines. And you don't need a framework...
just think of it as a Webserver + PHP as a plugin. Some webserver options: Apache, nginx, lighttpd
Try having users install WAMP, MAMP, or Zend Server CE all of which are free and come with both a webserver and PHP.
If you really want a deployable PHP script/tool, maybe look into something like PHPDock, which gives your users a single installable app (embedded server, php). NuSphere PHPDock
Honestly, it's not the greatest language to use for this type of deployment, but it's certainly fun to try to figure out! Sorry for not linking out also, don't have enough rep points for all of the links I had intended to supply.
Actually you can run php script without the need to have a webserver installed.
Just install php and then from command line:
$ php myscript.php
If you really want you can even build GUI application with php even though I would not suggest it.
Cheers Andrea
you could also try to use quercus.
Quercus is Caucho Technology's fast,
open-source, 100% Java implementation
of the PHP language (requires JDK
1.5).
This way you only will need a jvm+quercus. It also is platform independent this way because it runs in the JVM.

Categories