There are many new users in the administration of systems that after reading a guide or tutorial to configure PHP are at a great crossroads
, where is the file php.ini of my server?
In this article we will propose a simple and practical way to
locate php.ini
and thus be able to edit it for a basic configuration.
All the steps in this tutorial have been tested on a server with Ubuntu 14.04 on which they are installed: Apache, MariaDB and PHP5. PHP is a very common programming language and they use the most popular CMS, such as WordPress or Drupal. Remember that
editing the php.ini file
was something that solved most of the
problems when uploading files to WordPress
.
How to locate php.ini active on my server.
Many times on the servers there are several
php.ini
configuration files, so it is important to learn to locate the active configuration file of our server.
The first step will be to locate the folder or directory in which the files on your web page are stored.
In my case it will be the default directory of an Apache installation on Ubuntu, that is, the directory:
/var/www/html/
Secondly we will create a file called
info.php
, as I am working in the Ubuntu console I use the following command:
nano /var/www/html/info.php
Within this file I add the following line:
<?php phpinfo(); ?>
I save the content with the
CTRL+O
key combination and exit the nano editor with the
CTRL+X
key combination.
Finally I visit this file through the browser by typing its URL, for example:
https://www.vozidea.com/info.php
Obviously, where it says
www.vozidea.com
you must put the name of your website or if it still does not have any domain name assigned you can use the IP of the server.
Now we are shown on the screen a lot of information about the configuration of our PHP installation, but we must pay attention to the section where it says
"Loaded Configuration File"
, where we see that it indicates the
location of the php.ini file
, which in my case en
/etc/php5/apache2/php.ini
Once we locate the active
php.ini
is very important to delete the file
info.php
, since anyone could access it and get sensitive information about the configuration of our server.
Remember that in order for the changes you make in the
php.ini
file to be effective you must restart the server, in my case I would restart Apache with the command:
service apache2 restart
And with these simple instructions we have everything ready, in case of doubt you can use the comments to ask.