+5 votes
211 views
Locate php.ini on my server

in Guides by (552k points)
reopened | 211 views

1 Answer

+3 votes
Best answer

How to locate php.ini active on my server.

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.

image

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

image

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.


by (3.5m points)

Related questions

+4 votes
2 answers
+5 votes
1 answer
asked Aug 9, 2019 in Guides by backtothefuture (552k points) | 434 views
+3 votes
1 answer
asked Aug 9, 2019 in Guides by backtothefuture (552k points) | 253 views
+3 votes
1 answer
asked Aug 9, 2019 in Guides by backtothefuture (552k points) | 377 views
+3 votes
1 answer
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users