How to Find MySQL PHP and Apache Configuration Files

How to Find MySQL PHP and Apache Configuration Files

A Linux system administrator needs to know some Linux tricks. In this article, you will learn How to Find MySQL PHP and Apache Configuration Files.

And to reach the purpose of the tutorial, we will learn a number of commands for locating the default configuration files for MySQL database server (my.conf), PHP programming language (php.ini) and Apache HTTP server (http.conf), which together with Linux form the LAMP (Linux Apache Mysql/MariaDB PHP) stack.

What is a configuration file? a config file contains system-related or application settings that give developers and administrators control over the operation of the system or an application.



How to Find MySQL PHP and Apache Configuration Files

Join us to learn the location of configuration files or mastering means of finding them, which is an invaluable skill for a Linux Sysadmin. In addition, let us explain that the /etc directory or its sub-directories store system related or application configuration files in Linux Directory Structure.

Although this is the primary location of configuration files. A few developers choose to store other configuration files in custom directories.


Buy Linux Virtual Private Server

Recommended Article: Tutorial Install FFmpeg on Ubuntu 20.04

How To Find MySQL (my.conf) Configuration File

You will use the following commands to display the mysql or mysqladmin help page. Which includes a section that talks about the files (configuration files) from which default options are read.

Note: The grep option -A displays NUM lines of trailing context after matching lines.

mysql --help | grep -A1 'Default options'  OR  mysqladmin --help | grep -A1 'Default options


Also, read

Tutorial Install the Latest phpMyAdmin on Ubuntu 20.04 Linux

How To Find PHP (php.ini) Configuration File

PHP can be controlled from the terminal using php command-line utility, in conjunction with the -i switch which enables showing of PHP information.

php -i | grep "Loaded Configuration File"  



Find Apache http.conf/apache2.conf Configuration File

You can administer apache2 using apache2ctl control interface as below with the V flag which shows the version and builds parameters of apache2. Or invoke apache2 directly which is not recommended in most cases.

--------- On CentOS/RHEL/Fedora ---------  apachectl -V | grep SERVER_CONFIG_FILE    --------- On Debian/Ubuntu/Linux Mint ---------  apache2ctl -V | grep SERVER_CONFIG_FILE


Good job! By finishing the tutorial, you learned How to Find MySQL PHP and Apache Configuration Files.


Dear user, we wish this tutorial would be helpful for you, to ask any question or review the conversation of our users about this article, please visit Ask page. Also to improve your knowledge, there are so many useful tutorials ready for Eldernode training.

View More Posts
Marilyn Bisson
Content Writer
Eldernode Writer
We Are Waiting for your valuable comments and you can be sure that it will be answered in the shortest possible time.

    Leave Your Comment

    Your email address will not be published.

    We are by your side every step of the way

    Think about developing your online business; We will protect it compassionately

    We are by your side every step of the way


    7 days a week, 24 hours a day