If you are managing server and running multiple websites on server then sure you need to tweak and optimize php setting in php.ini file that works for you. for example, you need to increase max file upload size if you are running a video streaming website or increase memory_limit value due to memory allocation failure in php script. WHM does not allow you to change these values through WHM/Cpanel web interface. All you have to recompile apache with php in order to make critical change in php.ini.

Your first step is to check location of php .ini file. You can do this by running phpinfo function in a temp .php file. Create a file called “info.php” with below content. Upload file on webserver using ftp software and run on server to see server configuration. Find “Loaded Configuration File” in the web page to check exact location of php.ini file. Usually, path of the php.ini file is “/usr/local/lib/php.ini” but if it is different in phpinfo then use that file.

[php]<?php phpinfo(); ?>[/php]

Use PuTTy SSH client to login into server. Now it is the time to make change in php.ini file. You can do it in many ways. If you are familiar with Linux command line then use vi editor or nano editor. Nano editor is much more comfortable then traditional vi editor. Also, nano shows all useful commands in bottom bar that help user to works easily with nano editor.

Another, simple way is to use WinSCP client. WinSCP is a free windows SSH client that allow you to use shell commands or use convenient user friendly ftp like interface. Browse php.ini file using the WinSCP graphical interface, download the file, make the changes and upload again to the server.

Restart apache in order to see the changes.

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.

This article has 2 comments