Checking your PHP and MySQL settings

You can also access your PHP and MySQL configuration settings via the Drupal Status report. For PHP it's as simple as clicking on the PHP version number, which is hyperlinked in your Status report. The same goes for your MySQL version and settings.

Clicking on the PHP version link loads a php.info file that resides in your site. This will give you all of your PHP core configuration settings and all of the PHP extensions you have loaded and enabled on your server. It's good to review this file for the following information that you'll need as you troubleshoot performance.

The location of your loaded php.ini configuration file: It's good to know where the default php.ini file is located on your web server. You can overwrite this configuration with a custom php.ini file or with custom PHP setting code that you load into either your settings.php and/or .htaccess file. However, there may be times when you need to edit the original default php.ini file as long as your host server gives you write access to that file.

Specifications under the PHP Core configuration section of the information file note the following information:

• Whether file_uploads is enabled/on. You will need to confirm that file_uploads is On in your PHP settings in order to use Drupal's core file attachments module.

• Max_execution_time and max_input_time.

• Memory_limit: notice its telling us that the local value of the memory_limit is 96M, which is what we set by adding a line of custom code to our settings.php file in Chapter 1. The Master value for memory_limit is still set server wide to 32M, but our site is using 96M. The Master value is being forced by the default server php.ini file. When we added our line of code to our local site's settings.php file, it only made the new PHP memory_limit effective for our site. The local value will be used in your site and will override any master value set.

• Post_max_size and upload_max_filesize. These settings may need to be tweaked once our users start uploading files to our website. Drupal allows you to control the file sizes per upload (per file) and per user through the Drupal administration configuration. When you make a change to the maximum upload file size (per file and per user) in your Drupal configuration, you need to make sure that these tweaks have also been made in your PHP settings first. So, if you want to raise your maximum upload size per file to 30 MB, you need to make sure to increase your PHP setting for upload_max_filesize to 30 MB respectively.

The important thing to grasp now is that you have access to review these PHP settings through your site's Status report and this PHP information file becomes an invaluable tool to troubleshoot the performance of your Drupal site. For example, if a user of your site complains that they are receiving errors every time they try and post a 50 MB PowerPoint file or TIFF image, you can check your PHP settings to see what the upload_max_filesize is, and then make a local tweak by adding a line of code to your settings.php file or by adding a custom php.ini file to your server. We'll try this as an example later in this chapter.

Was this article helpful?

0 0

Post a comment