简体   繁体   中英

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM