Problem with fwrite() since 0.4.3

Hello Piwik-community,

the first thing I have to say: Piwik is a very nice tool.

Now, I have a problem with the tool.
Yesterday I updated to the newest version and it worked fine.
But today I always receive following failure while entering the tool:

fwrite() expects parameter 1 to be resource, null given 
 in '/users/jmp/www/piwik/core/Piwik.php' at the line 999

There are also some more lines, but I hope that this is enough.

I hope that you can help me.

Thanks!

What do you have set for “disable_functions” in php.ini?

In core/Piwik.php, at line 985, change:

if (($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) === false)

to:

if (($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) === false
        || !is_resource($fsock))

[quote=vipsoft @ Aug 12 2009, 02:28 PM) <{POST_SNAPBACK}>

What do you have set for “disable_functions” in php.ini?
 disk_free_space, diskfreespace, disk_total_space, dl, error_log, exec,  fsockopen, get_current_user, getrusage, leak, link, openlog, passthru,  pfsockopen, popen, proc_close, proc_get_status, proc_nice, proc_open,  proc_terminate, shell_exec, symlink, syslog, system
QUOTE (vipsoft @ Aug 12 2009, 02:33 PM]In core/Piwik.php, at line 985, change:
if (($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) === false)

to:

if (($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) === false
           || !is_resource($fsock))

[/quote]

okay, thanks. I will try this solution.

Because your system has been “crippled”, you won’t be able to receive update notifications, perform one-click updates, receive newsletters or email notifications (i.e., if you opted in on the installation/set-up screen), …

yes, this is the other side of the coin using free webspace.

I disabled these options in the installation (I tried to make a new installation).
With this condition change I can now run the setup until:

Error while connecting to: api.piwik.org. Please try again later.Backtrace:
#0 /users/jmp/www/piwik/core/UpdateCheck.php(35): Piwik::sendHttpRequest('http://api.piwi...', 2) #1 /users/jmp/www/piwik/core/FrontController.php(237): Piwik_UpdateCheck::check() #2 /users/jmp/www/piwik/index.php(64): Piwik_FrontController->init() #3 {main}

Is this because the script wants to use a disabled function or is there really a
connection error (I do not think so)?

I fixed the problem.
I just commented the two mentioned lines out.

Maybe the next Piwik version should include restrictions to prevent these failures…

Thank you.

It will. Already fixed in svn.