Fatal Memory Error in version 3.1.6+ |
I have never been able to migrate from 3.1.5 to 3.1.6 because of the following error
================== Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in /var/www/html/rtsusers/system/core/Loader.php on line 1205 Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0 =================== I discovered that the problem lies in the file /system/core/Loader.php If I edit everything in the /system/core/Loader.php in the version 3.1.5 to look like /system/core/Loader.php in 3.1.11 then all edits cause no problem except the following in the new version. Code: // =========== from line 1046... /system/core/Loader.php in 3.1.11 CAUSES FATAL MEMORY ERROR =========== Code: // =========== /system/core/Loader.php in 3.1.5 WORKS WITHOUT ANY PROBLEM =========== Please help me. EDIT: code tags added for readability. See MyCode
Can you provide us with some sample code on how you load a library?
Possible as small as possible that will trigger this error, remove everything in your code except the code that triggers this error and post it here. Also post how you named them and where you stored them.
You are right! The problem is something to with loading of library. I commented off each line that loads a library and the error went away.
So how should I load a library? This is how I have been loading... <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Roots extends CI_Controller { public function __construct() { parent::__construct(); $this->load->library('base'); $this->load->library('utilities'); $this->load->library('session'); $this->load->library('auth'); } public function start() { } }
@owino,
You could also increase your memory limit in the PHP.ini file. Sometimes it may not be the code it may be the fact that you have exceeded the default PHP settings. I've run into similar situations and realized that I needed to increase the default PHP settings.
I am not a comfortable with editing third party code.
The culprit must be those few lines that were introduced at 3.1.6. As I wait to eventually migrate to version 4 when it is ripe (I hope migration will not be a pain), I will stick with version 3.1.5 which is working well.
I would use the php.ini setting below.
PHP Value: php_value memory_limit 256M PHP.INI memory_limit = 256M Or in Code: ini_set("memory_limit", "256M"); What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
@owino
Does it happen if you just tries to load just one library? Have you tried loading different libraries to see if all are failing or just one? If you haven't made a custom session library try to load this one: PHP Code: <?php Also for debugging purposes upload the latest version of CI on your server and set it up like a new application. Can you load the session library now? What PHP version are you using? It may not be 100% compatible, consider upgrading or changing version. @php_rocs and @InsiteFX: If he can't even load one library it can't be memory issue. He already have ~128MB of RAM (if it's not shared). (10-08-2019, 10:40 AM)jreklund Wrote: @owino I have a custom session library. Could this be causing any problem? Even one library does not load. Here is my platform: Database server Server: Localhost via UNIX socket Server type: MariaDB Server connection: SSL is not being used Documentation Server version: 10.3.17-MariaDB - MariaDB Server Protocol version: 10 User: root@localhost Server charset: cp1252 West European (latin1) Web server Apache/2.4.41 (Fedora) Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 - $Id: 7cc7cc96e675f6d72e5cf0f267f48e167c2abb23 $ PHP extension: mysqliDocumentation curlDocumentation mbstringDocumentation PHP version: 7.3.10
Have you tried a clean CodeIgniter without your code and just loading a library?
Just tried to autoload session in /application/config/autoload.php in a clean CI 3.1.11 with PHP 7.3.10 and works fine here. That dosen't work for you? |
Welcome Guest, Not a member yet? Register Sign In |