---
title: "Setting Your PHP Settings in Command Line"
description: "When you are running a PHP file from the command line (on VPS Hosting or otherwise), there may be times when you need to make changes to the PHP settings. In this guide, we will show you how to..."
url: https://www.inmotionhosting.com/support/website/command-line-settings/
date: 2014-11-18
modified: 2025-02-11
author: "InMotion Hosting Contributor"
categories: ["Linux", "Website"]
type: post
lang: en
---

# Setting Your PHP Settings in Command Line

When you are running a PHP file from the command line (on [VPS Hosting](https://www.inmotionhosting.com/vps-hosting) or otherwise), there may be times when you need to make **changes to the PHP settings**. In this guide, we will show you how to specify the php.ini file, and **change a PHP setting in the command line**. If you are *not* working in the *command line*, you can [change your PHP settings in cPanel](https://www.inmotionhosting.com/support/website/update-local-php-settings/).

## Specify the php.ini File in Command Line

1. [Connect to your server using SSH](https://www.inmotionhosting.com/support/server/ssh/how-to-login-ssh/).
2. You can specify the php.ini file in the command line by using the following syntax: php -c 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

1. [Connect to your server using SSH](https://www.inmotionhosting.com/support/server/ssh/how-to-login-ssh/).
2. You can specify php.ini settings in the command line with this syntax: php -c -d 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

Congratulations, now you know how to set the php.ini file, and change your PHP settings from the command line!
