View previous topic :: View next topic |
Author |
Message |
hudsucker -
Joined: 24 May 2006 Posts: 7
|
Posted: Wed May 24, 2006 6:59 pm Post subject: Fatal error: Call to undefined function socket_create() |
|
|
Hi every one;
Fatal error: Call to undefined function socket_create() in C:\ProgramFiles\Abyss Web Server\htdocs\Newping\index.php on line 28
I get the error above trying to run ping script on abyss.
I did remove the : in front of extension=php_sockets.dll restarted the server
no changes. Below you find the script I try to run - searched on google could not find any thing else.Please help!! :(
Thanks Lawrence
<?
function icmpChecksum($data)
{
if (strlen($data)%2)
$data .= "\x00";
$bit = unpack('n*', $data);
$sum = array_sum($bit);
while ($sum >> 16)
$sum = ($sum >> 16) + ($sum & 0xffff);
return pack('n*', ~$sum);
}
// Making the package
$type= "\x08";
$code= "\x00";
$checksum= "\x00\x00";
$identifier = "\x00\x00";
$seqNumber = "\x00\x00";
$data= "Scarface";
$package = $type.$code.$checksum.$identifier.$seqNumber.$data;
$checksum = icmpChecksum($package); // Calculate the checksum
$package = $type.$code.$checksum.$identifier.$seqNumber.$data;
// And off to the sockets
$socket = socket_create(AF_INET, SOCK_RAW, 1); this is the line
socket_connect($socket, "www.google.com", null);
// If you're using below PHP 5, see the manual for the microtime_float
// function. Instead of just using the m
// icrotime() function.
$startTime = microtime(true);
socket_send($socket, $package, strLen($package), 0);
if (socket_read($socket, 255)) {
echo round(microtime(true) - $startTime, 4) .' seconds';
}
socket_close($socket);
?> |
|
Back to top |
|
|
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Wed May 24, 2006 7:51 pm Post subject: |
|
|
Can you paste the output of running phpinfo()? Did you compile PHP yourself?
Also, according to the PHP manual you don't need an extension for socket_create(). _________________
|
|
Back to top |
|
|
hudsucker -
Joined: 24 May 2006 Posts: 7
|
Posted: Wed May 24, 2006 10:07 pm Post subject: |
|
|
MonkeyNation wrote: | Can you paste the output of running phpinfo()? Here you go:
PHP Version 5.1.2
System Windows NT CAPGEMIN-D6XYT1 5.1 build 2600
Build Date Jan 11 2006 16:35:21
Configure Command cscript /nologo configure.js "--enable-snapshot-build" "--with-gd=shared"
Server API CGI/FastCGI
Virtual Directory Support enabled
Configuration File (php.ini) Path C:\WINDOWS\php.ini
PHP API 20041225
PHP Extension 20050922
Zend Extension 220051025
Debug Build no
Thread Safety enabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, http, ftp, compress.zlib
Registered Stream Socket Transports tcp, udp
Registered Stream Filters convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, zlib.*
Did you compile PHP yourself?I am not sure what you mean by that?
I found the scritp on wep.
Also, according to the PHP manual you don't need an extension for socket_create(). |
|
|
Back to top |
|
|
cmxflash -
Joined: 11 Dec 2004 Posts: 872
|
Posted: Wed May 24, 2006 10:12 pm Post subject: |
|
|
You probably need to enable the socket-extension. Just look in your php.ini-file and remove the ; from the line where the extension is located. It's probably called something like php_sockets.dll. |
|
Back to top |
|
|
AbyssUnderground -
Joined: 31 Dec 2004 Posts: 3855
|
Posted: Thu May 25, 2006 7:51 am Post subject: |
|
|
cmxflash wrote: | You probably need to enable the socket-extension. Just look in your php.ini-file and remove the ; from the line where the extension is located. It's probably called something like php_sockets.dll. |
If you read his first post he already did that and it didnt work. _________________ Andy (AbyssUnderground) (previously The Inquisitor)
www.abyssunderground.co.uk |
|
Back to top |
|
|
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Thu May 25, 2006 9:42 am Post subject: |
|
|
Oh right, I thought the windows binaries had it enabled by default.
In that case, yeah, you'll have to uncomment the extension in php.ini.
If you already have, and it didn't seem to work, run phpinfo() once again, and look for where it reports php.ini to be located. Is that the one you edited? _________________
|
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Thu May 25, 2006 10:47 am Post subject: Re: Fatal error: Call to undefined function socket_create() |
|
|
hudsucker wrote: | Hi every one;
Fatal error: Call to undefined function socket_create() in C:\ProgramFiles\Abyss Web Server\htdocs\Newping\index.php on line 28
I get the error above trying to run ping script on abyss.
I did remove the : in front of extension=php_sockets.dll restarted the server
|
Are you sure you have updated the right php.ini file? According to your phpinfo() output, you should change C:\WINDOWS\php.ini .
If you are using FastCGI with PHP, you must restart the web server to ensure that the updated php.ini is taken into account. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
hudsucker -
Joined: 24 May 2006 Posts: 7
|
Posted: Thu May 25, 2006 10:49 am Post subject: |
|
|
MonkeyNation wrote: | Oh right, I thought the windows binaries had it enabled by default.
In that case, yeah, you'll have to uncomment the extension in php.ini.<-I am new to php what you mean by uncomment the extension
If you already have, and it didn't seem to work, run phpinfo() once again, and look for where it reports php.ini to be located. Is that the one you edited?<-in fact it is the only one I found on pc |
|
|
Back to top |
|
|
MonkeyNation -
Joined: 05 Feb 2005 Posts: 921 Location: Cardiff
|
Posted: Thu May 25, 2006 11:29 am Post subject: |
|
|
If C:\WINDOWS\php.ini was the one you edited, then you edited the correct one.
Like aprelium said, try restarting abyss too.
Also, you could see what PHP does from the command line.
I.E. Start > Run > cmd.exe > cd C:\PHP & php -m . Does sockets appear on that list? (Also, if you don't have PHP in C:\PHP, change that bit.) _________________
|
|
Back to top |
|
|
hudsucker -
Joined: 24 May 2006 Posts: 7
|
Posted: Fri Jun 02, 2006 6:43 pm Post subject: |
|
|
You were right running from CMD I got - PHP Warning: PHP Star
The specified module c
in Unknown on line 0 can I load that dll some how?
By the way thank you for such quick responce!! :D |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
|
Back to top |
|
|
|