Segmentation fault error using imap php gmail

40 Views Asked by At

Im trying to connect to gmail via imap in php but im always get segmentation fault error.

Im using php 8.3.2 in macOS Sonoma running the script in the terminal, php imap is working because if a put username or password wrong it returns an imap error with invalid credentials.

Here's my code:

<?php
define("PASS_GMAIL", "hidden");
define("EMAIL_GMAIL", "hidden");
define("CONN_GMAIL", "{imap.gmail.com:993/imap/ssl}INBOX");

$cx = imap_open(CONN_GMAIL, EMAIL_GMAIL, PASS_GMAIL) or die('Cannot connect to Gmail: ' . imap_last_error());

$th = imap_thread($cx);
echo "THREAD: ".print_r($th, true);
?>

And this is the error that returns when i try with everything right:

zsh: segmentation fault  php email_teste.php

sometimes it gives me this error too:

zsh: bus error  php email_teste.php

Im using app password for login and imap is active in gmail.

What this error could be? What can i do?

The error is happening in the imap_thread() function, the connection happens but the imap_thread gives the error

0

There are 0 best solutions below