Предел дополнительный памяти php moodle

Moodle исчерпывает память, доступную для PHP

Сначала я думал, что ограничение памяти php было слишком низким, но 64 МБ кажется вполне приемлемым. Является ли настроение настолько голодным, что ему нужно больше? Если это так, и учитывая, что я использую общий хостинг, и что, вероятно, маловероятно, что они увеличат ограничение памяти только для меня, как я могу обойти его? Я использую moodle 2.4.3.

Сообщение появляется слишком часто и использует очень разные функции Moodle, так что я думаю, что это не так. Файл php и номер строки не всегда одинаковы.

Я не ожидал бы, что номер строки всегда будет одинаковым, но я бы предположил, что, возможно, все эти номера строк находятся в некотором общем разделе кода, где вы пытаетесь поместить большой объем данных в память.

Вы не работаете вокруг этого. Вам необходимо выяснить, почему вы пытаетесь выделить столько памяти. Отладка вашего приложения.

Это просто происходит в слишком многих разных ситуациях. Я на самом деле не ищу способ сделать moodle более эффективным в использовании памяти во всех этих случаях. И я использую стабильную версию Moodle, так что я уверен, что это не ошибка . и я ожидаю, что она будет работать.

Читайте также:  Python keyerror in dict

Проблема может быть вовсе не в Moodle (скорее всего, нет), скорее всего, в том, как вы ее используете. Я не очень знаком с Moodle, потому что вы можете делать такие вещи, как попытка сразу загрузить весь набор результатов базы данных в память, а не циклически повторять набор результатов и работать с одной записью за раз, используя плохой плагин или любое количество вещей. Вы должны искать общую тему, как вы получаете эти ошибки. Если вы получите номер строки, посмотрите, встречается ли этот номер строки в цикле. Попытайтесь понять, что делает этот цикл.

@MikeBrant спасибо за предложения, но я действительно думаю, что это не тот путь. Я не хочу отлаживать Moodle. Представь, что я найду все места, где Moodle загружает вещи в память, что мне тогда делать? Я полагаю, я мог бы попытаться оптимизировать код Moodle. Т.е. поменяй его. И отправьте патч сопровождающим Moodle. Это не тот уровень вовлеченности, который я ищу. Я просто ищу решение, чтобы оно работало с имеющимися у меня ресурсами сервера.

Источник

PHP settings by Moodle version

This page requires a review. Please do so and remove this template when finished.

Contents

PHP Version

Moodle has different PHP requirements for different versions:

  • Moodle 2.7 will require PHP 5.4.4 or later
  • Moodle 2.6 will require PHP 5.3.3 or later
  • Moodle 2.1 will require PHP 5.3.2 or later
  • Moodle 2.0 will require PHP 5.2.8 or later.
  • Moodle 1.6 to 1.9 requires PHP 4.3.0 or later
  • Moodle 1.0 to 1.5 requires PHP 4.1.0 or later

PHP Settings

Check these settings in your php.ini or .htaccess file (if you’re using Apache). For settings which use ON/OFF as their values, you can substitute 1 for ON and 0 for OFF if you prefer.

  • register_globalsMUST be OFF
  • safe_mode needs to be OFF.
  • memory_limit should be at least 16M (32M is recommended for Moodle 1.7 and 40M for Moodle 1.8 or later). Large sites may need more than 128M. PHP 5.2.x requires higher memory_limit values than previous versions of PHP. 64bit operating systems require even more memory.
  • session.save_handler needs to be set to FILES.
  • magic_quotes_gpc should be OFF. (It will be an installation pre-requisite for this to be turned off from 2.0 onwards.)
  • magic_quotes_runtime needs to be OFF.
  • file_uploads needs to be ON.
  • session.auto_start needs to be OFF.
  • session.bug_compat_warn needs to be OFF.
  • For file uploads in Moodle 2 on a Windows install, the temp folder must be defined and writeable by your webserver user

PHP Extensions and libraries

  • The mbstring extension is recommended for Moodle 1.6 or later.
  • The iconv extension is recommended for Moodle 1.6 or later.
  • GD library and the FreeType 2 library and extensions are needed to be able to look at the dynamic graphs that the logs pages make. (Freetype support is available as part of the GD extension for the 5.x versions of PHP)
  • The mysql extension is required if you are using the MySQL database. Note that in some Linux distributions (notably Red Hat) this is an optional installation.
  • The pgsql extension is required if you are using the PostgreSQL database.
  • The zlib extension is required for zip/unzip functionality.
  • The pdo and pdo_sqlite extensions are required for the (experimental) SQLite 3 database support.
  • The tokenizer extension is recommended for Moodle 1.8 or later (enabled by default as of PHP 4.3.0).
  • The curl and openssl extensions are required for the Moodle network functionality (Moodle 1.8 or later).
  • The xmlrpc extension is required for the Moodle network functionality (Moodle 1.8 or later).
  • The ctype extension is recommended for Moodle 1.8 or later (enabled by default as of PHP 4.2.0).
  • Other PHP extensions may be required to support optional Moodle functionality, especially external authentication and/or enrolment (e.g. LDAP extension for LDAP authentication and the sockets extension for Chat server).

