How to configure PHP parameters (CentOS)

How to create Phpinfo script

When installing modules, you need to get information about PHP parameters on the server. To do this, place phpinfo.php in the site directory.

1. Connect to server via SSH.

2. Go to the site directory:

cd /path_to_directory

3. In this directory, create a phpinfo.php file:

nano phpinfo.php

4. Add the following content to the nano phpinfo.php file:

<?php

phpinfo();

?>

5. Press Ctrl+x,

Then press Y and Enter to save your changes.  

6.  Enter http://your.domain.name/phpinfo.php in your browser address bar.

Here you can see information about PHP settings.

The Loaded Configuration File line will display the path to the php.ini configuration file.

The default for CentOS is /etc/php.ini

Setting parameters (as an example - mbstring.func_overload)

1. Find the required parameter in php.ini. To do this, run:

grep -ni 'parameter_name' /path/to/file/php.ini

For example, if /etc/php.ini is the standard path for CentOS, the parameter name is mbstring.func_overload, the command will look like this:

grep -ni 'mbstring.func_overload' /etc/php.ini

Using the -n switch, you can see which line the required directive is on.

2. Using the line number, you can open the file with a text editor with  following command:

nano +line_number path/to/file/php.ini

For example, if /etc/php.ini is the default CentOS path, line number is 1546, the command would look like this: 

nano +1546 /etc/php.ini

3. Remove the ";" and set the desired parameter value (in this case 2):

BEFORE:   

mbstring.func_overload = 0

AFTER: 

mbstring.func_overload = 2

4. Press Ctrl+x,

Then press Y and Enter to save your changes.

5. Restart Apache:

service apache2 restart

6. Refresh the page http://your.domain.name/phpinfo.php in your browser and check the meaning of the directive.

7. To check, refresh the page http://your.domain/phpinfo.php and find the current value of the required directive (in our case, mbstring.func_overload).

mbstring.func_overload

2

2

 

If you have any questions, please create a ticket to technical support.