{"id":565,"date":"2021-07-05T08:02:23","date_gmt":"2021-07-05T13:02:23","guid":{"rendered":"https:\/\/www.knownhost.com\/kb\/?p=565"},"modified":"2021-12-01T06:40:48","modified_gmt":"2021-12-01T12:40:48","slug":"how-can-i-make-a-phpinfo-file","status":"publish","type":"post","link":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/","title":{"rendered":"How can I make a phpinfo file?"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 ez-toc-wrap-right counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #212121;color:#212121\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #212121;color:#212121\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#getting_or_creating_the_file\" >Getting or Creating the File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#uploading_the_file\" >Uploading the File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#accessing_the_file\" >Accessing the File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#removing_the_file\" >Removing the File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#advanced_usage\" >Advanced Usage<\/a><\/li><\/ul><\/nav><\/div>\n\n<p>Occasionally, while troubleshooting issues with a site, it can be useful to see all in one place all the current configuration for php affecting a particular folder or file. This can be done with the php function&nbsp;<a href=\"http:\/\/php.net\/manual\/en\/function.phpinfo.php\">phpinfo<\/a>. Among other things, this function can tell you the currently loaded php modules, the currently loaded php settings, and predefined and environment variables.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"getting_or_creating_the_file\"><\/span>Getting or Creating the File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In its most basic form, a phpinfo file needs only one command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\n \n  \/\/ Show all information, defaults to INFO_ALL\n  phpinfo();\n \n?&gt;<\/code><\/pre>\n\n\n\n<p>Here, we add a comment&nbsp;and a couple of blank lines to help make it easier to read. You will need to copy and paste this text into a plain text file.<\/p>\n\n\n\n<p>If creating the file yourself, make sure the whole file contains only the exact text in the code box above. Make sure there are no extra invisible characters. Sometimes text editors such as Notepad might include extra characters in files. If you are using a Windows machine to create the file, you may want to use a different text editor such as&nbsp;<a href=\"https:\/\/notepad-plus-plus.org\/\">Notepad++<\/a>. It is also very important that the filename end in&nbsp;<code>.php<\/code>&nbsp;and not&nbsp;<code>.php.txt<\/code>. Depending on your operating system, you may need to check if your file manager is configured to show file extensions, in order to check this.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"uploading_the_file\"><\/span>Uploading the File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Once the file has been created, it can be uploaded to somewhere within the documentroot of the site. For cPanel servers, the cPanel&nbsp;<a href=\"https:\/\/documentation.cpanel.net\/display\/ALD\/File+Manager\">File Manager<\/a>&nbsp;is probably one of the easiest ways to do this. If you are more comfortable with&nbsp;<a href=\"https:\/\/www.knownhost.com\/kb\/how-to-configure-filezilla-to-upload-files-via-sftp\/\">FTP<\/a>&nbsp;or&nbsp;<a href=\"https:\/\/documentation.cpanel.net\/display\/ALD\/Web+Disk\">Web Disk<\/a>&nbsp;for example, those should also work. Make sure the file has the user and group ownership both set to the cPanel user, and that the file permissions are 644. How to check and adjust this will vary depending on the method used to upload the file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"accessing_the_file\"><\/span>Accessing the File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Once the file has been uploaded with the correct permissions and ownership, you can view your new phpinfo page with your web browser. For example, if the file was placed at&nbsp;<code>\/home\/cpuser\/public_html\/phpinfo.php<\/code>&nbsp;within the server, then its url might be&nbsp;<code>http:\/\/domain.tld\/phpinfo.php<\/code>. If it was uploaded correctly, it should look like several tables, with setting\/variable names in the left column, and values in the right one or two columns. If there is a specific setting you are looking for, you can use your web browser&#8217;s search function&nbsp;to help you find it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"removing_the_file\"><\/span>Removing the File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>It is very important not to leave the phpinfo file active any longer than necessary. The information it provides can be very useful to you during troubleshooting, but it can also be very useful to potential attackers who may be trying to get information from your server about what versions or modules might be installed, which could give them clues for what types of attacks to try. Using a phpinfo file for a short period of time to get php environment information during the troubleshooting process is usually safe, but it is important to remove it (or block access to it)\u00a0as soon as you are finished using it. There are\u00a0<a href=\"https:\/\/www.knownhost.com\/kb\/how-to-connect-with-ssh\/\">a\u00a0variety\u00a0of\u00a0ways<\/a>\u00a0to accomplish this.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"advanced_usage\"><\/span>Advanced Usage<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Advanced users may wish to instruct the phpinfo function to only print some of the information. The function has a parameter for this which you can read more details about in the&nbsp;<a href=\"http:\/\/php.net\/manual\/en\/function.phpinfo.php\">php documentation<\/a>. For most users, the default&nbsp;should work fine.<\/p>\n\n\n\n<p>Another thing advanced users may occasionally have cause to try, is using the phpinfo function within existing scripts. Because php scripts can sometimes change some of the php functions, it might be useful while debugging specific scripts to add phpinfo lines inside those specific scripts, to check if the environment still has the same settings and variable values as expected, at the specific places within the script where the debugging is needed. If doing this, make sure to remove these extra debugging function calls when you are finished with them.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Occasionally, while troubleshooting issues with a site, it can be useful to see all in one place all the current configuration for php affecting a particular folder or file. This can be done with the php function&nbsp;phpinfo. Among other things, this function can tell you the currently loaded php modules, the currently loaded php settings, [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[177,109,143,128,123,145,144,125],"class_list":["post-565","post","type-post","status-publish","format-standard","hentry","category-getting-started","tag-cloud","tag-cpanel","tag-dedicated","tag-directadmin","tag-linux","tag-reseller","tag-shared","tag-vps"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How can I make a phpinfo file? - KnownHost<\/title>\n<meta name=\"description\" content=\"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How can I make a phpinfo file? - KnownHost\" \/>\n<meta property=\"og:description\" content=\"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/\" \/>\n<meta property=\"og:site_name\" content=\"KnownHost\" \/>\n<meta property=\"article:published_time\" content=\"2021-07-05T13:02:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-01T12:40:48+00:00\" \/>\n<meta name=\"author\" content=\"Jonathan K. W.\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jonathan K. W.\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/\"},\"author\":{\"name\":\"Jonathan K. W.\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"headline\":\"How can I make a phpinfo file?\",\"datePublished\":\"2021-07-05T13:02:23+00:00\",\"dateModified\":\"2021-12-01T12:40:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/\"},\"wordCount\":676,\"commentCount\":0,\"keywords\":[\"cloud\",\"cpanel\",\"dedicated\",\"directadmin\",\"linux\",\"reseller\",\"shared\",\"vps\"],\"articleSection\":[\"Getting Started\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/\",\"name\":\"How can I make a phpinfo file? - KnownHost\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2021-07-05T13:02:23+00:00\",\"dateModified\":\"2021-12-01T12:40:48+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\"},\"description\":\"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/how-can-i-make-a-phpinfo-file\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How can I make a phpinfo file?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/\",\"name\":\"KnownHost\",\"description\":\"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knownhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/3db6e20d1f33519cd68fe0ba1230a48b\",\"name\":\"Jonathan K. W.\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g\",\"caption\":\"Jonathan K. W.\"},\"sameAs\":[\"https:\\\/\\\/www.knownhost.com\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How can I make a phpinfo file? - KnownHost","description":"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.","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":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/","og_locale":"en_US","og_type":"article","og_title":"How can I make a phpinfo file? - KnownHost","og_description":"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.","og_url":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/","og_site_name":"KnownHost","article_published_time":"2021-07-05T13:02:23+00:00","article_modified_time":"2021-12-01T12:40:48+00:00","author":"Jonathan K. W.","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Jonathan K. W.","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#article","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/"},"author":{"name":"Jonathan K. W.","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"headline":"How can I make a phpinfo file?","datePublished":"2021-07-05T13:02:23+00:00","dateModified":"2021-12-01T12:40:48+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/"},"wordCount":676,"commentCount":0,"keywords":["cloud","cpanel","dedicated","directadmin","linux","reseller","shared","vps"],"articleSection":["Getting Started"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/","url":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/","name":"How can I make a phpinfo file? - KnownHost","isPartOf":{"@id":"https:\/\/www.knownhost.com\/kb\/#website"},"datePublished":"2021-07-05T13:02:23+00:00","dateModified":"2021-12-01T12:40:48+00:00","author":{"@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b"},"description":"Need more information on the php version running on your server? Learn how to set up php info page to get more information about php.","breadcrumb":{"@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.knownhost.com\/kb\/how-can-i-make-a-phpinfo-file\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knownhost.com\/kb\/"},{"@type":"ListItem","position":2,"name":"How can I make a phpinfo file?"}]},{"@type":"WebSite","@id":"https:\/\/www.knownhost.com\/kb\/#website","url":"https:\/\/www.knownhost.com\/kb\/","name":"KnownHost","description":"KnownHost provides a comprehensive webhosting knowledge base to help answer many of your common webhosting and linux questions.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knownhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.knownhost.com\/kb\/#\/schema\/person\/3db6e20d1f33519cd68fe0ba1230a48b","name":"Jonathan K. W.","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f432b99e6651fe8d1deb57a285bd84e806f1c9ae8b4c6c585d7e3a0b33789ad9?s=96&d=mm&r=g","caption":"Jonathan K. W."},"sameAs":["https:\/\/www.knownhost.com"]}]}},"_links":{"self":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/565","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/comments?post=565"}],"version-history":[{"count":0,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/posts\/565\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/media?parent=565"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/categories?post=565"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knownhost.com\/kb\/wp-json\/wp\/v2\/tags?post=565"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}