Jump to:

5539 Posts in 1738 Topics by 1224 members

Customising the CMS

SilverStripe Forums » Customising the CMS » Error when sharing site content with Facebook

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2303 Views
  • nzpete
    Avatar
    Community Member
    4 Posts

    Error when sharing site content with Facebook Link to this post

    I've recently put a client's SilverStripe website live (http://www.neonsleep.com/); developing it was a dream with SilverStripe, thank you for open-sourcing such a great piece of software!

    I have one unresolved issue, to do with sharing content with Facebook (through an AddThis button). About 50 percent of the time, it works fine, Facebook downloads the shared page OK and finds the appropriate image to share. The other 50 percent, SilverStripe errors when Facebook tries to access the page, and the summary it comes up with instead is:

    : syntax error, unexpected T_STATIC, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /www/virtual/neonsleep.com/htdocs/sapphire/core/ManifestBuilder.php on line 35

    It appears it doesn't like the declaration 'static $restrict_to_modules = array();', the first thing in the ManifestBuilder class (I'm using v2.2.2). When a page refuses to load, it will keep doing it unless the URL to share is changed by adding a slash at the end - sometimes that fixes it.

    An example of a page that doesn't load is: http://www.neonsleep.com/dandeacon/19
    One that successfully loads: http://www.neonsleep.com/dandeacon/20

    I can't find any method to the madness. Has anyone else had problems with sharing Facebook content?

    Thanks!

    Peter

  • nzpete
    Avatar
    Community Member
    4 Posts

    Re: Error when sharing site content with Facebook Link to this post

    I did some logging of the requests from Facebook, I've found out some more info. They appear to have two servers that do the external requests, 69.63.178.250 that executes requests successfully from www.neonsleep.com, and 69.63.178.247 which always fails with the error above. I dumped the contents of $_REQUEST and $_SERVER, and the servers differ slightly in their requests:

    .250 (the working server), sends requests like:

    $_REQUEST['url'] = /doilookthin/30
    $_SERVER[REDIRECT_STATUS] = 200
    $_SERVER[HTTP_USER_AGENT] = facebookexternalhit/1.0 (+http://www.facebook.com/externalhit_uatext.php)
    $_SERVER[HTTP_ACCEPT_ENCODING] = gzip
    $_SERVER[HTTP_HOST] = www.neonsleep.com
    $_SERVER[HTTP_ACCEPT] = text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    $_SERVER[HTTP_CONNECTION] = keep-alive
    $_SERVER[CONTENT_TYPE] = application/x-www-form-urlencoded
    $_SERVER[PATH] = /usr/local/apache_php5/sbin:/usr/bin:/bin
    $_SERVER[SERVER_SIGNATURE] =
    $_SERVER[SERVER_SOFTWARE] = Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8c PHP/5.2.4
    $_SERVER[SERVER_NAME] = www.neonsleep.com
    $_SERVER[SERVER_ADDR] = 60.234.4.41
    $_SERVER[SERVER_PORT] = 80
    $_SERVER[REMOTE_ADDR] = 69.63.178.250
    $_SERVER[DOCUMENT_ROOT] = /www/virtual/neonsleep.com/htdocs
    $_SERVER[SERVER_ADMIN] = webmaster@neonsleep.com
    $_SERVER[SCRIPT_FILENAME] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[REMOTE_PORT] = 36769
    $_SERVER[REDIRECT_QUERY_STRING] = url=/doilookthin/30
    $_SERVER[REDIRECT_URL] = /doilookthin/30
    $_SERVER[GATEWAY_INTERFACE] = CGI/1.1
    $_SERVER[SERVER_PROTOCOL] = HTTP/1.1
    $_SERVER[REQUEST_METHOD] = GET
    $_SERVER[QUERY_STRING] = url=/doilookthin/30
    $_SERVER[REQUEST_URI] = /doilookthin/30
    $_SERVER[SCRIPT_NAME] = /sapphire/main.php
    $_SERVER[REQUEST_TIME] = 1236809221
    $_SERVER[argv] = Array
    $_SERVER[argc] = 1

    .247 (the non-working server), sends requests like:

    $_REQUEST['url'] = /doilookthin/20
    $_SERVER[REDIRECT_UNIQUE_ID] = HNk2xKwQZC0AADLIgbQAAABF
    $_SERVER[REDIRECT_STATUS] = 200
    $_SERVER[UNIQUE_ID] = HNk2xKwQZC0AADLIgbQAAABF
    $_SERVER[HTTP_USER_AGENT] = facebookexternalhit/1.0 (+http://www.facebook.com/externalhit_uatext.php)
    $_SERVER[HTTP_ACCEPT_ENCODING] = gzip
    $_SERVER[HTTP_HOST] = www.neonsleep.com
    $_SERVER[HTTP_ACCEPT] = text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    $_SERVER[HTTP_CONNECTION] = keep-alive
    $_SERVER[CONTENT_TYPE] = application/x-www-form-urlencoded
    $_SERVER[PATH] = /usr/local/bin:/usr/bin:/bin
    $_SERVER[SERVER_SIGNATURE] = <address>Apache/2.2.3 (Debian) PHP/4.4.7 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.neonsleep.com Port 80</address>

    $_SERVER[SERVER_SOFTWARE] = Apache/2.2.3 (Debian) PHP/4.4.7 mod_ssl/2.2.3 OpenSSL/0.9.8c
    $_SERVER[SERVER_NAME] = www.neonsleep.com
    $_SERVER[SERVER_ADDR] = 219.88.240.130
    $_SERVER[SERVER_PORT] = 80
    $_SERVER[REMOTE_ADDR] = 69.63.178.247
    $_SERVER[DOCUMENT_ROOT] = /www/virtual/neonsleep.com/htdocs
    $_SERVER[SERVER_ADMIN] = webmaster@neonsleep.com
    $_SERVER[SCRIPT_FILENAME] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[REMOTE_PORT] = 43559
    $_SERVER[REDIRECT_QUERY_STRING] = url=/doilookthin/20
    $_SERVER[REDIRECT_URL] = /doilookthin/20
    $_SERVER[GATEWAY_INTERFACE] = CGI/1.1
    $_SERVER[SERVER_PROTOCOL] = HTTP/1.1
    $_SERVER[REQUEST_METHOD] = GET
    $_SERVER[QUERY_STRING] = url=/doilookthin/20
    $_SERVER[REQUEST_URI] = /doilookthin/20
    $_SERVER[SCRIPT_NAME] = /sapphire/main.php
    $_SERVER[PATH_TRANSLATED] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[argv] = Array
    $_SERVER[argc] = 1

    I've tried contacting Facebook for help, but of course it's impossible to get any support out of a business that large.

  • nzpete
    Avatar
    Community Member
    4 Posts

    Re: Error when sharing site content with Facebook Link to this post

    I did some logging of the requests from Facebook, I've found out some more info. They appear to have two servers that do the external requests, 69.63.178.250 that executes requests successfully from www.neonsleep.com, and 69.63.178.247 which always fails with the error above. I dumped the contents of $_REQUEST and $_SERVER, and the servers differ slightly in their requests:

    .250 (the working server), sends requests like:

    $_REQUEST = /doilookthin/30
    $_SERVER[REDIRECT_STATUS] = 200
    $_SERVER[HTTP_USER_AGENT] = facebookexternalhit/1.0 (+[url=http://www.facebook.com/externalhit_uatext.php]http://www.facebook.com/externalhit_uatext.php
    )
    $_SERVER[HTTP_ACCEPT_ENCODING] = gzip
    $_SERVER[HTTP_HOST] = www.neonsleep.com
    $_SERVER[HTTP_ACCEPT] = text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    $_SERVER[HTTP_CONNECTION] = keep-alive
    $_SERVER[CONTENT_TYPE] = application/x-www-form-urlencoded
    $_SERVER[PATH] = /usr/local/apache_php5/sbin:/usr/bin:/bin
    $_SERVER[SERVER_SIGNATURE] =
    $_SERVER[SERVER_SOFTWARE] = Apache/2.2.4 (Unix) mod_ssl/2.2.4 OpenSSL/0.9.8c PHP/5.2.4
    $_SERVER[SERVER_NAME] = www.neonsleep.com
    $_SERVER[SERVER_ADDR] = 60.234.4.41
    $_SERVER[SERVER_PORT] = 80
    $_SERVER[REMOTE_ADDR] = 69.63.178.250
    $_SERVER[DOCUMENT_ROOT] = /www/virtual/neonsleep.com/htdocs
    $_SERVER[SERVER_ADMIN] = webmaster@neonsleep.com
    $_SERVER[SCRIPT_FILENAME] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[REMOTE_PORT] = 36769
    $_SERVER[REDIRECT_QUERY_STRING] = url=/doilookthin/30
    $_SERVER[REDIRECT_URL] = /doilookthin/30
    $_SERVER[GATEWAY_INTERFACE] = CGI/1.1
    $_SERVER[SERVER_PROTOCOL] = HTTP/1.1
    $_SERVER[REQUEST_METHOD] = GET
    $_SERVER[QUERY_STRING] = url=/doilookthin/30
    $_SERVER[REQUEST_URI] = /doilookthin/30
    $_SERVER[SCRIPT_NAME] = /sapphire/main.php
    $_SERVER[ PHP_SELF ] = /sapphire/main.php
    $_SERVER[REQUEST_TIME] = 1236809221
    $_SERVER[argv] = Array
    $_SERVER[argc] = 1

    .247 (the non-working server), sends requests like:

    $_REQUEST = /doilookthin/20
    $_SERVER[REDIRECT_UNIQUE_ID] = HNk2xKwQZC0AADLIgbQAAABF
    $_SERVER[REDIRECT_STATUS] = 200
    $_SERVER[UNIQUE_ID] = HNk2xKwQZC0AADLIgbQAAABF
    $_SERVER[HTTP_USER_AGENT] = facebookexternalhit/1.0 (+[url=http://www.facebook.com/externalhit_uatext.php]http://www.facebook.com/externalhit_uatext.php
    )
    $_SERVER[HTTP_ACCEPT_ENCODING] = gzip
    $_SERVER[HTTP_HOST] = www.neonsleep.com
    $_SERVER[HTTP_ACCEPT] = text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    $_SERVER[HTTP_CONNECTION] = keep-alive
    $_SERVER[CONTENT_TYPE] = application/x-www-form-urlencoded
    $_SERVER[PATH] = /usr/local/bin:/usr/bin:/bin
    $_SERVER[SERVER_SIGNATURE] = <address>Apache/2.2.3 (Debian) PHP/4.4.7 mod_ssl/2.2.3 OpenSSL/0.9.8c Server at www.neonsleep.com Port 80</address>

    $_SERVER[SERVER_SOFTWARE] = Apache/2.2.3 (Debian) PHP/4.4.7 mod_ssl/2.2.3 OpenSSL/0.9.8c
    $_SERVER[SERVER_NAME] = www.neonsleep.com
    $_SERVER[SERVER_ADDR] = 219.88.240.130
    $_SERVER[SERVER_PORT] = 80
    $_SERVER[REMOTE_ADDR] = 69.63.178.247
    $_SERVER[DOCUMENT_ROOT] = /www/virtual/neonsleep.com/htdocs
    $_SERVER[SERVER_ADMIN] = webmaster@neonsleep.com
    $_SERVER[SCRIPT_FILENAME] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[REMOTE_PORT] = 43559
    $_SERVER[REDIRECT_QUERY_STRING] = url=/doilookthin/20
    $_SERVER[REDIRECT_URL] = /doilookthin/20
    $_SERVER[GATEWAY_INTERFACE] = CGI/1.1
    $_SERVER[SERVER_PROTOCOL] = HTTP/1.1
    $_SERVER[REQUEST_METHOD] = GET
    $_SERVER[QUERY_STRING] = url=/doilookthin/20
    $_SERVER[REQUEST_URI] = /doilookthin/20
    $_SERVER[SCRIPT_NAME] = /sapphire/main.php
    $_SERVER

    = /sapphire/main.php
    $_SERVER[PATH_TRANSLATED] = /www/virtual/neonsleep.com/htdocs/sapphire/main.php
    $_SERVER[argv] = Array
    $_SERVER[argc] = 1

    I've tried contacting Facebook for help, but of course it's impossible to get any support out of a business that large.

  • Sam
    Avatar
    Administrator
    679 Posts

    Re: Error when sharing site content with Facebook Link to this post

    Errors of this kind are often a sign that PHP4 is running instead of PHP5.

  • nzpete
    Avatar
    Community Member
    4 Posts

    Re: Error when sharing site content with Facebook Link to this post

    Aha, thank you, that's exactly what's happening. Now I just have to figure out why the server is reverting to 4.4.7 on certain requests.

    2303 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.