# Do you support sockets with PHP?

> Yes. PHP socket functions are available on Ruachost hosting, so your scripts can open network connections to other servers and services.

Source: https://helpcenter.ruachost.com/faq/guides/do-you-support-sockets-with-php/

**Yes.** PHP socket functions are available on Ruachost hosting.

Sockets let your PHP scripts open network connections directly, for example to talk to another server or a service that doesn't use plain HTTP. You can use:

- The **sockets** extension, with functions such as `socket_create()`, `socket_connect()` and `socket_write()`.
- Stream functions such as `fsockopen()` and `stream_socket_client()`, which are often simpler.

```php
<?php
$fp = fsockopen('example.com', 80, $errno, $errstr, 10);
if (!$fp) {
    echo "Error: $errstr ($errno)";
}
```

## Things to know

- Your scripts can make **outgoing** connections. If a connection to a particular port is blocked, [contact support](https://helpcenter.ruachost.com/getting-started/guides/contact-support/) and tell us the host and port.
- Shared hosting is not suitable for long-running socket **servers** that listen for incoming connections all the time. For real-time features, see [Do you support WebSocket connections?](https://helpcenter.ruachost.com/faq/guides/do-you-support-websocket-connections/)
- If you see "Call to undefined function socket_create()", open **Select PHP Version → Extensions** in cPanel and tick **sockets**. See [Changing PHP versions and settings using PHP Selector](https://helpcenter.ruachost.com/cpanel/software/changing-php-versions-and-settings-using-php-selector/).
