user6125429
user6125429

Reputation:

PHP.ini File changes not taken affect (memory limit)

UPDATE *SOLVED * and fully working

FOLLOW ALL THE POINTERS DISCUSSED HERE TO SOLVE SIMILAR ERROR FOR BOTH .INI AND PHP - MAILER

Remove the ';' extension=php_openssl.dll

My php.ini file does not seem to apply changes on the following line

memory_limit = 128M

I need to change this as I'm experiencing another error regarding PHP mailer which is

Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)

The output from my current memory size is memory usage 350056 however when I try to change this in php.ini it has no effect on my current memory limit

I have tried all the normal solution to fix the php mailer error such as

ini_set('memory_limit' '256m'); above my require line but still have the same error , Im starting to think something not right as my php.ini does not seem to update my current memory limit .

What is happening ? Why can I not fix ? please thank you .

<?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('[email protected]');
$mail->addBCC('[email protected]');

$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>

enter image description here

Upvotes: 1

Views: 3663

Answers (1)

Eduardo
Eduardo

Reputation: 1831

Try first checking which php are you running, sometimes we left by accident another php referenced on PATH. Go to cmd and run:

php --ini

This will show you the paths of the php.ini that you are working on. Hope it helps

UPDATE Also remember to update these to the value you need:

; 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

Upvotes: 2

Related Questions