---
title: "How to Tweak PHP and MySQL settings for OP5 Monitor"
description: "Tuning PHP and MySQL settings can improve OP5 Monitor performance for large configurations and heavy reports. Adjustments involve creating custom configuration files and restarting services, with rollback possible by deleting these files."
url: "https://docs.itrsgroup.com/docs/faq/op5/360033799154-op5-monitor-how-to-tweak-php-and-mysql-settings-for-op5-monitor/index.html"
---
These settings are already the default since version 8.2.5.

## PHP

In some cases you may need to tweak the settings for PHP when using OP5 Monitor. Some examples of actual situations we have seen that may require this type of configuration change includes (but is not limited to):

- Having very large configuration files, which requires PHP processes to run for a longer time, and/or use additional memory.
- Making changes that are adding or removing a large amount of values/objects
- Making repeated API calls with an LDAP account

## Adding a new PHP configuration file with additional settings

Please note these values need to be tailored to your environment. Feel free to experiment with the most restrictive setting that still works for you.

The following will create a new file with some additional PHP settings that will overtake php.ini -- to roll back these changes, simply delete the file and restart httpd again:

```
# cat > /etc/php.d/00_op5_php.ini <<EOF
max_execution_time = 1300
memory_limit = 3G
max_input_vars = 30000
EOF
```

Restart httpd to apply changes:

```
# systemctl restart httpd
```

## Rollback the above changes

Simply delete the file that was created, and restart httpd:

```
# rm -v /etc/php.d/00_op5_php.ini
# systemctl restart httpd
```

## Issues these PHP changes may resolve

- Not being able to scan an SNMP object due to it having too many ports in the result.
- Not being able to select all items to add to a host- or service group.
- Large reports not running successfully due to running out of memory or hitting the max execution time.

## MySQL

In some cases you may need to tweak the settings for MySQL when using OP5 Monitor. Some examples of situations that may require this:

- You may have long running queries due to heavy reports being generated.
- You may have issues with slow views in certain parts of the product that depend on MySQL queries, for example the notifications list.

## Adding a new MySQL configuration file with additional settings

Please note these values need to be tailored to your environment. Feel free to experiment with the most restrictive setting that still works for you.

The following will create a new file with some additional MySQL settings -- to roll back these changes, simply delete the file and restart again:

```
# cat > /etc/my.cnf.d/op5_tweaks.cnf <<EOF
[mysqld]
key_buffer_size = 2G
query_cache_type = 1
query_cache_limit = 256K
query_cache_min_res_unit = 2k
query_cache_size = 30M
thread_cache_size = 20
max_connections = 1024
max_allowed_packet = 10485760
EOF
```

Restart mariadb to apply changes:

```
# systemctl restart mariadb
```

## Rollback the above changes

Simply delete the file that was created, and restart again:

```
# rm -v /etc/my.cnf.d/op5_tweaks.cnf
# systemctl restart mariadb
```


