Page 1 of 1

Test FSOCKENOPEN causes 500 error

Posted: Mon Apr 13, 2009 5:11 pm
by Sonya
Trying to install CMS Made Simple on customer hosting, I have got error 500 on step 2 (checking environment settings).

While debugging I have figured out that the function testRemoteFile() in /lib/test.functions.php causes it. The problem is on this special hosting is that if the call below fails, it returns NULL and not FALSE as described in docs http://de.php.net/manual/en/function.fsockopen.php

Code: Select all

@fsockopen($scheme . $url_info['host'], $port, $errno, $errstr, $timeout);
if(false !== $handle)
	{
In the second line the script checks if $handle is false and the installation is aborted with 500 error, since $handle is not FALSE but NULL. I have replaced the condition with if(false != $handle) and the installation was successful. Module Manager does not work due to the remote check failure (as expected), but all other fuctions are OK.

Server settings from admin panel immediately after installation
----------------------------------------------

Cms Version: 1.5.3

Installed Modules:

    * CMSMailer: 1.73.14
    * FileManager: 0.4.5
    * MenuManager: 1.5.3
    * ModuleManager: 1.2.1
    * News: 2.9.3
    * nuSOAP: 1.0.1
    * Printing: 0.2.6
    * Search: 1.5.3
    * ThemeManager: 1.1.0
    * TinyMCE: 2.4.13


Config Information:

    * php_memory_limit:
    * process_whole_template: false
    * max_upload_size: 10000000
    * default_upload_permission: 664
    * assume_mod_rewrite: false
    * page_extension:
    * internal_pretty_urls: false
    * use_hierarchy: false


Php Information:

    * phpversion: 5.2.5
    * md5_function: On (True)
    * gd_version: 2
    * tempnam_function: On (True)
    * magic_quotes_runtime: Off (False)
    * memory_limit: 32M
    * max_execution_time: 30
    * safe_mode: Off (False)
    * session_save_path: /tmp (1777)


Server Information:

    * Server Api: cgi
    * Server Db Type: MySQL (mysql)
    * Server Db Version: 4.1.18


----------------------------------------------

Can someone see if it worth to correct the issue in the core? Thank you!

EDIT: allow_url_fopen seems to be disabled on this hosting

Re: Test FSOCKENOPEN causes 500 error

Posted: Mon Apr 13, 2009 5:53 pm
by alby
Sonya wrote: Trying to install CMS Made Simple on customer hosting, I have got error 500 on step 2 (checking environment settings).

While debugging I have figured out that the function testRemoteFile() in /lib/test.functions.php causes it. The problem is on this special hosting is that if the call below fails, it returns NULL and not FALSE as described in docs http://de.php.net/manual/en/function.fsockopen.php

Code: Select all

@fsockopen($scheme . $url_info['host'], $port, $errno, $errstr, $timeout);
if(false !== $handle)
	{
In the second line the script checks if $handle is false and the installation is aborted with 500 error, since $handle is not FALSE but NULL. I have replaced the condition with if(false != $handle) and the installation was successful. Module Manager does not work due to the remote check failure (as expected), but all other fuctions are OK.
Sorry but I read FALSE and not NULL
Can you test with a var_dump($handle) for check your exact return?

Alby

Re: Test FSOCKENOPEN causes 500 error

Posted: Mon Apr 13, 2009 5:59 pm
by Sonya
Hello alby,

yes, it is NULL and not FALSE. I have checked it with var_dump($handle). I think it is due to disabled allow_url_open (it is sure disabled, I have asked).

Additionally, in line 1161

Code: Select all

getTestReturn($test, $required, '', '', lang('connection_error'));
The message, that Module Manager will not work, does not appear. I think, it should be:

Code: Select all

getTestReturn($test, $required, lang('connection_error'), '', lang('connection_error'));
Thank you!
Sonya

Re: Test FSOCKENOPEN causes 500 error

Posted: Mon Apr 13, 2009 6:36 pm
by alby
Sonya, can you look your server error logs? 500 report always in http logs

Alby

Re: Test FSOCKENOPEN causes 500 error

Posted: Mon Apr 13, 2009 6:58 pm
by Sonya
alby wrote: Sonya, can you look your server error logs? 500 report always in http logs

Alby
Unfortunately not :( I have no access to the logs. It's a low budget hosting :(