Jump to content

PHP displays well on webhost, but not on my localhost


Recommended Posts

Hi can somebody please advise me on what the problem is with my php installation, it is installed on Win XP Pro using IIS 5.1, PHP Version 5.2.3 with MySql 5.0.15. IIS is configured with ISAPI filter set to "C:\PHP\php5isapi.dll" and is loaded, mappings is set to ".php" with executable set as "C:\PHP\php5isapi.dll".

 

I am sure it has to do with my php.ini file, but I am a first time php user and I have searched all over the web and can't find any reason for this happening - this is what displays on my localhost, this is a screenshot of the portion of the affected page:

 

Localhost.GIF

 

This is what is displayed on my webhost (http://www.000webhost.com) of the same portion of the page, the script does not appear on the page, and it displays perfectly, so it is definitely not my code!

 

Public.GIF

 

Here is a link to my PHP settings (http://www.fileden.com/files/2008/3/12/1810634/PHP%20Config.rtf)

 

And here is a link to my php.ini file (http://www.fileden.com/files/2008/3/12/1810634/php.ini), can somebody please advise me on what could be the cause of the script showing up all over my php pages, this is driving me nuts, I can't do proper testing without having to edit live on my webhost which is time consuming...

 

Or could this possibly be due to something other than my php configuration because it can't be the code!  :-\

 

Many thanks

Grant

Link to comment
Share on other sites

have you added the .php types ?

AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps 

in the httpd.conf file ?

 

and are you using <?php instead of just <?  in your code ?

 

EDIT: extra info

 

Open the Apache configuration file in C:\Program Files\Apache Group\Apache2\conf\httpd.conf and check you have or add the following lines

LoadModule php4_module php/sapi/php4apache2.dll
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps

then restart apache

if your code had <? instead of <?php then you need to update your code

but for a quick fix, just edit the php.ini file and turn on short_open_tag

 

EDIT #2:

You have short tags on (so I don't think its a php.ini issue)

Link to comment
Share on other sites

MadTechie, I am not using Apache, I am using IIS 5.1 and yes, I am using <? instead of <?php, but short_open_tag is set to on, so it should still work! But it does not... ???

 

 

Fix your code to use <?php, its allot more portable that way.

Link to comment
Share on other sites

What does the following show (use the full <?php tag exactly as shown) -

 

<?php
phpinfo();
?>

 

And if it produces the correct phpinfo output, what is the actual runtime value listed for the short_open_tag setting?

 

Just because a setting is present in a php.ini, that does not mean anything if that php.ini is not the one the php is using. You must always check what a setting actually is using a phpinfo() statement.

 

And if you find that the short_open_tag setting is actually off, don't wasted any more of your time using short <? tags. The amount of time you have spent on this so far is several orders of magnitude more that what you saved leaving off the 'php' typing <? and the amount of time it would have taken you to search/replace through your code to change to <?php tags.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.