Solved

Website works on One server but not another

Posted on 2014-04-06
12
326 Views
Last Modified: 2014-04-26
We have a PHP based webpage that is currently running on a Windows 7 box with IIS7 Express. We need to move it to the new 2012 Server running II7.
The Webserver role and all the apps and functions are installed, as is PHP and MySQL. We have successfully moved another PHP based site to the new box and it runs without issue but the one in question will not load. When trying to browse the login page, the browser just spins on a white screen.

There are no errors popping up, nothing in the logs. Is there some sort of "gotcha" with Server 2012 or with moving a page from express to the full version of iis7? This is very frustrating! Thanks!
0
Comment
Question by:JP_TechGroup
  • 6
  • 4
  • 2
12 Comments
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39981458
PHP generally doesn't care about the version of the server, only about accessing needed resources.  Are you running the same version of PHP on both servers?  Have you moved the SQL Server and/or changed the SQL access coding?
0
 

Author Comment

by:JP_TechGroup
ID: 39981562
The MySQL database is still in the old location and the site is configured to point to it.
Same version of PHP... it is really odd. The other PHP site that does work was written by the same guy... the one that won't run is actually built on the same framework
0
 

Author Comment

by:JP_TechGroup
ID: 39981585
Turns out, I'm wrong. Neither of them work (which oddly makes me feel better)
The working site had binding information entered which directed back to the old site)
SO, slightly different question. PHP based site that simply tries to reload again and again... any ideas as to why?
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39981592
My first "guess" would be that the MySQL connection is for 'localhost' instead of the actual host.  Which means it will never connect on the new server.  Run 'phpinfo()' and see if that works to tell you what version and settings PHP is using on the new server.
0
 

Author Comment

by:JP_TechGroup
ID: 39981767
Mysql is configured to read from the remote server, firewall allows the port traffic, verified by Telnet. PHP version is the same on both boxes, 5.4 also confirmed.
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39981845
Mysql is configured to read from the remote server
For that to be true, you must have a user that is allowed to connect from either 'anyhost' (%) or that specific IP address.  You can't verify that with telnet.

MySQL users are defined by username, password, and connection.  The options are 'localhost', 'anyhost' (%), or a specific host IP address.  http://dev.mysql.com/doc/refman/5.1/en/adding-users.html
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:JP_TechGroup
ID: 39981945
Sorry, too much information in one sentence. Was not saying I had verified MySQL connection via telnet... however, mysql connection by the logon username for the server is confirmed...
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 39982116
Don't mean to be excessively picky about this but MySQL definitely is picky about it.  The correct username, password, and connection are all required.  Here is a simple logon script.  Fill in your details and run it on the new server.
<?php
// MySQLi Database Settings
// Include this at top of each php file, for central configuration.
$dbuser = 'username';
$dbpass = 'password';
$dbname = 'your-database';
$dbhost = 'MySQLHostIP-address-or-name';
// Opens a connection to a mySQL server
$link = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($link->connect_errno) {
    echo "Failed to connect to MySQL: (" . $link->connect_errno . ") " . $link->connect_error;
} else echo "Connection to MySQL succeeded.";

Open in new window

0
 
LVL 1

Expert Comment

by:Nicola Mackin
ID: 39982733
Try enabling php error reporting for all errors. This will show you any error generated by your php scripts including authentication errors.

Edit your php.ini file and search for error_reporting. Set the variable to be

error_reporting = E_ALL ^ E_NOTICE ^ E_WARNING

and thenrestart your webserver.

When you try to run your website it should now display all errors. Don't forget to set this back as E_ALL is a security risk on a production site.

Regards
Nicola
0
 

Accepted Solution

by:
JP_TechGroup earned 0 total points
ID: 39988840
Hehehehe...
Found it. How stupid.
in php.ini short_open_tags was set to off.
Changed to On and viola.
0
 
LVL 1

Expert Comment

by:Nicola Mackin
ID: 39988864
Well done!
0
 

Author Closing Comment

by:JP_TechGroup
ID: 40024337
This was the reason for the error.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
In this Micro Tutorial viewers will learn how to restore their server from Bare Metal Backup image created with Windows Server Backup feature. As an example Windows 2012R2 is used.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now