Friday, October 30, 2009

PHP syntax shows up blank....why?

I%26#039;m new to PHP and MySQL and I%26#039;m trying to get a basic test to work. I can see the html but the PHP does not appear. I know how to save it in php format and upload it to my website, but I still get a blank screen when I visit that page. Any suggestions or ideas of what the problem might be? Do I have to put it in a certain spot on my website? I%26#039;m using Yahoo as my web host.



syntax:



%26lt;html%26gt;



%26lt;head%26gt;



%26lt;title%26gt;PHP Test%26lt;/title%26gt;



%26lt;/head%26gt;



%26lt;body%26gt;



%26lt;p%26gt;This is an HTML line



%26lt;p%26gt;



%26lt;?php echo %26quot;This is a PHP line%26quot;;



phpinfo();



?%26gt;



%26lt;/body%26gt;



%26lt;/html%26gt;



PHP syntax shows up blank....why?





1. Make sure the webserver supports php



2. Make sure your file extension is php and not html (apache doesn%26#039;t parse html for php by default)



This shouldn%26#039;t be an issue with php, for for correctness, you should add end paragraph tags (%26lt;/p%26gt;).



Other than that, it looks all right, so it must be one of the first two suggestions.



PHP syntax shows up blank....why?



Well the first question should be: is php running on the webserver? If php is not running it can not parse your file and generate output.



Other Replys:Maybe Yahoo does not support php scripting. I put your script on my website and it works fine - see http://ccgi.origamimark.co.uk/test001.ph...



Other Replys:If that web page doesn%26#039;t work on your web server and you%26#039;ve made sure it%26#039;s saved as a .php file, then you most probably don%26#039;t have PHP running on whatever hosting service you%26#039;re using.



The simplest way to make sure php works is to make a file like so:



%26lt;?



echo %26quot;Hello World%26quot;;



?%26gt;



And save that as test.php. Then access it through the web and see what happens. I%26#039;m not educated in yahoo%26#039;s web hosting but if you can get to a command prompt, you can also type %26quot;php%26quot; to see if it%26#039;s installed.

No comments:

Post a Comment