Knowledge Base Hub

Browse through our helpful how-to guides to get the fastest solutions to your technical issues.

Home  >  Domain Name & DNS Issues  >  Setting Your PHP Settings in Command Line
Top Scroll

Setting Your PHP Settings in Command Line

 2 min

When you are running a PHP file from command line, there might be times when you have to roll out improvements to the PHP settings. In this guide we will demonstrate to you generally accepted methods to determine the php.ini document, and change a PHP setting in summon line. In the event that you are not working in summon line, you can change your PHP settings in cPanel.

Specify the php.ini File in Command Line

  • Connect to your server using SSH.
  • You can specify the php.ini file in command line by using the following syntax:

php -c [Path to php.ini file] [Path to .php file]

For example:

php -c /home/userna5/public_html/php.ini /home/userna5/public_html/example.php

Now the example.php file will run, with the limitations set in the php.ini file located here: /home/userna5/public_html

Change PHP settings

  • Connect to your server using SSH.
  • You can specify php.ini settings in command line with this syntax:

php -c [Path to php.ini file] [Path to .php file] -d [PHP setting]

For example:

php -c /home/userna5/public_html/php.ini /home/userna5/public_html/example.php -d memory_limit=256M

In this example, you can see I am setting the memory limit to 256 Megabytes. Here are some other PHP settings that are often modified:

max_execution_time

max_input_time

upload_max_filesize

For our Knowledge Base visitors only
Get 10% OFF on Hosting
Special Offer!
30
MINS
59
SECS
Claim the discount before it’s too late. Use the coupon code:
STORYSAVER
Note: Copy the coupon code and apply it on checkout.