[英]PHP.ini File changes not taken affect (memory limit)
更新*已解決*並可以正常工作
按照此處討論的所有要點解決.INI和PHP-MAILER的類似錯誤
去除 ';' 擴展名= php_openssl.dll
我的php.ini文件似乎未在以下行上應用更改
memory_limit = 128M
我需要更改此設置,因為我遇到了另一個有關PHP郵件程序的錯誤,這是
Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)
當前內存大小的輸出是memory usage 350056
但是當我嘗試在php.ini
更改此設置時,它對我當前的內存限制沒有影響
我已經嘗試了所有常規解決方案來修復php mailer錯誤,例如
ini_set('memory_limit' '256m');
在我的需求行上方,但仍然存在同樣的錯誤,我開始想一些不合適的事情,因為我的php.ini似乎無法更新我當前的內存限制。
怎么了 ? 為什么我不能修復? 求求你了,謝謝你 。
<?php
ini_set('display_errors', true);
error_reporting(1);
require 'PHPMailerAutoload.php';
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = "ssl://smtp.gmail.com"; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'xxx.com'; // SMTP username
$mail->Password = 'xxx'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('xxx.com', 'Mailer');
$mail->addAddress('xxx.com', 'xxx'); // Add a recipient
$mail->addAddress('xx.com'); // Name is optional
$mail->addReplyTo('xx.com', 'Information');
$mail->addCC('cc@example.com');
$mail->addBCC('bcc@example.com');
$mail->addAttachment(''); // Add attachments
$mail->addAttachment('', ''); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Test';
$mail->Body = 'body test <b>in bold!</b>';
$mail->AltBody = 'test';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>
c:\Program Files\php>php --ini PHP Warning: PHP Startup: Unable to load dynamic library 'ext\msql.dll' - The s pecified module could not be found. in Unknown on line 0 Configuration File (php.ini) Path: C:\Windows Loaded Configuration File: C:\Program Files\php\php.ini Scan for additional .ini files in: (none) Additional .ini files parsed: (none) c:\Program Files\php>
嘗試先檢查您正在運行哪個php,有時我們偶然在PATH上引用了另一個php。 轉到cmd並運行:
php --ini
這將向您顯示正在處理的php.ini的路徑。 希望能幫助到你
UPDATE還請記住將它們更新為所需的值:
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
; Maximum execution time of each script, in seconds
; http://php.net/max-execution-time
; Note: This directive is hardcoded to 0 for the CLI SAPI
max_execution_time = 30
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.