C.Pantelli
C.Pantelli

Reputation: 11

PHP include path isn't working on OS X

So ever since I got my Mac including files with PHP

Warning: include(Applications/XAMPP/xamppfiles/htdocs/social/include/core.php): failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/social/index.php on line 1

This is my php include:

<?php include("Applications/XAMPP/xamppfiles/htdocs/social/include/core.php") ?>

Any suggestions?

Upvotes: 0

Views: 1068

Answers (1)

swidmann
swidmann

Reputation: 2792

You simply forgot the starting slash /, so your code tries to include the file relative to your script.

You can try this include:

include("/Applications/XAMPP/xamppfiles/htdocs/social/include/core.php")

What also can be helpful, is using __DIR__ or the dirname() function.

Upvotes: 1

Related Questions