0

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.

csharp
  • 464
  • 2
  • 10
  • 19

1 Answers1

0

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

  • It worked - many thanks for your help! tried it out with a short file with phpinfo(). My home page is in the docroot folder at the URL www.cs-cubed.com, and currently the counter is disabled. I wish to use PHP with it, but don't want to change the URL to have quercus-4.0.39 (the version I downloaded) or anything like that. Perhaps I can refer to the PHP code via an HTML iframe in the home page. Does that sound reasonable? – csharp Jun 25 '19 at 05:18