Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 924
  • Last Modified:

Moving of servers- Apache PHP4 to IIS7 and PHP 5 - code showing?

I am moving some old webservers we have over to new hardware and new systems, since our past guy left some time ago.

i am an IIS man personally, we host many sites and i just prefer IIS and it's header abilities and interface.

Anyways.

we have a customer service system which is currently running under:

Windows Server 2003 x32 SP1
Apache 2.0.53
PHP 4.3.10


The new system is

Windows Server 2008 Web Edition x64
IIS 7
PHP 5.2.6 running under ISAPI mode


Upon testing out some pages, it seems some tags or something aren't being properly read and the result is code showing after certain items, i have attached 2 images (some text seems weird as i blocked it out) but you can clerly see the code showing, when it shouldnt..

is this something with the settings on the PHP file, or how IIS is serving out the pages?

i have global variables on under the php.ini, unfortunately the past coder coded with that on (working on that next) other then that the php.ini is default settings except for setting the ext directory.

All help is greatly appreciated!
apache.JPG
iis7.JPG
0
Mathiau
Asked:
Mathiau
  • 22
  • 12
5 Solutions
 
MikealclCommented:
ditch the ISAPI mode and use FAST-CGI.




0
 
MikealclCommented:
http://www.trainsignaltraining.com/iis-7-install-fastcgi-php/2008-09-04/

Can't find the notes I kept from my last install but this website looks decent.
0
 
MikealclCommented:
Oh and you might have to enable the short tagging too i always forget to change that.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
MathiauAuthor Commented:
do you think it is the ISAPI mode causing it?

guess i can test and find out :D, so used to using the ISAPI mode.
0
 
MikealclCommented:
I had issues with ISAPI in 2k8, but when I went to find answers online everyone told me FASTCGI was the way to go.

It's worked great for me so far, and you get a performance increase.
0
 
MathiauAuthor Commented:
trying it out now! will let you know how it goes in a few minutes, great guide on that site
0
 
MathiauAuthor Commented:
so i got fastCGi in and php info works, now i need to add mysql support, but the ini has no area to uncomment dll files for mysqli, it seems the mysql is built into the php file... but the pages aren't working for me (had them working with ISAp)
0
 
MathiauAuthor Commented:
re-ra the installer and added the mysql ext from the installer :D
0
 
MikealclCommented:
Cool so you got everything fixed up now?
0
 
MathiauAuthor Commented:
i decided to reformat the system and put in the .exe for now, get ride of all the lingering messing around i did.

