Page 1 of 1

PHP Does Not Work!

PostPosted: 02. April 2010 11:51
by ticonzero
Hello, when I try to open a web page with the following:

<?php

echo "<pre>";
print_r(ini_get_all());
echo "</pre>";

?>

That is the code to display the php.ini configuration; instead of it I get this:

Image

Here you may download the Apache LOG file: http://www.filehosting.org/file/details/129712/apache_LOG.zip
How to fix it please?


Thank you.


Ticonzero

Re: PHP Does Not Work!

PostPosted: 02. April 2010 12:11
by Nobbie
Unfortunately, you suppressed the most important info, the browser URL of your script. What did you enter in your browser to open your script?

Re: PHP Does Not Work!

PostPosted: 02. April 2010 12:26
by ticonzero
Ok! When I open the URL in Firefox, address bar, no problem; the issue occurs when I go in the folder and there I right click on the PHP file and I open it with Firefox. I did not get that issue before.

The browser URL is the following: http://194.119.202.161/nubuilder/produc ... estPHP.php

Thank you for your interest.


Ticonzero.

Re: PHP Does Not Work!

PostPosted: 02. April 2010 13:13
by Nobbie
ticonzero wrote:the issue occurs when I go in the folder and there I right click on the PHP file and I open it with Firefox


This is not surprising, as you dont open the file via HTTP protocoll (which involves Apache as webserver) but simply as file. You could even stop and/or remove Apache and PHP and the right click (or double click) will still open the file with the appropriate tool (either an editor, a browser or whatever you have assigned to the extension .php).

ticonzero wrote:The browser URL is the following: http://194.119.202.161/nubuilder/produc ... estPHP.php


Only if you enter it manually. On right or double click in the windows explorer you will see the file:// protocoll instead of http:// in the browser URL.

So this is not an Apache or PHP issue, neither a browser issue, it behaves as designed.

Re: PHP Does Not Work!

PostPosted: 03. April 2010 22:04
by MC10
Yes; if you use the file: protocol, the file won't go through the PHP interpreter.

Re: PHP Does Not Work!

PostPosted: 04. April 2010 04:57
by zeuser
ticonzero wrote:Hello, when I try to open a web page with the following:

<?php

echo "<pre>";
print_r(ini_get_all());
echo "</pre>";

?>

That is the code to display the php.ini configuration; instead of it I get this:

Image

Here you may download the Apache LOG file: http://www.filehosting.org/file/details/129712/apache_LOG.zip
How to fix it please?


Thank you.


Ticonzero


I tried exactly the same code on my install and got the same results. Note: I did type http://localhost/test.html though. As a .php it works just fine. But not as a html file.

Re: PHP Does Not Work!

PostPosted: 04. April 2010 17:50
by MC10
That's because the PHP interpreter doesn't process .htm or .html files. You can alter your Apache configuration to do that, but that is not recommended.