The root of my installation directory is http://www.WEBSITE.com/wiki/, and index.php is located in that directory. Since I have other software packages installed on my web server, I have them all installed in respective subdirectories. /wiki/ is the one for Mediawiki
the api.php file is located at the same place as your index.php, the
so called "root". usually not a url with /wiki/
example:
http://foo/api.php
not
http://foo/wiki/api.php