just rebooted, got everything installed,php works, shows mysql and mysqli installed but now i get a massive line of text with errors on it L:( about prasing errors and i followed that guide to a T, enabled global variables :(

at least with the ISAPI module i could get the pages to show and work, just showed the code after it :(
0
 
MathiauAuthor Commented:
Now i get 500 internal server error trying to load a page in a sub directory of the root... 500 usually permission problems isnt it
0
 
MathiauAuthor Commented:
well it isn't a permission issue on the sub folders as i can view image files fine with out any errors....

http://localhost

then i have

http://localhost/csis/
http://localhost/csis/images

0
 
MikealclCommented:
You want to enable the better error messages

http://blogs.iis.net/rakkimk/archive/2008/10/03/iis7-enabling-custom-error-pages.aspx

Let me know what it says with the errors enabled.
0
 
MikealclCommented:
Did you set the default document?
0
 
MathiauAuthor Commented:
i am using a direct URL to the file


http://localhost/csis/index.php

enabling the better errors now!


the help is really appreciated Mikealcl! i was going at this for about 5 hours before i even posted on here  :D
0
 
MikealclCommented:
I did this all last summer.  Little painful but I like iis7 much better.

Few of my other notes I found on my blog. http://tech.mikeal.com/blog1.php/2008/08/


0
 
MathiauAuthor Commented:
okay so i turned those on, seems some html file was missing it was looking for, i added the HTML file and now i am back to where i was with the code showing again after words like my original post :(
iis7.JPG
0
 
MathiauAuthor Commented:
now taking out the .html file again i noticed 2 other errors
PHP Warning:  fgets(): supplied argument is not a valid stream resource in D:\wwwroot\csis\index.php on line 2364
PHP Warning:  fclose(): supplied argument is not a valid stream resource in D:\wwwroot\csis\index.php on line 2365

Open in new window

0
 
MikealclCommented:
Did you register .php files in IIS?

That post almost looks like its just processing it like html
0
 
MathiauAuthor Commented:
yes, if i put back the HTML file, i can access the main index.php page, but with that code showing, i can search for accounts and such and get the info, so the php is working, also php info test script i did also works showing all the info for php.

0
 
MikealclCommented:
Did you enable short tags "?>" instead of php> in the php.ini???
0
 
MathiauAuthor Commented:
that i didnt! trying now!
0
 
MathiauAuthor Commented:
enabled short tags, rebooted server, now i get the 500 server error again :(

leaving work now, but will keep trying on this from home.
0
 
MathiauAuthor Commented:
so back at work testing some things out, and so far no, go, turning short tags on and off cause it to work then not work.
0
 
MathiauAuthor Commented:
So just did this

i did a find and replace and replaced all instances of <? with <?php

now getting these errors and nothign else on the page, so checking the files to see what the problem is


PHP Notice:  Undefined variable: status in D:\wwwroot\csis\index.php on line 1894
PHP Notice:  Undefined variable: auth in D:\wwwroot\csis\index.php on line 1913
PHP Notice:  Undefined variable: auth in D:\wwwroot\csis\index.php on line 1932

Open in new window

0
 
MathiauAuthor Commented:
okay, not what i was hoping to see as doesnt make sense to me

line 1894          </table></td>
line 1913            print("<TR><TD>");
line 1932                  print("<LI><FONT COLOR=\"#000000\" FACE=\"Verdana\" STYLE=\"font-size: 8pt\"><a href=\"index.php?hostnote=MYNOTES\" target=\"_self\" title=\" notes I have done in the last 24 hours\">My Notes</a></font> ");

now the notes part should work.... is some tag possibly missing? in the first 2 lines i dont see any variable that would be need to be defined.
0
 
MikealclCommented:
did you forget to also replace ?> with php?> ??


0
 
MathiauAuthor Commented:
are you supposed to do that.

i have a php test script and if i change the ending ?> to php?> i get errors


first bit works fine

<html>
<head>
<title> PHP Test Script </title>
</head>
<body>
<?php
phpinfo();
?>
</body>
</html>


if i change it to php?> i the this error

PHP Notice:  Use of undefined constant php - assumed 'php' in D:\wwwroot\phpinfo.php on line 8

so i assume your only supposed to use the php on the first section
0
 
MikealclCommented:
hmm I'm not sure I always use short tags.


0
 
MathiauAuthor Commented:
i am going to try and install apache wit php5 and see if the same problem occurs or not.
0
 
MathiauAuthor Commented:
okay, well some progress

with apache 2.2 and php 5..

i loaded up a page and it had the same issues as IIS, so it seems it is not server based.

I looked up the code on one page and the first part has

<?php

then some code

then he has a section php part, but it starts with

<?

changing the <? to <?php on this page resolved the showing code!

so i am now going to check on the main page to see what line i can edit to make the code dissappear! wish me luck!
0
 
MathiauAuthor Commented:
woo hoo, replaced one further down and the code that was showing isnt, so far, going to install IIS now and set that up again and see if the results are the same!
0
 
MathiauAuthor Commented:
well seems i cant get it to work under IIS7 now at all, so i may have to stick with apache on this one, as long as i can figure out headers and such, i should be "okay"
0
 
MathiauAuthor Commented:
mike gave me great info on learning IIS7, and great links which got me going in a good direction, when i have more free time i will be sure to conquer this matter!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 22
  • 12
Tackle projects and never again get stuck behind a technical roadblock.
Join Now