Php ini ubuntu location
There are several ways to find the php.ini file location in Ubuntu and Centos Linux servers. It is also interesting to note that there are usually several php.ini files on the server. Here will show you how to find the file and determine which one is the active configuration file. Show Using Locate to Find php.ini File LocationUse the following command to get a list of all of the php.ini files.
This will give an output similar to this:
The above output may not be very helpful in drilling down to the active php.ini file location. You can use the PHP CLI to get the configuration file that is being used in your setup with the following command:
From the output look for the line similar to this:
You can also use the following to retrieve the same output:
With the expected result being:
You can use PHPs phpinfo function as follows:
With the following as the result.
In case you need to get the php.ini file location for the settings used by the webserver you will need to use the following function from within a PHP file created in the web server document root and accessed from a web browser.
There you have it you should now be able to find the php.ini file location in Ubuntu and Centos Linux servers including determining the one that is active. Found this article interesting? Follow Brightwhiz on Facebook, Twitter, and YouTube to read and watch more content we post. IntroductionPHP is a server side scripting language used by many popular CMS and blog platforms like WordPress and Drupal. It is also part of the popular LAMP and LEMP stacks. Updating the PHP configuration settings is a common task when setting up a PHP-based website. Locating the exact PHP configuration file may not be easy. There are multiple installations of PHP running normally on a server, and each one has its own configuration file. Knowing which file to edit and what the current settings are can be a bit of a mystery. This guide will show how to view the current PHP configuration settings of your web server and how to make updates to the PHP settings. PrerequisitesFor this guide, you need the following:
There are many web server configurations with PHP, but here are two common methods:
This tutorial is applicable to these DigitalOcean One-click Apps as well:
Note: This tutorial assumes you are running Ubuntu 14.04. Editing the All the commands in this tutorial should be run as a non-root user. If root access is required for the command, it will be preceded by Reviewing the PHP ConfigurationYou can review the live PHP configuration by placing a page with a To create a file with this command, first change into the directory that contains your website files. For example, the default directory for webpage files for Apache on Ubuntu 14.04 is
Then, create the
Paste the following lines into this file and save it: info.php
Note: Some DigitalOcean One-click Apps have an When visiting the This page can be used to reveal the current settings your web server is using. For example, using the Find function of your web browser, you can search for the settings named post_max_size and upload_max_filesize to see the current settings that restrict file upload sizes. Warning: Since the Modifying the PHP ConfigurationThe Sometimes a PHP application might need to allow for larger upload files
such as uploading themes and plugins on a WordPress site. To allow larger uploads for your PHP application, edit the
The default lines that control the file size upload are: php.ini
Change these default values to your desired maximum file upload size. For example, if you needed to upload a 30MB file you would changes these lines to: php.ini
Other common resource settings include the amount of memory PHP can use as set by php.ini
or php.ini
When you have the Restart the web server to enable the changes. For Apache on Ubuntu 14.04, this command will restart the web server:
Refreshing the ConclusionMany PHP-based applications require slight changes to the PHP configuration. By using the Where is the PHP ini file located?user. ini file is the default configuration file for running applications that require PHP. It is used to control variables such as upload sizes, file timeouts, and resource limits. This file is located on your server in the /public_html folder.
Where is PHP ini file Linux?ini is usually located in /etc/php/8.1/fpm/php.
|