473,396 Members | 2,070 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Socket programming: Call to undefined function socket_create() error

Hai,
I am new to php socket programming.I have a doubt.
Expand|Select|Wrap|Line Numbers
  1. <?php    if(!($sock = socket_create(AF_INET, SOCK_STREAM, 0)))
  2.     {
  3.         $errorcode = socket_last_error();
  4.         $errormsg = socket_strerror($errorcode);
  5.  
  6.         die("Couldn't create socket: [$errorcode] $errormsg \n");
  7.     }
  8.  
  9.     echo "Socket created";
  10. ?>
When i use this code,it shows an error"Fatal error: Call to undefined function socket_create() in C:\wamp\www\hai\socket.php on line 1".I am using windows 7 OS and wampserver version 2.0c.Will you please suggest me a way to solve the bug?thanks for your reply in advance.
Mar 16 '13 #1
2 8270
Atli
5,058 Expert 4TB
Hey.

Looks like your server doesn't have the sockets extension enabled. You'll need to enable that to use those functions in your code. For a detailed explanation of that, see this page in the manual:

Installation of extensions on Windows
Mar 16 '13 #2
hai,
found the answer.you need to enable the socket extension in wamp. Click the wamp icon in the taskbar, go to
PHP => PHP extensions and click php_sockets. Make sure it has a tick mark to indicate that it is enabled.

After that restart apache. Now socket functions should work fine.thanks for replying me
Mar 17 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Philippe C. Martin | last post by:
Hi, I am following a few tutorial and this howto: ************************************************************* ............ What happens in the web server is a bit more complex. First, the...
1
by: martinnitram | last post by:
Dear all, following are some piece of my code (mainly create a socket connection to server and loop to receive data): # function to create and return socket def connect(): server_config =...
5
by: pnigl | last post by:
Hello, i tried to set up a socket connection with the following code: #include <afxwin.h> #include <afxsock.h> int main()//int argc, char* argv { CAsyncSocket socket; socket.Create();
1
by: Joe | last post by:
Hi, I browsed the news and a few seem to have this problem too, but no solution ! I have a client server application where in case the connection gets bad (crashes or whatever) client or...
3
by: Erakis | last post by:
Hi, I have to make an ActiveX (Running on Internet Explorer) that play/record sound from soundcard. Also, I have to create a Socket to send/receive sound data to my server. I use this...
6
by: Sean | last post by:
Hi Everyone, My apologies for a somewhat dump question but I am really stuck. I have been working on this code for two days straight I am dont know what is wrong with it. when I run the code, All...
11
by: atlaste | last post by:
Hi, In an attempt to create a full-blown webcrawler I've found myself writing a wrapper around the Socket class in an attempt to make it completely async, supporting timeouts and some scheduling...
2
by: Ali Hamad | last post by:
Hello All : A socket question from a networking newbie. I need to create a server that: 1) receive a message from client. 2) check that message and response to it. 3) the client get the...
2
by: kashifjawed | last post by:
I'm developing a c# asynchronous socket application for tranfering file or large data from client to server and server to client as well in chunks. Application sometimes transfer file from client...
1
Airslash
by: Airslash | last post by:
Hello, The problem is that my server is not receiving data. The code below are the various classes I designed around sockets. It will be big... I have run the code with the debugger, and I see...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.