How to run Php Pages in Netbeans - netbeans-8

I have just successfully deployed Quercus on Glassfish 4.1. I tested in the browser
http://localhost:8080/quercus-4.0.39/ and saw this:
Congratulations! Quercus™ Open Source 4.0.39 is interpreting PHP
pages. Have fun!
Then ran Netbeans Tools > Options > PHP > Activate PHP Support
It worked. I now see this:
So I made 3 tests:
I ran a php page in an html application but instead of displaying the page it prompts a download box to open in Notepad
I created a new PHP project with below configuration:
But when I run the app with above configuration I receive this error:
Firefox can't establish a connection to the server at localhost.
So I tried with a third test with other configuration:
When I run this third test I get a HTTP Status 404 - Not Found error on GlassFish server.
What am I doing wrong? Thank you!

The problems with your tests are:
PHP needs to be interpreted by a web server. Your browser doesn't know what to do with a PHP file, so it just treats it like a file rather than a page to render. Apache is the most common and easiest server to do that with, GlassFish is unnecessary and probably not the best choice for PHP.
In this test, you are trying to visit a web server which doesn't exist. You don't have any server that listens on port 80.
Here, GlassFish is reporting that it can't find the resource you requested. Have you made sure to put your PHP project in the right directory for Quercus (like in step 4 of your documentation link) and made sure you're visiting a valid URL?
I think the best thing for you to do is move away from Quercus. The latest version of it is very old and implements an old version of PHP (version 5, whereas the latest is 5.6). Looking at the official website, the project appears to be dead, with broken links and very old documentation.
I would suggest you investigate installing a WAMP (Windows, Apache, MySQL, PHP) or LAMP (Linux, Apache, MySQL, PHP) stack. There are lots of very easy installers for this approach which will help you get up to speed and a lot of helpful tutorials and documentation.

For those who using tomcat, below are the steps :-
Right click your project --> properties --> Run Configuration --> For Run As, select PHP Built-in Web Server
Go to Tools --> Options --> PHP tab --> in Php 5 interpreter, browse the correct location for php
Then it should works !
In my case , my php is in /usr/bin/php7.0, so I put the path in Php 5 interpreter.

Related

Visual studio code auto refresh browser with apache

Is there a way to set up (extension, etc...) Visual studio code to auto-refresh browser (Firefox Dev, Chrome Dev) as soon as the file I am working on is saved? (Like Live Server extension)
I am working with local installation of Apache (Yes, I am working on WordPress :)
Using this tutorial from youtube you will install the Live Server VSCode extension for use with html files. However, you will most likely (although you haven't mentioned) be using PHP or other languages because apache supports it. For this, use this tutorial from GitHub. It installs a browser extension (compatible with chrome/chromium-based/firefox browsers) that connects to a server instance and serves the reload function to that webserver. This does NOT install a web server (in this case it shouldn't matter). If you follow the tutorial, it should be really self-explanatory.

ColdFusion 2016 stopped rendering website after Mac software update

ColdFusion 2016 stopped rendering website files in browser after I updated my Mac software to latest one, Mojave 10.14.1. Instead of seeing the rendered page in the browser I can see my repository files only.
I noticed that some previous settings regarding local server and Apache were removed after update. I did restore missing settings back how they were before and even reinstalled ColdFusion 2016, but still have that problem with rendering websites on the ColdFusion platform.
After running /Applications/ColdFusion2016/cfusion/runtime/bin and sudo ./wsconfig, I the get Web Server Configuration Window with content inside
[ localhost ] Apache : /private/etc/apache2.
Is there anyone who can help to resolve this issue please?
Change the directory to
/Application/ColdFusion2016/cfusion/runtime/bin
Run
sudo ./wsconfig
The documentation does not mention sudo, but I am suggesting it to be safe.
Source: https://helpx.adobe.com/coldfusion/configuring-administering/web-server-management.html
After testing ColdFusion 2016 platform using port :8500 I found out that CF server uses Tomcat path (wrong path) instead of Apache one (for Mac virtual directory file: httpd-vhost.conf) and both of them are running at the same time.

How to run Play Application on Apache 2 server?

I'm completely new to this, so please forgive me.
What I have right now is a Play application that, when I run play run on my personal Mac the site launches on localhost:9000 and everything works fine.
I also have a server running CentOS that tells me to "add content to the directory /var/www/html/" when I navigate to it's IP, but I don't understand how I can do that with a Play application? It's not like I have a bunch of HTML files I can just put there?
So my question is, what steps do I need to take to make it so if I go to the IP of my server, it takes me to the website I made and that is currently stored on my Mac?
You need to configure Apache as a "proxy" to your Play application (that's why you won't need to put anything into /var/www/html/).
Your application code can be uploaded anywhere you want on the server. It will need to be started on the server (with play start for example) and Apache will "forward" requests to the running Play application.
You can look at the Play documentation in the "Deploy your application" section :
"Deploying your application" (general recommandations) : https://www.playframework.com/documentation/2.6.x/Production
"Set-up a front-end HTTP server" (explain how to deploy Play behind Apache or Nginx) : https://www.playframework.com/documentation/2.6.x/HTTPServer

