PHP.ini 文件更改未生效(内存限制)
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 邮件程序错误,例如
ini_set('memory_limit' '256m');
在我的 require 行之上,但仍然有同样的错误,我开始觉得有些不对劲,因为我的 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 的路径。希望对你有帮助
更新
还记得将这些更新为您需要的值:
; 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
更新 *已解决 * 并且完全正常工作
按照此处讨论的所有提示解决 .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 邮件程序错误,例如
ini_set('memory_limit' '256m');
在我的 require 行之上,但仍然有同样的错误,我开始觉得有些不对劲,因为我的 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 的路径。希望对你有帮助
更新 还记得将这些更新为您需要的值:
; 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