Forum Moderators: coopster

Message Too Old, No Replies

php that says if game server is on-line

a nedd help, im getting an error.

         

Zenden

10:12 pm on Mar 31, 2005 (gmt 0)

10+ Year Member



ok, i did a script that says if a game server is on line, how many players playing and for how long it has been on.

here is the code

[CODE/]<?

set_time_limit ( '0' );
error_reporting ( E_ERROR ¦ E_PARSE );

$_ip = 'otserv.org';
$_port = '7171';

$s = socket_create( AF_INET, SOCK_STREAM, getprotobyname ( 'tcp' ) );

<snipped irrelevant code>

?>[CODE/]

but when i enter it i got the following error

Fatal error: Call to undefined function: socket_create() in c:\apache group\apache\htdocs\on2.php on line 12

can some1 help me?
but when i enter it i got the following error

[edited by: coopster at 1:32 pm (utc) on April 1, 2005]
[edit reason] snipped irrelevant code [/edit]

mcibor

10:44 am on Apr 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



To say the truth I got the same error on your function, however I got it also on the function provided at www.php.net. I thought it migth be a problem with php version (PHP 4 >= 4.1.0, PHP 5), but I have PHP 4.3.8.

I read on google that you may not have installed the sockets. Try phpinfo(), there you can see your installed components. I hope that helps a bit.

BTW Welcome to Webmasterworld :)

Best wishes

Michal Cibor

[edited by: coopster at 11:00 pm (utc) on April 1, 2005]
[edit reason] My Polish isn't very good, Michal ;-) [/edit]

Zenden

4:28 pm on Apr 1, 2005 (gmt 0)

10+ Year Member



tnx man,
i got the mysql.default_socket but it has no value
wat should i do?

mcibor

11:40 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dear Zenden!

mysql is irrelevant in this case. You need to have a php-sockets extension installed. I found an rpm at

[rpms.troels.arvin.dk...]

However they say that it's out of date, so if you find a newer somewhere just install it.

BTW (by the way) Translate all Polish variables in your code to English, so others will also understand you, and as Coopster said, don't paste irrelevant code.

Thanks and hope it helps you
Best regards
Michal Cibor

coopster

11:51 am on Apr 2, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Michal is stating that it seems you are missing the socket functions because they are not compiled into your installation.


Installation

The socket functions described here are part of an extension to PHP which must be enabled at compile time by giving the --enable-sockets option to configure.

Resource:
[php.net...]

Michal also stated that by running the phpinfo() function you can view your Configure Command and installation directives. Search the page that is displayed to find out if you have enabled sockets. The message you are receiving says that you do not have sockets installed, therefore your script is failing.

[edited by: coopster at 11:57 am (utc) on April 3, 2005]

Zenden

3:52 am on Apr 3, 2005 (gmt 0)

10+ Year Member



how can i install this rpm files?

coopster

11:58 am on Apr 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sorry, the link was broken. I fixed it. It says the same as the quotation though, you need to enable the sockets functions at compile time.