You are here:  » Moved to another host now only a blank page is being shown


Moved to another host now only a blank page is being shown

Submitted by formmailer on Fri, 2008-09-05 16:50 in

Hi David,

I hope you can help me with this issue.
I recently moved my website to a new host (bluehost.com) and now only a blank page shows up.

As a test, I used the most basic script available:

<?php
  
require("MagicParser.php");
  function 
myRecordHandler($record)
  {
    
// This is where you write your code to process each record, such as loading a database
    // You can display the record contents using PHP's internal print_r() function:
    
print_r($record);
    
// The following code will print out each field in your sample data:
    
print $record["PRODUCT"];
    print 
$record["PRODUCTID"];
    print 
$record["NAME"];
    print 
$record["PRICE"];
    print 
$record["PRICE-CURRENCY"];
    print 
$record["PRODUCTURL"];
    print 
$record["IMAGEURL"];
    print 
$record["DESCRIPTION"];
    print 
$record["CATEGORIES"];
    print 
$record["CATEGORIES/CATEGORY"];
    print 
$record["CATEGORIES/CATEGORY-PATH"];
    print 
$record["ADDITIONAL"];
    print 
$record["ADDITIONAL/FIELD"];
    print 
$record["ADDITIONAL/FIELD-NAME"];
    print 
$record["ADDITIONAL/FIELD@1"];
    print 
$record["ADDITIONAL/FIELD@1-NAME"];
    print 
$record["ADDITIONAL/FIELD@2"];
    print 
$record["ADDITIONAL/FIELD@2-NAME"];
    print 
$record["ADDITIONAL/FIELD@3"];
    print 
$record["ADDITIONAL/FIELD@3-NAME"];
    print 
$record["ADDITIONAL/FIELD@4"];
    print 
$record["ADDITIONAL/FIELD@4-NAME"];
    print 
$record["ADDITIONAL/FIELD@5"];
    print 
$record["ADDITIONAL/FIELD@5-NAME"];
  }
  
MagicParser_parse("http://www.visitstockholm.nl/feed/cache.php?id=CityZapper&cachetime=1440","myRecordHandler","xml|PRODUCTS/PRODUCT/");
  print 
MagicParser_getErrorMessage();
?>

File location: http://www.visitstockholm.nl/feed/test.php

As you can see I tried to get a MagicParser error message, but the page remains white. No php errors.

As you often pointed out that it could be a problem with opening URL's, I tried the following:

<?php
  $url 
"http://www.visitstockholm.nl/feed/cache.php?id=CityZapper&cachetime=1440";
  
$fp fopen($url,"r");
  if (!
$fp)
  {
    print 
"Could not open URL";
  }
?>

File: http://www.visitstockholm.nl/feed/test2.php

This results in a white page as well. No php errors either.

Information about the PHP setup:
http://www.visitstockholm.nl/feed/info.php

I hope you can give me some hints to fix this...

/Jasper

Submitted by support on Sat, 2008-09-06 15:10

Hi Jasper,

This is almost certainly because URL wrappers are not enabled on your new server; plus PHP being configured in "silent mode" so that error messages are not displayed. Please see the following thread for links and lots of information about enabling URL wrappers:

http://www.magicparser.com/node/189

It would also be worth trying your test script (test2.php) with error reporting turned up - to do this, add the following code to the top of your script:

  error_reporting(E_ALL);

Hope this helps...

Cheers,
David.

Submitted by formmailer on Sat, 2008-09-06 15:34

Hi David,

Adding error_reporting(E_ALL); didn't give more information.

I looked at the php info (http://www.visitstockholm.nl/feed/info.php) the "allow_url_fopen" is set to on, so this should work I suppose... but still no luck. :-(

Submitted by support on Sat, 2008-09-06 15:45

Hi Jasper,

Could you do a couple of quick tests to confirm that it is fopen() that is causing the problem.

Firstly, try opening a different URL, for example the BBC News RSS feed:

<?php
  $url 
"http://newsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml";
  
$fp fopen($url,"r");
  if (!
$fp)
  {
    print 
"Could not open URL";
  }
?>

If that does work, then it would imply that the problem is something to do with PHP making an HTTP connection to the localhost - as I notice you are running this script on the same server as the URL you are trying to open. This could indicate that it is some kind of firewall or routing problem, so you would need to contact your hosting companies support to see if they can confirm / resolve this for you...

However, if the same problem exists; try simply commenting out the fopen() line and running the script again. It should just drop straight through to print out "Could not open URL". If this is the case, confirming fopen()'ing a URL as the problem it would be worth putting a call into your hosting companies support (perhaps email them your test script) as they will be able to check it out with the knowledge of your servers configuration...

Cheers,
David.

Submitted by formmailer on Sat, 2008-09-06 16:20

Hi David,

Did a few tests:

1. The BBC url: same result, blank page
2. Commented out the fopen line: Message Could not open URL displayed
3. Changed the BBC url to something that doesn't exist. I got the following:
Warning: fopen() [function.fopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/xxx/public_html/visitstockholm/feed/test3.php on line 3

Warning: fopen(http://n3ewsrss.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml) [function.fopen]: failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/xxx/public_html/visitstockholm/feed/test3.php on line 3
Could not open URL

Would this still indicate a problem with the fopen?

/Jasper

Submitted by support on Sat, 2008-09-06 16:26

Hi Jasper,

Yes - however what that is implying is that the problem occurs at some point after PHP has obtained the network address (so DNS resolution is working)...

It's certainly worth putting a call in to your hosting support contact, and i'll have a look into the inner workings of fopen() and see if anything stands out as a possible cause - although it is almost certainly something "wrong" with the PHP installation...

Cheers,
David.

Submitted by formmailer on Sat, 2008-09-06 20:18

I opened a support ticket and will let you know the outcome.

Thanks for your help!

/Jasper

Submitted by websuperman on Mon, 2009-03-30 15:45

Sorry to bring this back from the dead, but I am having a similar issue, did the above checking, same outcomes. I think the problem is related to suPHP but can't be sure, I know it worked prior to this being enabled. Anyone have further insight into this?

Submitted by support on Mon, 2009-03-30 17:25

Hi,

If the BBC test script displays nothing, rather then the "Could not open ..." message, that basically means that PHP (or suPHP) has crashed attempting to fopen(), rather than fopen() failing.

Could you perhaps run a phpinfo() as follows:

<?php
  phpinfo
();
?>

...and have a look at the Configuration - PHP Core section for the allow_url_fopen settings - and check that it is ON, as it is possible the suPHP disables this setting overriding PHP's default values...

Cheers,
David.