Error using socket_create in PHP

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

Error using socket_create in PHP

Postby broadstairs » 07. August 2021 10:25

I know currently I am using a very old xampp on Windows 7 but I need to know if things like socket_create will be supported in the latest version on xampp. My PHP code (written on Linux) uses socket_create etc rather than fsockopen. Currently and unsurprisingly socket_create fails on my old xampp. If it is not available in the latest version how to I make it so?

Thanks Stuart
broadstairs
 
Posts: 4
Joined: 07. August 2021 10:18
XAMPP version: 3.2.2
Operating System: Windows 7

Re: Error using socket_create in PHP

Postby Altrea » 07. August 2021 11:03

If the socket functions are not available in current xampp versions, there is no way around it.
They must be enabled at compile time, so you would need to compile php yourself and don't need xampp any more.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error using socket_create in PHP

Postby broadstairs » 07. August 2021 11:09

I'll update to the latest and see what happens.

Stuart
broadstairs
 
Posts: 4
Joined: 07. August 2021 10:18
XAMPP version: 3.2.2
Operating System: Windows 7

Re: Error using socket_create in PHP

Postby broadstairs » 08. August 2021 11:40

Well you are correct socket_create is not supported on the latest version, however it does not require a compile of PHP but the installation of an extension which is called php8-sockets on the openSUSE distro. Can this not be added to xampp windows version?

Stuart
broadstairs
 
Posts: 4
Joined: 07. August 2021 10:18
XAMPP version: 3.2.2
Operating System: Windows 7

Re: Error using socket_create in PHP

Postby Altrea » 08. August 2021 12:55

broadstairs wrote:however it does not require a compile of PHP but the installation of an extension which is called php8-sockets on the openSUSE distro.

Well than probably you know much more about PHP than i do.
I just rely on the official PHP documentation:

https://www.php.net/manual/en/sockets.requirements.php wrote:Requirements

No external libraries are needed to build this extension.


https://www.php.net/manual/en/sockets.installation.php wrote: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.


broadstairs wrote:Can this not be added to xampp windows version?

I don't know, you are the man with all the knowledge.
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error using socket_create in PHP

Postby Altrea » 08. August 2021 14:02

Did you try to uncomment the socket extension in your php.ini?
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 11933
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 11 Pro x64

Re: Error using socket_create in PHP

Postby broadstairs » 08. August 2021 16:00

Yes I have and yes it works. Sorry - senior moment I must have missed that when searching through php.ini the first time.

Stuart
broadstairs
 
Posts: 4
Joined: 07. August 2021 10:18
XAMPP version: 3.2.2
Operating System: Windows 7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 204 guests