Database Support

A working database server: MySQL or PostgreSQL are completely supported and recommended for use with any version of Moodle. Support for Microsoft SQL Server and Oracle has been added in Moodle 1.7. MySQL is the choice for many people because it is very popular, but there are some arguments in favour of PostgreSQL, especially if you are planning a large deployment.

  • For Moodle 1.5, MySQL (version 3.23 or later) or PostgreSQL (7.4 or later).
  • For Moodle 1.6, MySQL (version 4.1.12 or later) or PostgreSQL (7.4 or later).
  • For Moodle 1.7, MySQL (version 4.1.12 or later), PostgreSQL (7.4 or later) or Microsoft SQL Server 2005 (version 9 or SQL Server Express 2005)
  • For Moodle 1.8 or later, MySQL (version 4.1.12 or later), PostgreSQL (8.0 or later) or Microsoft SQL Server 2005 (version 9 or SQL Server Express 2005)
  • For showcases or low to medium-sized installations, Moodle 2.0 also includes (experimental) support for SQLite 3 database. This setup requires no database server, as the database file is stored in a local directory on the server.

See also

Источник

Hardware and performance

What is your value for php memory_limit. I read on internet «Golden rule, give to php what is he consume not more not less».

We have four web server with 8Go ram for each instance. We have very hight traffic. Actualy we have set the memory_limit to 128 Mo and we plan to raise to 512 Mo.

I think it’s to much, few pages consumes memories (export data, import data, upload image. ), i’m not sure that increasing the memory for the whole php scripts is in good approach.

I would like to have your views on the issue.

Re: Php memory_limit, what is the good way

While you have a valid point about not making this larger than it needs to be, some Moodle processes do use large amounts of memory. They are rare but they will (obviously) not work if memory is restricted.

Moodle/PHP doesn’t seem to have significant issues with memory leaks and the like so I wouldn’t worry too much.

Re: Php memory_limit, what is the good way

Re: Php memory_limit, what is the good way

I am at the opinion that this is for each script that runs. Meaning that if ten people hit a script that uses 512mb it will bring your server down

If you want consistent performance across all users this should be lower rather than higher.

PS imagine 60 people doing a quiz and each user (script that runs), is allowed to use up 512MB

Re: Php memory_limit, what is the good way

i’m wondering the same question.

our moodle 3.5 php config is set with 386Mo, maximum simultaneous students on the plateform is 30 and it is on scorm activities (50M each scorm file).

i’d like to increase this value to 512 or 1024M only if it can offer speed improvment.

how can i know if i can update to 1024 ? PHPinfo doesn’t tell the memory server size.

Re: Php memory_limit, what is the good way

Re: Php memory_limit, what is the good way

i’d like to increase this value to 512 or 1024M only if it can offer speed improvement.

It won’t. How could the available size of RAM for a (PHP) process improve the performance? If the memory is not enough the process will break. But if there is too much memory, it won’t be utilized. That’s all.

Re: Php memory_limit, what is the good way

If the memory is not enough the process will break. But if there is too much memory, it won’t be utilized. That’s all

i’m pretty sure it is fully wrong on linux plateform.
if the memory is not enought, the process will be cached on harddrive memory (so it will be slowed).

if there is too much memory, there is a chance of 0% of cache drive, so 100% in physical memory so, it is quicker.

But this requiert the task of an it administrator to confirm and configure that behavior, i guess. i’m not sure linux assume that way in basic default installation.

Источник

Installing and upgrading help

I am getting a warning that php memory limit is too low. how can I increase the memory limit. i am installing moodle on byethost. I can’t access php.ini file. how can i change the limit please help me out. screenshot is attached below

Приложение php_error.JPG

Re: php memory limit

You can edit or create the .htaccess file in your Moodle web root and put the following line:

php_value memory_limit 48M

If that doesn’t work (you may get a server error), edit your Moodle config.php file and put this somewhere near the top

Re: php memory limit

Thanks Sir for the response.

I did same as you told but none of them worked for me. I tried with both the setting but still php memory limit is showing 24M.

I ignored this warning and continued with the settings but I get stucked at database installation. It was showing the upgrade plugin error like

enrol/authorize plugin needs upgrading

Well after looking around the forum posting i resovled the plugin problem somehow with the help of following forum posting

But now I am facing another promblem (Can’t login with any account) as posted on the above forum. I am installing moodle on byethost.com. Please help me in this issue.

Re: php memory limit

Memory limits range over different levels and if you fix one, then the next up the food chain can come into play. However, if you are using ByteHost, then you better talk to them, they may not appreciate someone grabbing more accessible memory without any discussion. They may have disabled overrides from .htaccess files.

Re: php memory limit

Thinking about it a bit more, the memory limits in php are set to limit the amount of resources that can be used by a script, and there is a maximum of 128m then. Create a file that contains the text

and place that anywhere in your website. Open it in your browser and that should provide you will all the details you need about your hosts php setup. The only other limits are the file sizes, upload and download.

Источник

Оцените статью