1

I tried using the link below but due to my lack of web admin skills I need to create a new thread to ask my question.

PHP code is not being executed, instead code shows on the page

Question: I am trying to create a php contacts form for my site; users click on the 'contact' link to open the form. I have placed the .php file in my website folder of my local computer(macbook) - see image attached. However, when I click on the contacts link from my home page, it spits out the code in the browser(similar to the screenshot preview pane) instead of displaying the contacts form.

Is this happening because I have no php engine installed on my mac? Many thanks in advance for your input.

folder structure screenshot on my Mac

tobe1424
  • 17
  • 1
  • 7
  • You should put the file in a webserver's folder under the document root, and the webserver should be running a php module. For local development you can install XAMP – Juan Dec 13 '17 at 04:24
  • Thank you Juan. I will setup xamp/wamp – tobe1424 Dec 13 '17 at 06:03

1 Answers1

1

You must access the file via your local server, like

http://localhost/omw/index.php

Not like

file:///C:/xampp/htdocs/omw/index.php
Mrigank Pawagi
  • 892
  • 1
  • 8
  • 26
  • I see what you are saying. Thank you. How should this be handled once it goes hosted; let's say on go daddy? – tobe1424 Dec 13 '17 at 06:04
  • It will be handled automatically when you will access the website via your domain. And PS Please accept my answer If it helped you. – Mrigank Pawagi Dec 13 '17 at 06:11