PHP app in liferay - HTTP Status 404 - php

I'm a liferay newbie. I'm trying to write a simple php app that echos some text and add it as a plug in to liferay. I've created the file helloworld.php, zipped it up and installed it. Finally I add it to the page but am getting the following error:
HTTP Status 404 - /helloworldapp/
type Status report
message /helloworldapp/
description The requested resource (/helloworldapp/) is not available.
Apache Tomcat/6.0.26
Can anyone help me?
Jonesy

text editor had slying appended a .txt onto the end of index.php
I only saw it when I displayed the directory in the CLI. removed the extension and it works..

You are using Apache Tomcat Server right? And the code is a PHP script? I am more confused as what do you actually want to achieve?

Related

How can I get php to respond to get request?

As a preface I would like to say that I am very new to php AND to stack overflow so this is a very beginner question.
For some context: I am doing an ubuntu autoinstall and am following the following forum post for some extra settings I'm trying to do: https://askubuntu.com/questions/1290624/fetch-autoinstall-based-on-mac
So the installer does a curl command which if understand correctly sends a GET request to the http server which will run some php code and finally return an edited file (is what is supposed to happen). How can i get a php environment up and running to do just this?
I have the apache http server running which I can use to get files with curl, I just need to know how to "catch" the get request and send back an edited file.
just create a PHP file in your webserver root directory then send your request to http://yourserver/your_php_file.php
Your webserver will call the file your_php_file.php and this file will have to send back an edited file ;)
Try with a simple index.php file and navigate to it via the URL. The index.php file can be just this for starter:
<?php
var_dump($_GET);
and after you see what is $_GET (and I recommend read about it) you will figure out what to do next :)

PHP 404 Error Message

I have begun learning PHP using an eBook. The following strange results are happening: Per the book I have created two simple PHP files. They are named phpinfo.php and hello.php. Both files show in the user root directory. Both files show when I use the ls command in my mac terminal.
When I try to run them in my browser only the first one runs. The second results in a 404 error, File Not Found. How is this possible? Could an internal file mistake cause this?
Thanks
Thank you all. It was suggested that it would be easier to delete everything including the app and start over. So I did and then downloaded MAMP. That worked.

Cant run PHP files after installing wampserver.. Although i can run the localhost,etc

I've installed wampserver. Its installed and I can see its icon on the tray. But I cannot open a simple PHP file. I saved the file in C:\wamp\www and I'm trying to open it by using the following URL in the browser using localhost. But I'm getting Error 404 File not found on the server! I tried restarting the PC and the wampserver services but to no avail. Please help me. I'm a newbie. Please help me.
Did you write the correct URL Path ? If you drop the file into e.g :
C:/Wamp/www/file.php
Then you must write the URL into this form:
http://localhost/file.php
Note: 404 error is an http error , means the resources you are trying to reach is not exist !

How to access phpinfo.php?

I am trying to access
http://localhost/phpinfo.php
but I can't find a way to get there on the local machine I made the update on.
This is part of a FastCGI installation to Host PHP Applications on IIS 6.0.
I followed steps here: 'Test PHP CGI' in http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis-60
I copied phpinfo.php as indicated in the link above in the F:\Inetpub\wwwroot directory as indicated here http://msdn.microsoft.com/en-us/library/ms474356(v=office.12).ASPX
then tried to access
http://localhost/phpinfo.php
but I don't get anywhere (I get: 'The webpage cannot be found' error message).
Any help is appreciated.
Thanks,
Izumi.
You should be able to get all the information by saving a file with the following:
<?php
phpinfo();
?>
and simply view that page.
While you are testing, you can drop it anywhere you like, but obviously remove it from a production box as anyone will be able to see it.
I had to add the .php extension in the IIS Web Sites Properties as indicated here http://www.iis.net/learn/application-frameworks/install-and-configure-php-applications-on-iis/using-fastcgi-to-host-php-applications-on-iis-60 under 'MANUALLY CONFIGURE THE FASTCGI EXTENSION TO WORK WITH PHP'
I am not sure why the script didn't do it for me. Maybe because I had two domain names on that server.
Thanks for your help!
Izumi.

Just one PHP page won't run - it wants to download

All PHP pages are all running just fine on my site, except for one for which Firefox says "You have chosen to open checkpage.php which is a PHP script" and then wants me to select an application with which to open it.
The site is running PHP Version 5.2.10 on Centos 5.5.
I'm using exactly the same code on another site (PHP Version 5.2.10-2ubuntu6.4 on Ubuntu 9.10) and it's fine.
I've Googled myself silly trying to work out what the issue is!
Does anyone have any ideas why this one page might be causing a problem? The page is about 200 lines long but I'll post it here if it'll help...
All thoughts much appreciated
Mike
PasteBin: http://pastebin.com/A6uNj9CN
Last time I had this problem, I just installed PHP on my server. Worked fine after I rebooted it. Hope that helps.
Does the file that's downloaded have any content? Or is it zero bytes? It's possible something's causing PHP to puke on that script before it sends out any headers and so the browser has no choice but to interpret it as a download of a .php file with no content.
Check the server's error logs (and PHP's as well) to see if anything's showing up in there.
Is there a separate htaccess in the folder that stops apache from sending it to php or changes the mime-type? Does the file have a different extension than other files on your site?
Use something like a packet sniffer, or HTTP Debugger, to see what headers are actually sent by the webserver. That will help you, and us, debug the issue.
Call curl -I http://blahblah/foo.php and look at the content-type header. That will help point you in the right direction. Is it text/html or something else?
Try to change the permission of the file from 775 to 644 or try changing the permissions. Note: change to the correct permission type to avoid public viewing of the files

Categories