When you are operating a PHP file from command line, there may be times when you need to create changes to the PHP configurations. In this post we will explain you how to specify the php.ini file, and modify a PHP settings through command line. If you don’t know how to use command line, you can modify your PHP configurations in cPanel.
HOW TO Specify the php.ini File in Command Line:
- Connect to your server using SSH.
- You may specify the php.ini file in command line by using the following syntax:
php -c /home/username/public_html/php.ini /home/username/public_html /example.php
Now the example.php file will run, with the limitations set in the php.ini file located here: /home/username/public_html.
Change PHP settings:
- Connect to your server via SSH.
- You can specify php.ini settings in command line with this syntax:
php -c /home/username/public_html/php.ini /home/username/public_html /example.php -d memory_limit=512M
In the above example you can see that we have modify the memory limit to 512 MB.There are some other PHP settings that are often modified.
max_execution_time max_input_time upload_max_filesize
now you know how to set the php.ini file, and modify your PHP configurations from command line!