Forum Moderators: coopster

Message Too Old, No Replies

php installed on server, but php pages don't work

         

jcandil

3:00 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



I am somewhat experienced with HTML creating websites for personal use. Now I am delving into the world of php, but I have hit some immediate speed bumps.

My website is on a shared-hosting server. I contacted the support of the hosting company, and they said to me that they have php installed on the servers already. So, while learning php, I found a test page to see if the server has php installed or not. It is simply one line of code: <? phpinfo();?>. The website where I found this said that if you are prompted to download when visiting that test page, then the server does NOT have php installed. Interestingly enough, I AM prompted to download. Am I doing something wrong, or does my hosting company not know what they are talking about?

Thanks a bunch!

charlier

3:23 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



The servers parse the pages for php code based on the file extension or a specific page directive. Ask your hosting company what extentions are parsed by php.

figment88

3:41 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



to follow up on what charlier said, the most common extension is .php

If your one line of code resides in a file ending in .htm or .html it probably will not work.

jcandil

3:44 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



I named the test page "phpinfo.php". I asked the hosting company what extensions I should use, and they responded that .php would be fine. Is there something else that I'm missing?

jcandil

4:48 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



Might anyone suggest another simple test file to see if php is installed on the server I use?

Timotheos

4:57 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Can't get much simplier then that. One thing I would suggest is to use

<?php phpinfo();?>

instead of

<? phpinfo();?>

as the short tags might be disabled. I doubt that's the problem but other then that it should work.

jatar_k

4:58 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld jcandil,

That is the one commonly used but you could do something like

<?php
echo "This is php!";
?>

you may need the php php trailing the <?, you shouldn't but you never know.

jcandil

5:03 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



I used your example jatar, but when I try to visit that page, I am still prompted to download. This is very strange to me. It wouldn't be a problem with my browser (I use IE6), right? I have viewed php files before (duh) on the internet with no problem.

figment88

5:08 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



it is possible that your host has php installed on the server but not built as an Apache (or whatever server they are using) module.

In other words, if you were at the command line and typed php phpinfo.php it would work but the web server is not setup to execute php.