Title: PHP 8 error: socket_connect()
Last modified: November 1, 2023

---

# PHP 8 error: socket_connect()

 *  Resolved [Kash](https://wordpress.org/support/users/jdwel/)
 * (@jdwel)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/php-8-error-socket_connect/)
 * Hello,
 * After updating my php from 7.4 to 8.1 This issues started happening on plugin
   page & when updating content:
 * `E_ERROR (Line 129)
   file: /wp-content/plugins/purge-varnish/class_purge_varnish.
   php.**Uncaught TypeError: socket_connect(): Argument #3 ($port) must be of type?
   int, string given** in /wp-content/plugins/purge-varnish/class_purge_varnish.
   php:129Stack trace:#0 /wp-content/plugins/purge-varnish/class_purge_varnish.php(
   129): 

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Kash](https://wordpress.org/support/users/jdwel/)
 * (@jdwel)
 * [2 years, 6 months ago](https://wordpress.org/support/topic/php-8-error-socket_connect/#post-17166173)
 * Fixed it by passing intval to $port.
 * (Line: 129 File: class_purge_varnish.php)
   `_if_ (@!socket_connect($client, $server,
   intval($port))) {`
 *  Plugin Author [Dsingh](https://wordpress.org/support/users/devavi/)
 * (@devavi)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-error-socket_connect/#post-17396930)
 * @[Kash](https://wordpress.org/support/users/jdwel/), Issue resolved. Please check.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP 8 error: socket_connect()’ is closed to new replies.

 * ![](https://ps.w.org/purge-varnish/assets/icon-128x128.png?rev=1530370)
 * [Purge Varnish Cache](https://wordpress.org/plugins/purge-varnish/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/purge-varnish/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/purge-varnish/)
 * [Active Topics](https://wordpress.org/support/plugin/purge-varnish/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/purge-varnish/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/purge-varnish/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Dsingh](https://wordpress.org/support/users/devavi/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/php-8-error-socket_connect/#post-17396930)
 * Status: resolved