Does IntelliJ have an internal web server to serve static content of a web application?

Right now, the directory of my module is defined as an IIS virtual directory and IIS serves the files.
I was wondering whether IntelliJ has an internal web server, which can serve the files, without the need for any third party. Eclipse does.
UPDATE: built-in web server is available in the recent IntelliJ IDEA versions (starting from 13). You can find more details in the blog (yes, this feature first appeared in WebStorm).
IntelliJ IDEA has no this feature, you need to install and use any third-party web server that can serve the content from the project folders.
A built-in HTTP preview server will be part of Intellij IDEA 13 and is already available in the EAP: http://youtrack.jetbrains.com/issue/WEB-7148
"All existing actions — preview in browser (pop-up over html file or menu action or
shortcut), open in browser and create/debug html file action now open file on built-in web
server
http://localhost:63342/<project name>/<file path relative to source or content root>"
In other words, right-click on an HTML page and select "Debug" or "Open in browser", and IDEA 13+ will serve up that page via port 63342.
Here's another super simple option, install Python: http://www.python.org/getit/
Then open a shell prompt, navigate to your root web folder (e.g. public) and run python -m SimpleHTTPServer - This starts an HTTP Service on port 8000.
Further reading should you need it: http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
I've got mine running on Windows 7 but the above article still applies.
Another option is is create a PHP project that, starting with v 5.4.0 of PHP includes a built in web server. This page explains it all ...
http://www.jetbrains.com/idea/webhelp/php-built-in-web-server.html
IntelliJ IDEA has a built-in web server that can be used to preview and debug your application. Just watch this YouTube video or follow the steps below.
Option 1
You need to add new 'JavaScript Debug' configuration:
Click Add Configuration... or Edit Configurations... in the Navigation bar
Click button in the toolbar or press Alt + Insert to create a new configuration
Select JavaScript Debug under the Templates node in the tree view of run configurations
Fill in Name, URL, Browser and click [OK] to save the configuration
Use http://localhost:63342/YOUR-PROJECT-NAME/index.html for URL
Now you can run the configuration:
Click run or debug button in the Navigation bar (or use Shift + F10 / Shift + F9 hotkeys).
Option 2
Running web page in browser without creating a configuration. Refer to the related IntelliJ IDEA Help article.
In the editor, open the HTML file. This HTML file does not necessarily have to be the one that implements the starting page of the application.
Do one of the following:
Choose View | Open in Browser on the main menu or press Alt+F2. Then select the desired browser from the pop-up menu.
Hover your mouse pointer over the code to show the browser icons bar: . Click the icon that indicates the desired browser.
Result
Google Chrome browser with a demo web page served by the Intelij IDEA's built-in webserver:
One simple way is to create a NodeJS / Express project in IntelliJ that is your web server. You can then use it to serve your static web pages and any other web content. The NodeJS web server is very small and runs fast - noticeably faster than IIS and Apache. Best of all you can just hit the Run button in IntelliJ or WebStorm to start it up.
By default, a NodeJS / Express project includes a public/ directory that you can use to contain your static pages that you can then view from http://localhost:3000/
This explains the steps required to enable NodeJS in IntelliJ and includes links to other Node resources:
http://www.jetbrains.com/idea/webhelp/node-js.html
If you feel the need, you can reconfigure your NodeJS server using server side Javscript code. You can add SSL support or almost any other server side features you care to dream up. Just add NodeJS modules using the npm (Node Package Manager) command line tool included with the install. NPM Registry https://npmjs.org/ indexes all the available modules.
You can configure IntelliJ to use a lot of different application containers, but each of them must be downloaded and installed separately. I currently have mine configured to serve via jetty, like eclipse, and also tomcat, tc-server, jboss, and node.js. It's pretty easy to set up.

Apache Tomcat Server shutdown yet webapplication is still running

I am using Apache Tomcat 6.0.18, I am running on Windows XP
I have a web application which I place it's war file under webapps folder. The web application runs fine, its just when I run the shutdown.bat the application still runs (as in I refresh the page and it doesn't come up not found).
I check the localhost:/8080 and webpage cannot be found comes up
but when I run localhost:/8080/myapp my application comes up.
I have tried this in both IE and Firefox
Thank you for any help.
I had this similar problem, This can only happen if Apache Tomcat is not configured properly. Best way is to check build path and look for exact directory of Apache.
Example
i.e C:\Program Files (x86)\apache-tomcat-7.0.27
Also look for windows service for start, restart or stop
Run - services.msc
You may want to check this link
i.e
Verify that tomcat is actually down (simplest way is via task manager)
The issue sounds like a caching issue. Try deleting your cache.