{"id":9585,"date":"2021-11-07T18:08:18","date_gmt":"2021-11-07T15:08:18","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9585"},"modified":"2021-12-03T13:22:58","modified_gmt":"2021-12-03T13:22:58","slug":"find-php-ini-file-location-ubuntu-centos","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/","title":{"rendered":"How to Find php.ini File Location in Ubuntu | Centos Linux"},"content":{"rendered":"\n

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.<\/p>\n\n\n\n

Using Locate to Find php.ini File Location<\/h2>\n\n\n\n

Use the following command to get a list of all of the php.ini files.<\/p>\n\n\n\n

$ locate php.ini<\/code><\/pre>\n\n\n\n

This will give an output similar to this:<\/p>\n\n\n\n

\/etc\/php\/7.2\/apache2\/php.ini\n\/etc\/php\/7.2\/cli\/php.ini\n\/etc\/php\/7.2\/fpm\/php.ini\n\/etc\/php\/7.3\/cli\/php.ini\n\/etc\/php\/7.4\/apache2\/php.ini\n\/etc\/php\/7.4\/apache2\/php.ini.save\n\/etc\/php\/7.4\/apache2\/php.ini.ucf-dist\n\/etc\/php\/7.4\/cli\/php.ini\n\/etc\/php\/7.4\/cli\/php.ini.ucf-dist\n\/etc\/php\/7.4\/fpm\/php.ini\n\/etc\/php\/7.4\/fpm\/php.ini.ucf-dist\n\/etc\/php\/8.0\/cli\/php.ini\n\/usr\/lib\/php\/5.6\/php.ini-development\n\/usr\/lib\/php\/5.6\/php.ini-production\n\/usr\/lib\/php\/5.6\/php.ini-production.cli\n\/usr\/lib\/php\/7.0\/php.ini-development\n\/usr\/lib\/php\/7.0\/php.ini-production\n\/usr\/lib\/php\/7.0\/php.ini-production.cli\n\/usr\/lib\/php\/7.1\/php.ini-development\n\/usr\/lib\/php\/7.1\/php.ini-production\n\/usr\/lib\/php\/7.1\/php.ini-production.cli\n\/usr\/lib\/php\/7.2\/php.ini-development\n\/usr\/lib\/php\/7.2\/php.ini-production\n\/usr\/lib\/php\/7.2\/php.ini-production.cli\n\/usr\/lib\/php\/7.3\/php.ini-development\n\/usr\/lib\/php\/7.3\/php.ini-production\n\/usr\/lib\/php\/7.3\/php.ini-production.cli\n\/usr\/lib\/php\/7.4\/php.ini-development\n\/usr\/lib\/php\/7.4\/php.ini-production\n\/usr\/lib\/php\/7.4\/php.ini-production.cli\n\/usr\/lib\/php\/8.0\/php.ini-development\n\/usr\/lib\/php\/8.0\/php.ini-production\n\/usr\/lib\/php\/8.0\/php.ini-production.cli<\/code><\/pre>\n\n\n\n

The above output may not be very helpful in drilling down to the active php.ini file location.<\/p>\n\n\n\n

You can use the PHP CLI to get the configuration file that is being used in your setup with the following command:<\/p>\n\n\n\n

$ php -i | grep 'php.ini'<\/code><\/pre>\n\n\n\n

From the output look for the line similar to this:<\/p>\n\n\n\n

Loaded Configuration File => \/etc\/php\/7.4\/cli\/php.ini<\/code><\/pre>\n\n\n\n

You can also use the following to retrieve the same output:<\/p>\n\n\n\n

$ php -r "echo php_ini_loaded_file().PHP_EOL;"<\/code><\/pre>\n\n\n\n

With the expected result being:<\/p>\n\n\n\n

\/etc\/php\/7.4\/cli\/php.ini<\/code><\/pre>\n\n\n\n

You can use PHPs phpinfo function as follows:<\/p>\n\n\n\n

$ php -r "phpinfo();" | grep php.ini<\/code><\/pre>\n\n\n\n

With the following as the result.<\/p>\n\n\n\n

Configuration File (php.ini) Path => \/etc\/php\/7.4\/cli\nLoaded Configuration File => \/etc\/php\/7.4\/cli\/php.ini<\/code><\/pre>\n\n\n\n

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.<\/p>\n\n\n\n

echo php_ini_loaded_file().PHP_EOL;<\/code><\/pre>\n\n\n\n

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.<\/p>\n","protected":false},"excerpt":{"rendered":"

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…<\/p>\n","protected":false},"author":1,"featured_media":9586,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,25,27,16],"tags":[58,154,354,424,452,598],"yoast_head":"\nHow to Find php.ini File Location in Ubuntu | Centos Linux<\/title>\n<meta name=\"description\" content=\"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Find php.ini File Location in Ubuntu | Centos Linux\" \/>\n<meta property=\"og:description\" content=\"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\" \/>\n<meta property=\"og:site_name\" content=\"Brightwhiz.com\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/brightwhiz\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-11-07T15:08:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-03T13:22:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Bright\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:site\" content=\"@brightwhizmag\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Bright\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"How to Find php.ini File Location in Ubuntu | Centos Linux\",\"datePublished\":\"2021-11-07T15:08:18+00:00\",\"dateModified\":\"2021-12-03T13:22:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\"},\"wordCount\":247,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg\",\"keywords\":[\"Apache\",\"Configuration\",\"Linux\",\"Open Source\",\"PHP\",\"Ubuntu\"],\"articleSection\":[\"Articles\",\"Guides\",\"How To\",\"Libraries\",\"Programming\",\"Technology\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\",\"url\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\",\"name\":\"How to Find php.ini File Location in Ubuntu | Centos Linux\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg\",\"datePublished\":\"2021-11-07T15:08:18+00:00\",\"dateModified\":\"2021-12-03T13:22:58+00:00\",\"description\":\"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg\",\"width\":1200,\"height\":630,\"caption\":\"Find php.ini File Location\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Find php.ini File Location in Ubuntu | Centos Linux\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/local.brightwhiz\/#website\",\"url\":\"http:\/\/local.brightwhiz\/\",\"name\":\"Brightwhiz.com\",\"description\":\"Best Tech guides, Tutorials, and News\",\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/local.brightwhiz\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/local.brightwhiz\/#organization\",\"name\":\"Brightwhiz\",\"url\":\"http:\/\/local.brightwhiz\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png\",\"width\":706,\"height\":135,\"caption\":\"Brightwhiz\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/brightwhiz\/\",\"https:\/\/twitter.com\/brightwhizmag\",\"https:\/\/instagram.com\/bright_whiz\/\",\"https:\/\/www.pinterest.com\/sobbayi\/\",\"https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\",\"name\":\"Michael Bright\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g\",\"caption\":\"Michael Bright\"},\"sameAs\":[\"https:\/\/sobbayi.com\"],\"url\":\"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Find php.ini File Location in Ubuntu | Centos Linux","description":"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/","og_locale":"en_US","og_type":"article","og_title":"How to Find php.ini File Location in Ubuntu | Centos Linux","og_description":"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros","og_url":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2021-11-07T15:08:18+00:00","article_modified_time":"2021-12-03T13:22:58+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg","type":"image\/jpeg"}],"author":"Michael Bright","twitter_card":"summary_large_image","twitter_creator":"@brightwhizmag","twitter_site":"@brightwhizmag","twitter_misc":{"Written by":"Michael Bright","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"How to Find php.ini File Location in Ubuntu | Centos Linux","datePublished":"2021-11-07T15:08:18+00:00","dateModified":"2021-12-03T13:22:58+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/"},"wordCount":247,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg","keywords":["Apache","Configuration","Linux","Open Source","PHP","Ubuntu"],"articleSection":["Articles","Guides","How To","Libraries","Programming","Technology"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/","url":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/","name":"How to Find php.ini File Location in Ubuntu | Centos Linux","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg","datePublished":"2021-11-07T15:08:18+00:00","dateModified":"2021-12-03T13:22:58+00:00","description":"Through this guide you will know how to find the active php.ini file location in Ubuntu\/Debian and Centos\/RHEL 7 Linux distros","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/find-php-ini-file-location.jpg","width":1200,"height":630,"caption":"Find php.ini File Location"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/find-php-ini-file-location-ubuntu-centos\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"How to Find php.ini File Location in Ubuntu | Centos Linux"}]},{"@type":"WebSite","@id":"http:\/\/local.brightwhiz\/#website","url":"http:\/\/local.brightwhiz\/","name":"Brightwhiz.com","description":"Best Tech guides, Tutorials, and News","publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/local.brightwhiz\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/local.brightwhiz\/#organization","name":"Brightwhiz","url":"http:\/\/local.brightwhiz\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/11\/brightwhiz-com-logo-orange.png","width":706,"height":135,"caption":"Brightwhiz"},"image":{"@id":"http:\/\/local.brightwhiz\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/brightwhiz\/","https:\/\/twitter.com\/brightwhizmag","https:\/\/instagram.com\/bright_whiz\/","https:\/\/www.pinterest.com\/sobbayi\/","https:\/\/www.youtube.com\/channel\/UC6sCdP_d_RiTIM7ErFT-PSQ"]},{"@type":"Person","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32","name":"Michael Bright","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/image\/","url":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","contentUrl":"http:\/\/1.gravatar.com\/avatar\/da90485875ff0aafa38fdd494abe87d1?s=96&d=mm&r=g","caption":"Michael Bright"},"sameAs":["https:\/\/sobbayi.com"],"url":"http:\/\/local.brightwhiz\/author\/sobbayiadmin\/"}]}},"_links":{"self":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/9585"}],"collection":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/comments?post=9585"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/9585\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/9586"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=9585"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=9585"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=9585"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}