2011-03-16 9 views
5

मैं हो रही है त्रुटि की तरह:अगर मैं अपने सर्वर पर स्थापित किया गया है या नहीं, तो मैं यह देखने के लिए कैसे जांचूं?

Warning: include_once(Net/SMTP.php) [function.include-once]: failed to open stream: No such file or directory in /usr/local/lib/php/Mail/smtp.php on line 348

Warning: include_once() [function.include]: Failed opening 'Net/SMTP.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /usr/local/lib/php/Mail/smtp.php on line 348

Fatal error: Class 'Net_SMTP' not found in /usr/local/lib/php/Mail/smtp.php on line 349

मेरे कोड:

require_once 'Mail.php'; 

$from = "[email protected]>"; 

$to = "[email protected]>"; 
$subject = "Hi!"; 
$body = "Hi,\n\nHow are you?"; 

$host = "mail.example.com"; 

$username = "me"; 
$password = "test"; 

$headers = array ('From' => $from, 
    'To' => $to, 
    'Subject' => $subject); 

$smtp = Mail::factory('smtp', 
    array ('host' => $host, 
    'auth' => true, 
    'username' => $username, 
    'password' => $password)); 
$mail = $smtp->send($to, $headers, $body); 

if (PEAR::isError($mail)) { 
    echo("<p>" . $mail->getMessage() . "</p>"); 
} else { 
    echo("<p>Message successfully sent!</p>"); 
} 

उत्तर

19

आप ssh पहुँच है, तो आप के लिए लॉग इन और

which pear 

चल सकता है या इसके इंस्टॉल हो यह कुछ प्रिंट होगा इस तरह

/usr/bin/pear 
+4

यह उत्तर है, इसे चुनें। –

13

इस कोड

require_once 'System.php'; 
var_dump(class_exists('System')); 

जब यह सच है उपयोग, नाशपाती स्थापित किया गया है। अधिक जानकारी: http://pear.php.net/manual/en/installation.checking.php

+1

'requ_once' स्क्रिप्ट को घातक त्रुटि से बाहर निकाल देता है, यदि मॉड्यूल स्थापित नहीं किया गया था। यही कारण है कि मॉड्यूल स्थापित होने पर आपको पहले जांच करनी चाहिए (ऊपर इस प्रश्न को देखें)। इस प्रकार यह उपर्युक्त प्रश्न का उत्तर नहीं है। – feeela

5

यदि सर्वर उबंटू पर है तो निम्न कोड सहायता कर सकता है।

sudo apt-get install php-pear 

sudo pear install mail 

sudo pear install Net_SMTP 

sudo pear install Auth_SASL 

sudo pear install mail_mime 

More info here

संबंधित मुद्दे

 संबंधित मुद्दे