rConfig - PHP Settings
rConfig relies on PHP to execute its core functionality. Understanding and properly configuring key PHP settings can significantly impact system performance and stability, particularly when dealing with large network environments or resource-intensive operations.
Key PHP Settings
Two critical PHP configuration settings directly affect rConfig’s performance and ability to handle large workloads:
Setting | Description | Recommendation |
---|---|---|
max_execution_time | Maximum time in seconds a script is allowed to run before it is terminated | 300-600 seconds for environments with many devices |
memory_limit | Maximum amount of memory a script may consume | Allocating a much larger portion of your available RAM to PHP (see guidelines below) |
Memory Limit
The memory_limit
setting defines how much memory a PHP script can consume. For rConfig, this is especially important when:
- Processing large configuration files
- Executing tasks across hundreds of devices simultaneously
- Running complex compliance checks
- Generating reports with extensive data
Recommended Memory Limit Settings
For dedicated rConfig servers, we recommend allocating a much larger portion of your available RAM to PHP:
Server RAM | Recommended memory_limit (dedicated server) |
---|---|
4GB | 3072M (3GB) |
8GB | 6144M (6GB) |
16GB | 12288M (12GB) |
32GB+ | 28672M (28GB) |
For servers with multiple applications, adjust these values based on resource allocation across all services. Remember that setting memory_limit too high on a shared system could negatively impact other applications.
Execution Time
The max_execution_time
setting controls how long a PHP script can run before PHP automatically terminates it.
Recommended Execution Time Settings
Environment Size | Recommended max_execution_time |
---|---|
Small (< 100 devices) | 300 seconds (5 minutes) |
Medium (100-500 devices) | 600 seconds (10 minutes) |
Large (500+ devices) | 900-1200 seconds (15-20 minutes) |
How to Modify PHP Settings
PHP settings can be modified in this ways:
-
php.ini file (recommended)
- Locate your active php.ini file (typically in
/etc/php/x.x/apache2/
or/etc/php/x.x/fpm/
) - Modify the settings and restart your web server
- Locate your active php.ini file (typically in
-
Through .htaccess (for Apache)
php_value memory_limit 4096Mphp_value max_execution_time 600
Step-by-Step Guide to Change PHP Settings
- Find the active PHP version:
php -v
- Locate your php.ini file:
php -i | grep "Loaded Configuration File"
This will show something like: /etc/php.ini
- Create a backup of your php.ini file:
sudo cp /etc/php.ini /etc/php.ini.backup
- Edit the php.ini file:
sudo vi /etc/php.ini
- Find and modify the settings:
- Press
/
to search - Type
memory_limit
and press Enter - Change the value using
i
to enter insert mode - Change from something like
memory_limit = 128M
tomemory_limit = 4096M
- Search for “max_execution_time” with
/max_execution_time
- Change the value from something like
max_execution_time = 30
tomax_execution_time = 600
- Press ESC to exit insert mode
- Type
:wq
and press Enter to save and quit
- Restart your web server:
- For Apache:
sudo systemctl restart httpd
- For Nginx with PHP-FPM:
sudo systemctl restart php-fpmsudo systemctl restart nginx
- Find the active PHP version:
php -v
- Locate your php.ini file:
php -i | grep "Loaded Configuration File"
This will show something like: /etc/php/7.4/apache2/php.ini
or /etc/php/8.1/fpm/php.ini
- Create a backup of your php.ini file:
sudo cp /etc/php/7.4/apache2/php.ini /etc/php/7.4/apache2/php.ini.backup
- Edit the php.ini file:
sudo nano /etc/php/7.4/apache2/php.ini
- Find and modify the settings:
- Use CTRL+W to search for “memory_limit”
- Change the value from something like
memory_limit = 128M
tomemory_limit = 4096M
(adjust according to your server’s RAM) - Search for “max_execution_time”
- Change the value from something like
max_execution_time = 30
tomax_execution_time = 600
- Save the file:
- Press CTRL+O to write the file
- Press ENTER to confirm
- Press CTRL+X to exit nano
- Restart your web server:
- For Apache:
sudo systemctl restart apache2
- For Nginx with PHP-FPM:
sudo systemctl restart php7.4-fpmsudo systemctl restart nginx
Verifying Your Changes
After making changes, verify they’ve been applied correctly:
- Create a PHP info file:
echo "<?php phpinfo(); ?>" | sudo tee /var/www/html/phpinfo.php
- Access the file in your browser:
- Navigate to
http://your-rconfig-server/phpinfo.php
- Search for “memory_limit” and “max_execution_time” to verify your new settings
- Remove the phpinfo file for security:
sudo rm /var/www/html/phpinfo.php
Need Help?
If you’re experiencing performance issues even after adjusting these settings, please open a support ticket with details about your environment and the specific operations causing problems.