php.ini location

php-logowhere is the Location of my php.ini?

Finding the php.ini file can be vital to certain tasks. This is the configuration file read when PHP begins. This will only happen once with server module versions of PHP, but will happen on every invocation with CLI and CGI versions.

When php –ini is present on the command line execute, you will get something that looks like:

Configuration File (php.ini) Path: /etc/php5/cli

Loaded Configuration File:         /etc/php5/cli/php.ini

Scan for additional .ini files in: /etc/php5/cli/conf.d

Additional .ini files parsed:      /etc/php5/cli/conf.d/curl.ini,

/etc/php5/cli/conf.d/pdo.ini,

/etc/php5/cli/conf.d/pdo_sqlite.ini,

/etc/php5/cli/conf.d/sqlite.ini,

/etc/php5/cli/conf.d/sqlite3.ini,

/etc/php5/cli/conf.d/xdebug.ini,

/etc/php5/cli/conf.d/xsl.ini

This comes from the local dev-machine and the second line is the one to look at to find the php.ini location. However, if it’s not listed there, it will be found on the first line.

Another Way to Locate the php.ini File

If you need to find the php.ini location quickly, you can use:

php -i | grep php.ini

This will tell you the php command-line application for running a phpinfo(). You will get it in text format and it will be filtered through grep to find the location, which will look like:

Configuration File (php.ini) Path => /etc/php.ini

What is php.ini?

The php.ini file is a PHP special file used for various types of PHP, such as suPHP. This is the part of the code where you can make changes to your PHP settings, revert back to the default settings, edit the file or create a new text file called php.ini.

Within cPanel, the php.ini location is:

/home/username/php.ini

When using Plesk for VPS you will find it here:

/var/www/vhost/$DOMAIN/etc/php.ini

You will need to replace username with your cPanel user name and $DOMAIN with your domain name when locating the php.ini file this way.

Making Changes to the php.ini File via cPanel QuickConfig

Making changes to the php.ini file doesn’t have to be hard. You can use the “php.ini QuickConfig” utility found within your cPanel. It’s located in the “Software/Services” section of the admin area.

Start by logging into cPanel and locating the “php.ini QuickConfig” utility in “Software/Services”. Click on it and enable QuickConfig, if it’s not already enables.

Now you can modify the settings however you see fit and just click the “save changes” button when you’re done.

When you make changes to your php.ini file in this manner, it will overwrite any current PHP settings on your account.

Common Reasons for Modifying the php.ini File

There are many different reasons why you may need to modify the php.ini file. One of the most common reasons to find the php.ini location and change the setting is if you’re moving from a non-secure PHP environment to suPHP.

Another reason you may need to change the settings of this file is if you are running PHP as APACHE module, as CGI or as a custom PHP CGI setup.  Sometimes errors are encountered and the php.ini file must be modified to fix those errors.

PHP Settings You Cannot Change

With some types of hosting, you cannot change certain PHP settings. Shared and reseller hosting typically come with limits on what you can and cannot change. These limits are put in place to ensure the stability of the server.

However, if you’re using VPS or dedicated hosting, you won’t have the same limits when it comes to changing the settings of the php.ini file. Most hosting companies allow you to change all of the PHP settings with VPS or dedicated hosting.

The shared and reseller hosting PHP settings you cannot change include:

safe mode = Off (cannot adjust)

memory_limit = 256M (MAXIMUM)

max_execution_time = 30 (MAXIMUM in seconds)

max_input_time = 60 (MAXIMUM in seconds)

post_max_size = 64M (MAXIMUM)

upload_max_filesize = 64M (MAXIMUM)

enable_dl = Off (cannot adjust)

These same settings can be adjusted with VPS and dedicated hosting package. However, changing these settings to an incorrect configuration of the server can lead to poor performance or even cause the server to crash. Most hosting companies recommend that you don’t change the PHP settings from the default settings, unless there is a valid reason for making the changes.

Should You Change the php.ini File?

Unless you have the technical knowledge and a good reason for changing the php.ini file, you shouldn’t change it. Making the wrong changes can lead to major issues. However, there are good reasons for changing the PHP settings of your hosting. If you don’t know how to do this properly, it’s best to contact technical support for help.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Please enter the answer: Time limit is exhausted. Please reload CAPTCHA.

ITX Design is a Web Hosting and Domain Registration provider. We provide dedicated servers, shared web hosting, and domain registration for small businesses including Reseller Hosting, FFmpeg Hosting and Christian Web Hosting.
featured on the news
Switch to mobile version