Putting PHP code in the Glassfish docroot folder - php

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

Related

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.

ASP.NET and PHP in same Website

I would like to have an asp.net website hosted in IIS at site like this
www.mydotnetsite.com
and then have a wordpress blog that is an application to it...
www.mydotnetsite.com/wordpressblogsite/
Is this possible?
Yes, it will be not a problem. Even some Windows Shared Hosts offer PHP plans - Windows Hosting PHP.
You can configure IIS to support both Asp.Net and PHP at the same time.
yes,you can host your php website in IIS
Yes it is possible! You can install wordpress in a subdirectory.
You need to have PHP/MySql configured in your IIS. (Here is how)
You need to point www.mydotnetsite.com/wordpressblogsite/ to the wordpress folder (Download the latest from wordpress.org). In most of the cases, simply copying the folder with the desired name(wordpressblogsite) within the document root of webserver is enough.
You can then go to the URL and follow the installation option (recommended) OR you can edit the wp-config.php file to put the db credentials etc.
The short answer: Yes.
The long answer:
First you're going to have to make sure that PHP and MySQL are installed and working properly on your server and configured for use with IIS. There are installers available to make this process easy. Check out http://php.iis.net/. That will help out a lot with getting PHP up and running as well as installing wordpress. MySQL should be easy too, just check out their site and install the correct package.

how to start php?

I am asp.net developer , i want to learn php
what are the software need to run compile php file ?
how to install this software any path that should be set ?
what kind of database it needs to store data and retrieve date ?
see me as beginner and then give the idea / information ..........
thanxx
You just need the PHP interpreter and if you want to do web stuff a webserver.
You can get the interpreter from http://www.php.net - if you are using windows you really want to get a binary version and not compile it on your own - and the Apache webserver.
As a database PHP developers usually use MySQL (but it can also connect to most other databases).
The easiest way for your to get started is getting a package like XAMPP which will contain all you need without requiring you to configure everything manually.
For actually learning PHP, please get a recent book/tutorial. Old stuff is usually telling people to do horribly things every sane developer will hate you for (cluttering your global namespace with variables settable by the user for example).
You could have a look at the official PHP docs which also contains a "getting started" guide.
Since you are an ASP.NET developer I assume that you are familiar with IIS and that you're probably using IIS 7.5. If so then the easiest way to familiarize yourself with PHP is to use Microsoft Web Platform Installer and install PHP directly to IIS. You don't have to set any paths after that, just create a site on IIS and start putting PHP files there. Keep in mind that Web Platform Installer automatically enables WinCache extension and your changes might not be there when you hit the refresh button. Just locate the php.ini and comment out the relevant line.
Straight from the horses mouth. Getting Started. You will need a php interpreter, if you have access to a webhost that has php installed you're half way there, if you have a linux partition you're half way there, otherwise check out XAMPP.
Software: XAMPP will get you up and running
Tutorial: w3schools
If you are familiar with IIS and want to use it as your web server you can download PHP for IIS here and use some of the learning material there to get started.
If you did not want to use IIS and wanted to use Apache instead then I agree with the others XAMPP will get you a dev environment up and running quickly.

Starting Dev with PHP on Windows

I have written web apps with JSP in the past. Now, I'm getting started with PHP. I have a question and a friend of mine who is a .NET developer pointed me to this site.
I downloaded and installed PHP from here. Now, I'm trying to get the Windows Azure for PHP SDKs setup. The reason for this is that my app needs to be hosted in Azure. After I downloaded the SDK, I looked in the install.txt file. The file states that I need to add the library directory to my PHP include_path. My problem is, I do not see an environment variable named "include_path" in my settings. Should one have been created? Is the PHP include_path even an environment variable? Can someone help me out please?
Thank you!
include_path is a configuration setting usually set in the php.ini file.
Run a PHP script containing
<?php phpinfo(); ?>
to find out which php.ini is actually being used - it can be confusing sometimes.
The INI file will contain the setting, which you can then change.
You will probably need to restart the web server after changes.
I don't know how PHP and Azure work together. If the INI method doesn't apply here, here is the PHP manual section on ways to change PHP config settings other than php.ini.
I would go with a dedicated development system like XAMPP. Although it should be noted that XAMPP should NEVER be used on a production system. It is very insecure and they are very very very slow at patching known vulnerabilities in their stack.
Question: If you're planning on building an Azure based system, why are you choosing to build it in PHP rather than C# on ASP.NET?
.NET is Microsoft's primary platform for web infrastructure development: Azure support will come quicker and will be FAR more thorough for .NET vs. any other platform.
Remember: "Just because you can doesn't mean you should" ;)
I strongly encourage you to build your Azure site in .NET, not PHP.

PHP on windows environment Vista

Do I need a special library to run PHP on Windows environment Vista?
I can write simple message like echo "hello" but whenever I try to run any these scripts no error nothing display on the page http://php.net/manual/en/function.crypt.php.
I'm new to PHP please help
When in doubt...
<?php echo phpinfo(); ?>
If that code outputs information regarding your PHP version and settings, PHP is installed correctly.
There would be errors in your code if nothing is displaying. Post the code you are having trouble with and we can help you out.
Have you actually set up a local server? You'll need this to run PHP scripts. For a newbie I'd recommend WampServer since it's really easy and handles all the complexity of installing a server. Once installed and running, try http://localhost/ in your web browser.
Based on your comment though, I think the problem is that the sample code on the page you posted won't work on their own, you'd need to combine them with other things. For example the first one references a variable $user_input which you'd replace with a variable taken from user input (eg a form) on your site.
I suggest finding some tutorials online (or buy a book) and walk through various proper examples to familiarise yourself with PHP.
Do you have PHP / Apache installed at the moment? If you don't, try XAMPP. It comes with an easy and convenient installer.
Like most languages your computer must have the language/compiler installed in order develop and run scripts/applications. PHP was originally designed for web development so you won't usually find it installed on PCs by default.
The easiest way to develop PHP is to upload the scripts to a web server that has PHP installed and then test in your browser in the same fashion that you'd test an HTML page.
Otherwise to do it locally on your computer you can install a web development environment which acts like a web server. Essentially eliminating the upload step.
I believe the most popular for Windows is Wamp Server

Categories