PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 04, 2015 10:43AM

Hi wamp users. I am new to using localhostst and programming web code scripts. Learning my self at home before I consider taking a qualification in this subject. I have downloaded Wamp onto my laptop using windows 7. When I white a script in PHP code the whole script is executed and displayed into the browser. Does anyone know what I am doing wrong? arr driving me mad. I would be very grateful for your advice.

Options: ReplyQuote
Re: PHP
Posted by: RiggsFolly (---.as43234.net)
Date: March 04, 2015 12:00PM

Name the script file with a .php extension.

Apache only passes files with a .php extension to the PHP interpreter so if you use for example .html the php wont get compiled and executed, it just gets sent to the browser like any other text in a HTML file.

---------------------------------------------------------------------------------------------
(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-



Edited 1 time(s). Last edit at 03/04/2015 01:06PM by RiggsFolly.

Options: ReplyQuote
Re: PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 04, 2015 01:05PM

Hi

Thank you for your reply.

I have saved my file with the . PHP in the www folder. My default browser is Crome, all services are running as they should on the wamp. Very confused!!!

Thank you

Options: ReplyQuote
Re: PHP
Posted by: RiggsFolly (---.as43234.net)
Date: March 04, 2015 01:07PM

Sorry, does that mean your script is now running? Or do you still have a problem?

---------------------------------------------------------------------------------------------
(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: PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 04, 2015 02:15PM

Hi

I have had the problem for about one week. Uninstalled WAM and re installed three time but still the same problem. I am using notepad ++. When I have finished writing the script i save it then run the file from the RUN menu then crome browser. All the code appears on the web page.

Options: ReplyQuote
Re: PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 04, 2015 03:38PM

Hi Riggs

Iv just remembered something. When I run the PHP file the root address changes its self to C:/wam/www/test.php rather than [localhost] does not appear.

Is there a problem with this???


Regards

ATOMKA

Options: ReplyQuote
Re: PHP
Posted by: RiggsFolly (---.as43234.net)
Date: March 04, 2015 03:52PM

Are you running the script by double clicking the filename from Explorer??


If so DONT.

If you want a php script compiled and run, it has to be processed through Apache. The only way to do that is to enter the address in the browser's address bar.


So to run mytest.php that lives in \wamp\www\mytest.php you enter 'localhost/mytest.php' into the browser.


By the way while you are playing, make a subfolder in www so for example \wamp\www\chapter1 then put your testing code in there. Now you woudl use 'localhost/chapter1/mytest.php' to run the test code

---------------------------------------------------------------------------------------------
(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: PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 04, 2015 04:08PM

Ill try this when i finish work today. Maybe post a message later.


Many thanks for your advice.


ATOMKA

Options: ReplyQuote
Re: PHP
Posted by: ATOMKA (---.nhs.uk)
Date: March 09, 2015 03:07PM

Hi Riggs

My wamp server seems to be working fine now. I have followed you instruction and PHP not is executing program scrip to web pages, just producing content of variable code. If you have any other tips & advice let me know.


Many thanks


ATOMKA

Options: ReplyQuote
Re: PHP
Posted by: RiggsFolly (---.as43234.net)
Date: March 09, 2015 04:05PM

Are you sure the script source file has the .php extension?

---------------------------------------------------------------------------------------------
(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.