2

I am new to PHP and am trying to run my first script. I read that to to run php on your pc, you have run a server on it which I didn't feel like doing.

So instead I am trying to run it on a server hosted by Ipage.com

The program is just a basic html file with a set of full tags

I have tried linking windows explorer using ftp, using the "upload" button on the website and directly editing the file using the editer on the site. When ever I add the php tags and save or upload the file, when I go to view it on the ipage file manager, they are commented out

This is what happens to the file when I upload it

<!DOCTYPE html>
<html>
<title>Striations</title>
  <head> 

    <link href="css/LandingPageStyle.css" type="text/css" rel="stylesheet">
  </head>

<body>
    <!--?php echo "HELLO"; ?--> //originally <?php echo "HELLO"; ?>
    <h2>Our site is currently under construction, please check back later!</h2>
    <img src="media/construction man.png"></img>
</body>

</html>

I'm totally new to php and hosting and stuff and I could be missing some important step regarding how to run php

I'd appreciate and explanation of how php is transferred into html before being sent to the browser

EDIT:: I know as a fact that ipage supports php, they had mentioned something about changing my root file directory, but even when I moved my files to where they said, it did the same thing

Is there something else I should be doing to enable php?

Machavity
  • 30,841
  • 27
  • 92
  • 100
Andrew
  • 19
  • 3
  • Bad hosting provider. – Bogdan Burym Aug 17 '15 at 18:15
  • 1
    Does your webspace on Ipage.com support `PHP`? – mario.van.zadel Aug 17 '15 at 18:15
  • Have you enabled PHP? http://www.mywebsitetraining.com/details/ipage-php-info-configurationsettingsversion/ – Parker Aug 17 '15 at 18:15
  • I have iPage and have never had this happen... – Tim Aug 17 '15 at 18:22
  • @mario.klump ipage supports php. Is there something I have to do to make _my site_ recognize and run the script – Andrew Aug 17 '15 at 18:23
  • Does the name of your file end with .php? – Tim Aug 17 '15 at 18:23
  • @Tim did you do anything else besides just upload the file (i.e. save your files in the /home/users/web... directory like they said) – Andrew Aug 17 '15 at 18:25
  • It is an html file with php tags... I'm supposed to save it as .html, right? – Andrew Aug 17 '15 at 18:26
  • it was the file type, thanks @Tim – Andrew Aug 17 '15 at 18:30
  • 1
    I strongly recommend installing a small development server on your computer. It's surprisingly easy. Try XAMPP; it will work on any operating system, and it's pretty self-explanatory, and you don't need to worry about the quirks of various remote servers. It even has a few test scripts. You can get a full script running before you upload it. https://www.apachefriends.org/index.html – nomistic Aug 17 '15 at 18:39
  • 1
    @nomistic I had never heard of that before, I check it out. thanks! – Andrew Aug 19 '15 at 02:04

1 Answers1

1

It is an html file with php tags... I'm supposed to save it as .html, right?

If you saved this as index.html then the PHP parser won't run it by default. Either name it index.php or (if you can) use htaccess to parse HTML files as PHP

Community
  • 1
  • 1
Machavity
  • 30,841
  • 27
  • 92
  • 100