{"id":9401,"date":"2021-01-09T04:19:35","date_gmt":"2021-01-09T09:19:35","guid":{"rendered":"http:\/\/local.brightwhiz\/?p=9401"},"modified":"2021-12-04T06:10:53","modified_gmt":"2021-12-04T06:10:53","slug":"view-phpinfo-output-command-line-linux","status":"publish","type":"post","link":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/","title":{"rendered":"How to View phpinfo() Output From Command-line in Linux"},"content":{"rendered":"\n

Here we show you a few ways on how to view the phpinfo() output from the command-line in Linux<\/a> as an alternative to Apache<\/a> or Nginx<\/a> web servers.<\/p>\n\n\n\n

Usually,<\/strong> to invoke the phpinfo(), users go through the process of creating a PHP<\/a> file such as info.php<\/strong> somewhere on your web server such as the document root then insert the following code into the file:<\/p>\n\n\n\n

The file can be executed on a web server from the web browser to print out details about the PHP setup by going to http:\/\/localhost\/info.php<\/strong><\/em>.<\/p>\n\n\n\n

phpinfo() is a PHP function that outputs information about PHP’s configuration. Read more about it in this post<\/a>.<\/p>\n\n\n\n

View phpinfo() Output From Command-line<\/h2>\n\n\n\n

From your command line you can run the following command to get the configuration from the default php.ini<\/strong> file:<\/p>\n\n\n\n

$ php -i<\/code><\/pre>\n\n\n\n

You can also use it in interactive mode:<\/p>\n\n\n\n

$ php -a\nInteractive shell\n\nphp > phpinfo();<\/code><\/pre>\n\n\n\n

You can also run it the command line:<\/p>\n\n\n\n

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

Or even run the function phpinfo()<\/em> on the shell directly:<\/p>\n\n\n\n

$ php -r phpinfo();<\/code><\/pre>\n\n\n\n

The problem with the above commands is that you get to echo the phpinfo() output from the default php.ini<\/strong> file. In the real world, you will find PHP setups with more than one configuration. The most common is where you have two configurations, one for the CLI and the second for Apache. If you use PHP-fpm you will have yet another configuration file.<\/p>\n\n\n\n

The situation can get more complicated depending on your Linux distro. For example, Ubuntu and other major distros would further split the three configuration files into the PHP version.<\/p>\n\n\n\n

To get around this you have to tell PHP which configuration you want to print out using the following example:<\/p>\n\n\n\n

$ php -c \/etc\/php\/7.4\/fpm\/php.ini -i<\/code><\/pre>\n\n\n\n

The above example prints out the phpinfo() output from the php.ini file that is used by PHP-fpm and PHP version 7.4.<\/p>\n","protected":false},"excerpt":{"rendered":"

Here we show you a few ways on how to view the phpinfo() output from the command-line in Linux as an alternative to Apache or Nginx web servers. Usually, to…<\/p>\n","protected":false},"author":1,"featured_media":9402,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,23,9,16,18],"tags":[58,106,193,354,400,452,526,573,635,638],"yoast_head":"\nHow to View phpinfo() Output From Command-line in Linux<\/title>\n<meta name=\"description\" content=\"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers\" \/>\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\/view-phpinfo-output-command-line-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to View phpinfo() Output From Command-line in Linux\" \/>\n<meta property=\"og:description\" content=\"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers\" \/>\n<meta property=\"og:url\" content=\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\" \/>\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-01-09T09:19:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-04T06:10:53+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.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\/view-phpinfo-output-command-line-linux\/#article\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\"},\"author\":{\"name\":\"Michael Bright\",\"@id\":\"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32\"},\"headline\":\"How to View phpinfo() Output From Command-line in Linux\",\"datePublished\":\"2021-01-09T09:19:35+00:00\",\"dateModified\":\"2021-12-04T06:10:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\"},\"wordCount\":306,\"publisher\":{\"@id\":\"http:\/\/local.brightwhiz\/#organization\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg\",\"keywords\":[\"Apache\",\"Browsers\",\"DevOps\",\"Linux\",\"Nginx\",\"PHP\",\"Security\",\"Systems Administration\",\"Web\",\"Web Development\"],\"articleSection\":[\"Articles\",\"Guides\",\"How To\",\"Technology\",\"Tools\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\",\"url\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\",\"name\":\"How to View phpinfo() Output From Command-line in Linux\",\"isPartOf\":{\"@id\":\"http:\/\/local.brightwhiz\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage\"},\"image\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage\"},\"thumbnailUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg\",\"datePublished\":\"2021-01-09T09:19:35+00:00\",\"dateModified\":\"2021-12-04T06:10:53+00:00\",\"description\":\"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers\",\"breadcrumb\":{\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage\",\"url\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg\",\"contentUrl\":\"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg\",\"width\":1200,\"height\":630,\"caption\":\"phpinfo() Output\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/local.brightwhiz\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to View phpinfo() Output From Command-line in 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 View phpinfo() Output From Command-line in Linux","description":"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers","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\/view-phpinfo-output-command-line-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to View phpinfo() Output From Command-line in Linux","og_description":"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers","og_url":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/","og_site_name":"Brightwhiz.com","article_publisher":"https:\/\/www.facebook.com\/brightwhiz\/","article_published_time":"2021-01-09T09:19:35+00:00","article_modified_time":"2021-12-04T06:10:53+00:00","og_image":[{"width":1200,"height":630,"url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.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\/view-phpinfo-output-command-line-linux\/#article","isPartOf":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/"},"author":{"name":"Michael Bright","@id":"http:\/\/local.brightwhiz\/#\/schema\/person\/81f0f3126f13834ae2e7f381b3028e32"},"headline":"How to View phpinfo() Output From Command-line in Linux","datePublished":"2021-01-09T09:19:35+00:00","dateModified":"2021-12-04T06:10:53+00:00","mainEntityOfPage":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/"},"wordCount":306,"publisher":{"@id":"http:\/\/local.brightwhiz\/#organization"},"image":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg","keywords":["Apache","Browsers","DevOps","Linux","Nginx","PHP","Security","Systems Administration","Web","Web Development"],"articleSection":["Articles","Guides","How To","Technology","Tools"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/","url":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/","name":"How to View phpinfo() Output From Command-line in Linux","isPartOf":{"@id":"http:\/\/local.brightwhiz\/#website"},"primaryImageOfPage":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage"},"image":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage"},"thumbnailUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg","datePublished":"2021-01-09T09:19:35+00:00","dateModified":"2021-12-04T06:10:53+00:00","description":"Here we show you a few way on how to view the phpinfo() output from the command-line in Linux as an alternat to Apache or Nginx web servers","breadcrumb":{"@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#primaryimage","url":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg","contentUrl":"http:\/\/local.brightwhiz\/wp-content\/uploads\/2021\/01\/phpinfo-Output.jpg","width":1200,"height":630,"caption":"phpinfo() Output"},{"@type":"BreadcrumbList","@id":"http:\/\/local.brightwhiz\/view-phpinfo-output-command-line-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/local.brightwhiz\/"},{"@type":"ListItem","position":2,"name":"How to View phpinfo() Output From Command-line in 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\/9401"}],"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=9401"}],"version-history":[{"count":0,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/posts\/9401\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media\/9402"}],"wp:attachment":[{"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/media?parent=9401"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/categories?post=9401"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/local.brightwhiz\/wp-json\/wp\/v2\/tags?post=9401"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}