title: PHP: How to set current working directory to be same as directory executing the script
body: <p>I'm in the process of transferring my website from one server to another.  I have some php scripts that use the is_readable function which uses the current working directory.  </p>
  
  <p>On the old server, when I call getcwd(), it outputs the folder in which the script is being executed.  On the new server it outputs the root directory '/'.  </p>
  
  <p>I would like to know how I can configure PHP to use the current folder instead of '/'.  <strong>I don't want to have to change any PHP code that already works on the old server. I can configure the new server, but don't know what settings to change.</strong> I'm using apache2, if that helps.</p>
  
  <p>EDIT: It seems as though my working directory is not root like I thought.  When I create a testFile.php and echo getcwd() it shows the directory the php file is in.  But in my problem file, in the same directory, getcwd() shows up as '/'</p>