{"id":264,"date":"2012-10-24T22:54:56","date_gmt":"2012-10-24T22:54:56","guid":{"rendered":"http:\/\/pixert.com\/blog\/?p=264"},"modified":"2012-10-24T22:55:42","modified_gmt":"2012-10-24T22:55:42","slug":"php-find-path-to-base-directory","status":"publish","type":"post","link":"https:\/\/pixert.com\/blog\/php-find-path-to-base-directory\/","title":{"rendered":"PHP : Find Path to Base Directory"},"content":{"rendered":"<p><a href=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" data-attachment-id=\"64\" data-permalink=\"https:\/\/pixert.com\/blog\/how-to-check-what-php-version-running-on-linux\/php\/\" data-orig-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif?fit=120%2C67&amp;ssl=1\" data-orig-size=\"120,67\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;}\" data-image-title=\"php\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif?fit=120%2C67&amp;ssl=1\" data-large-file=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif?fit=120%2C67&amp;ssl=1\" class=\"alignright size-full wp-image-64\" title=\"php\" src=\"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/php.gif?resize=120%2C67\" alt=\"\" width=\"120\" height=\"67\" \/><\/a><\/p>\n<p>This script output the path to your base directory (aka &#8220;Document Root&#8221;), this code also useful to debug PATH in PHP errors<\/p>\n<pre class=\"brush: plain; title: Code Block; notranslate\" title=\"Code Block\">&lt;?php print ($_SERVER&#x5B;'DOCUMENT_ROOT']); ?&gt;<\/pre>\n<p>This script output \u00a0the path to your base directory with current working dir<\/p>\n<pre class=\"brush: plain; title: Code Block; notranslate\" title=\"Code Block\">&lt;?php echo getcwd(); ?&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This script output the path to your base directory (aka &#8220;Document Root&#8221;), this code also useful to debug PATH in PHP errors &lt;?php print ($_SERVER&#x5B;&#8217;DOCUMENT_ROOT&#8217;]); ?&gt; This script output \u00a0the path to your base directory with current working dir &lt;?php echo getcwd(); ?&gt;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[54],"tags":[55,39],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-code-snippet","tag-code-snippet-2","tag-php"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1pvi1-4g","jetpack-related-posts":[{"id":191,"url":"https:\/\/pixert.com\/blog\/how-to-add-pinterest-pin-it-to-wordpress\/","url_meta":{"origin":264,"position":0},"title":"How to Add Pinterest &#8220;Pin It&#8221; to WordPress","author":"Pixel Insert \/ Pixert","date":"February 14, 2012","format":false,"excerpt":"Pinterest is a vision board-styled social photo sharing website and app where users can create and manage theme-based image collections. Users of Pinterest curate themed image boards, populating them with media found online using the \"Pin It\" button, or uploaded from their computer. Each such item of media is known\u2026","rel":"","context":"In &quot;WordPress&quot;","block_context":{"text":"WordPress","link":"https:\/\/pixert.com\/blog\/category\/wordpress\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":105,"url":"https:\/\/pixert.com\/blog\/facebook-share-button\/","url_meta":{"origin":264,"position":1},"title":"Facebook Share Button","author":"Pixel Insert \/ Pixert","date":"May 14, 2011","format":false,"excerpt":"Facebook Share is one of the most powerful and simple ways for users to share articles, pages, video, or Flash content from your site with their friends on Facebook. Over 1 billion pieces of content are shared each week on Facebook, and many of those are links shared using Facebook\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/05\/fbshare.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":141,"url":"https:\/\/pixert.com\/blog\/fatal-error-out-of-memory-in-wordpress\/","url_meta":{"origin":264,"position":2},"title":"Fatal Error : Out of Memory in WordPress","author":"Pixel Insert \/ Pixert","date":"October 2, 2011","format":false,"excerpt":"WP_MEMORY_LIMIT option allows you to specify the maximum amount of memory that can be consumed by PHP. This setting may be necessary in the event you receive a message such as \"Allowed memory size of xxxxxx bytes exhausted\". This setting increases PHP Memory only for WordPress, not other applications\u00a0WordPress will\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":314,"url":"https:\/\/pixert.com\/blog\/wordpress-add-title-to-img-tag-using-get-the-image-plugin\/","url_meta":{"origin":264,"position":3},"title":"WordPress: Add Title to IMG tag using Get The Image plugin","author":"Pixel Insert \/ Pixert","date":"October 29, 2013","format":false,"excerpt":"Get The Image plugin from Justin Tadlock is awesome, a script that can grab an image by custom field input, WordPress' featured image, post attachment, or extracting it from the post's content. Recently, someone asked about how to add Title to IMG tag. We know ALT attributes in IMG tag,\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/screenshot-1.jpg?fit=1138%2C742&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/screenshot-1.jpg?fit=1138%2C742&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/screenshot-1.jpg?fit=1138%2C742&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/screenshot-1.jpg?fit=1138%2C742&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2013\/10\/screenshot-1.jpg?fit=1138%2C742&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":259,"url":"https:\/\/pixert.com\/blog\/flickr-badges-open-new-window-jquery-way\/","url_meta":{"origin":264,"position":4},"title":"Flickr Badges Open New Window jQuery way","author":"Pixel Insert \/ Pixert","date":"October 1, 2012","format":false,"excerpt":"I recently added a Flickr Badge to a site and really loved everything about it except that there was no way to have it open the photos in a new window when they were clicked Flickr badge looked like the following - Username [php] <div id=\"flickr_badge_wrapper\"> <script type=\"text\/javascript\" src=\"http:\/\/www.flickr.com\/badge_code_v2.gnecount=10&display=latest&size=s&layout=x&source=user&user=username\"><\/script><\/div> [\/php]\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":289,"url":"https:\/\/pixert.com\/blog\/full-screen-background-on-wp-login-page\/","url_meta":{"origin":264,"position":5},"title":"Full Screen Background on WP Login Page","author":"Pixel Insert \/ Pixert","date":"March 5, 2013","format":false,"excerpt":"The following function add full screen background on WP Login page 1. Open functions.php in your theme directory 2. Add this function to functions.php [text] \/\/ LOGIN - full background function my_login_style() { ?> <style type=\"text\/css\"> body.login { background:url('http:\/\/yourwebsiteaddress.com\/wp-content\/uploads\/wploginbg.jpg') no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size:\u2026","rel":"","context":"In &quot;Code Snippet&quot;","block_context":{"text":"Code Snippet","link":"https:\/\/pixert.com\/blog\/category\/code-snippet\/"},"img":{"alt_text":"WordPress - the logo","src":"https:\/\/i0.wp.com\/pixert.com\/blog\/wp-content\/uploads\/2011\/03\/wordpresslogo-300x68.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/comments?post=264"}],"version-history":[{"count":0,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/posts\/264\/revisions"}],"wp:attachment":[{"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/media?parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/categories?post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pixert.com\/blog\/wp-json\/wp\/v2\/tags?post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}