Fatal Error : Only variables can be passed by reference

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Fatal Error : Only variables can be passed by reference

Postby alicemcline » 15. September 2009 10:53

i am having troubles with socket programming .. :S
i am kind of confused and unable to locate error in the following code..

Code: Select all
19 $socket = fsockopen($host, 80, $errnum, $errstr, 30);
20 if ($socket === false)
21 {
22     echo 'Error ' . $errnum . ' : ' . $errstr;
23     return false;
24 }

i have $host defined.. line nos. are as shown..

i get following error ..

Fatal error: Only variables can be passed by reference in C:\.....\index.php on line 19

please help.. as i am unable to understand what mistake i have made.. :(
Posts: 10
Joined: 10. July 2009 06:56

Re: Fatal Error : Only variables can be passed by reference

Postby dmphotography » 15. September 2009 16:18

Well, the first mistake is you're posting in the XAMPP forum, which is made to support XAMPP, asking for help on how to code PHP.
This isn't the correct forum for that.

Secondly, you're posting in a Windows forum and my guess is you're trying to run this script on a Windows server, which won't work since Windows doesn't use sockets.

Sockets pertain to Unix/Linux machines, not Windows. In Windows, it's only ports.
Here's more info on that PHP function: http://www.php.net/manual/en/function.fsockopen.php

On line 20, you also have too many "=" signs. It should only be two and you have three.

Once again, not the place for this.
For great video and written tutorials and guides on creating your own web server and installing things such as forums, blogs, etc., visit http://myownhomeserver.com
Posts: 191
Joined: 15. December 2008 14:25
Location: Columbus, MS
Operating System: Windows 7

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 58 guests