WAMP working but php will not display on pages
Posted by: normthegnome (---.uwsp.edu)
Date: April 04, 2014 02:43AM

Hi all,

I've looked around but I cannot figure out why...

a webpage I look at via the web interface displays fine but with no signs of php content.

Any ideas why that would be?

Thanks!

Win7 64bit
WAMP 2.4
Wamp icon is green
localhost is working fine... just fine

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: RiggsFolly (---.as13285.net)
Date: April 04, 2014 03:14AM

Are you doubleclicking on the php script from explorer?

If so dont. You have to run a the script in your browser for Apache to see the php and pass it to the PHP interpreter for compilation and execution.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: normthegnome (---.uwsp.edu)
Date: April 04, 2014 03:57PM

Thanks for replying!

I go through localhost and choose the page I'd like to see. The entire page displays correctly except for the PHP which simply doesn't display at all.

I made another page with this code:
<!DOCTYPE html>
<html>
<body>

<?php
echo "My first PHP script!";
?>


</body>
</html>

This results in a blank html page.

Weird stuff.

Any ideas?

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: RiggsFolly (---.as13285.net)
Date: April 04, 2014 04:06PM

Does the localhost page show the WAMPServer home page?

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: normthegnome (---.uwsp.edu)
Date: April 04, 2014 04:10PM

Yes it does.

Everything seems to be working except for the php bits of pages. Weirdly if I go to a separate php script like this:
<?php
$count_my_page=("captiveportal-hitcounter.txt"winking smiley;
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w"winking smiley;
fputs($fp , "$hits[0]"winking smiley;
fclose($fp);
echo $hits[0];
?>

It will give me the resulting count. But when the script is called as part of a page of html it fails to do anything.

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: RiggsFolly (---.as13285.net)
Date: April 04, 2014 04:15PM

OOooohhhhh now I get it.


If you want to run php either the file has to have a .php extension or you have to tell apache that .html files should also be passed to the php interpreter as well.

I woudl stick to using the .php extension.


This line in httpd.conf tells apache to treat .php files in a special way

AddType application/x-httpd-php .php

That line makes apache pass the file to php for execution


If you want to use .html files as php code hosts you will need to do add another line like this

AddType application/x-httpd-php .html

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: normthegnome (---.uwsp.edu)
Date: April 04, 2014 04:22PM

Thank you RiggsFolly!

That seems to have worked! I owe you cookies. Lots of cookies!

Options: ReplyQuote
Re: WAMP working but php will not display on pages
Posted by: RiggsFolly (---.as13285.net)
Date: April 04, 2014 04:29PM

Yum,

I accept that offer.

Thanks

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote


Sorry, only registered users may post in this forum.