{"id":1646,"date":"2012-04-09T09:43:05","date_gmt":"2012-04-09T04:13:05","guid":{"rendered":"http:\/\/www.prasadgupte.com\/blog\/?p=1646"},"modified":"2012-04-09T09:43:38","modified_gmt":"2012-04-09T04:13:38","slug":"phpinfo-ini-file-path-web-address","status":"publish","type":"post","link":"https:\/\/www.prasadgupte.com\/blog\/phpinfo-ini-file-path-web-address\/","title":{"rendered":"Something for your empty home"},"content":{"rendered":"<p>Here are few lines of code that I have repeatedly found useful, especially when moving home between different web hosts.<\/p>\n<p>Print the complete address of the page from where it is hosted:<\/p>\n<blockquote><p>&lt;?php<br \/>\n$pageURL = $_SERVER[&#8216;HTTPS&#8217;] == &#8216;on&#8217; ? &#8216;https:\/\/&#8217; : &#8216;http:\/\/&#8217;;<br \/>\n$pageURL .= $_SERVER[&#8216;SERVER_PORT&#8217;] != &#8217;80&#8217; ? $_SERVER[&#8220;SERVER_NAME&#8221;].&#8221;:&#8221;.$_SERVER[&#8220;SERVER_PORT&#8221;].$_SERVER[&#8220;REQUEST_URI&#8221;] : $_SERVER[&#8216;SERVER_NAME&#8217;] . $_SERVER[&#8216;REQUEST_URI&#8217;];<br \/>\necho $pageURL;<br \/>\n?&gt;<\/p><\/blockquote>\n<p>Everyone knows about phpInfo &#8211; a dump of all the PHP settings:<\/p>\n<blockquote><p>&lt;?php\u00a0phpinfo(); ?&gt;<\/p><\/blockquote>\n<p>When using a shared host that allows overriding your PHP ini file, it is worth while knowing the path from where the file is loaded:<\/p>\n<blockquote><p>&lt;?php var_dump( get_cfg_var(&#8216;cfg_file_path&#8217;) ); ?&gt;<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Here are few lines of code that I have repeatedly found useful, especially when moving home between different web hosts. Print the complete address of the page from where it is hosted: &lt;?php $pageURL = $_SERVER[&#8216;HTTPS&#8217;] == &#8216;on&#8217; ? &#8216;https:\/\/&#8217; : &#8216;http:\/\/&#8217;; $pageURL .= $_SERVER[&#8216;SERVER_PORT&#8217;] != &#8217;80&#8217; ? $_SERVER[&#8220;SERVER_NAME&#8221;].&#8221;:&#8221;.$_SERVER[&#8220;SERVER_PORT&#8221;].$_SERVER[&#8220;REQUEST_URI&#8221;] : $_SERVER[&#8216;SERVER_NAME&#8217;] . $_SERVER[&#8216;REQUEST_URI&#8217;]; echo $pageURL; &hellip; <a href=\"https:\/\/www.prasadgupte.com\/blog\/phpinfo-ini-file-path-web-address\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Something for your empty home<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[728],"tags":[795,101,794],"class_list":["post-1646","post","type-post","status-publish","format-standard","hentry","category-code","tag-config-file-path","tag-php","tag-phpinfo"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/posts\/1646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/comments?post=1646"}],"version-history":[{"count":0,"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/posts\/1646\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/media?parent=1646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/categories?post=1646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.prasadgupte.com\/blog\/wp-json\/wp\/v2\/tags?post=1646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}