Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to setup a symbolic link for a directory and I am getting the strangest error. I am using:

mklink /d C:\www\site\inc C:\inc

where C:\inc\script.php is the file I need to run. This seems simple enough, and it does work the first time I execute the script (by accessing http://localhost/inc/script.php). After that however, I get an error and cannot get the script to execute successfully again until I delete and recreate the symbolic link (even shutting down Apache or restarting Windows has no effect).

Note that everything else is running normally, the symbolic link does work, and Apache does have permission to access C:\inc and also has FollowSymLinks enabled. Here is the error I am getting:

Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0

Fatal error: Unknown: Failed opening required 'C:/inc/script.php' (include_path='.;C:\php5\pear') in Unknown on line 0

Does anyone know what the deal is with the Unknown on line 0, and why would it execute exactly one time before giving this error?

share|improve this question
all whats needed is Capital D and must be running cmd line as admin – user85684 Jun 13 '11 at 21:36
up vote 4 down vote accepted

Why not just use Alias in Apache to achieve what you want rather than using NTFS SymLinks?

Put this in your httpd.conf:

Alias /inc "C:/inc"

<Directory "C:/inc">
    Options Indexes FollowSymLinks
    AllowOverride all
    Order allow,deny
    Allow from all
share|improve this answer
I tried using an alias, but the problem is there is a rewrite rule that redirects everything that is not a file or directory to index.php (RewriteCond %{REQUEST_FILENAME} !-f & RewriteCond %{REQUEST_FILENAME} !-d). This is a system that was originally designed on Linux (where the sym links work fine), so I would rather not clutter up the rewrite rules to exclude specific directories (there are actually multiple /inc directories I need to get access to). – chawkinsuf Jan 21 '11 at 16:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .