phpemailsmtppear

After upgrading my website to PHP 8.0 PEAR send() function stopped working! Status code 500


I have got a website that was perfectly sending SMTP mail using the PEAR Mail package.

After I upgraded my domain to the PHP 8.1 version CGI, the function

$smtp->send($to, $headers, $email_body); stopped working!

Status code 500

the log file error is: include_once(Net/SMTP.php): Failed to open stream: No such file or directory in /home/......./pear/share/pear/Mail/smtp.php

Therefore I tried to install it but the error this time was:

pear/Net_SMTP is already installed and is the same as the released version 1.10.0 install failed

and in the Chrome Developer Tools "network" response there is not a RESPONSE ! Empty! Any idea?


Solution

  • SOLVED. Basically, after I upgraded my domain to the PHP 8.1 version, PEAR stopped working. The error I detected was:

    include_once(Net/SMTP.php): Failed to open stream: No such file or directory in /home/......./pear/share/pear/Mail/smtp.php

    Net_SMTP was installed but the server could not get the file BECAUSE OF PEAR CODE !!!!

    You have to change the path requests that are present in different files in PEAR:

     include_once __DIR__."/../Net/SMTP.php";//include_once 'Net/SMTP.php';
    
    require_once __DIR__."/../PEAR.php" //require_once 'PEAR.php';
    require_once __DIR__."/../PEAR.php"; //require_once 'PEAR.php';
    require_once __DIR__."/Socket.php";