Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 668683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:04:04+00:00 2026-05-14T00:04:04+00:00

Running Mac OS X 10.5.8, with PHP 5.2.11 Pre-installed. Using Coda 1.6.10. I’m writing

  • 0

Running Mac OS X 10.5.8, with PHP 5.2.11 Pre-installed. Using Coda 1.6.10.

I’m writing PHP files, and then preview them running from file, not server. This was working fine till I tried PHP includes. These don’t work as a relative path, only as an absolute from the root of the drive.

Is there any way I can use statements like

include_once “common/header.php”;

without specifying my entire file path like so :

include_once “/Volumes/Macintosh HD/Users/neil/Desktop/Website/ColoredLists_v1.0/common/base.php”;

,where ColoredLists_v1.0 is the directory with all the website files in it. I tried solutions like prepending _SERVER[DOCUMENT_ROOT] or dirname(File) to the file paths, but that didn’t work as the variables were not set. Is there any easy way to do this, or a configuration I can change so that it looks in a specific directory by default instead of looking at the drive root? Currently, echo_include_path shows .:

When I include this line at the start of the script, it works:

set_include_path(‘/Volumes/Macintosh HD/Users/neil/Desktop/Website/ColoredLists_v1.0’);

However, if I want to do this for all my scripts, I can’t seem to make the change permanent. Even after I edited the Unix include_path in my php.ini, it doesn’t seem to work.

UPDATE: I finally decided that the easiest sureshot way was to run the Apache server locally. It comes preinstalled with Mac, so didnt face much trouble there. I modified the httpd.conf to only allow connections from localhost, thus alleviating my security fears. Ofcourse, this still opens up port 80, but I’m behind a router, so I’m gonna hope I’m not very exposed. And Coda includes a great features in ‘Sites’, where I can set the local url, so it works brilliantly now. Only downside is, now, after code edits, I need to manually refresh the preview.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T00:04:04+00:00Added an answer on May 14, 2026 at 12:04 am

    You can try this method.

    require_once(dirname(__FILE__) . '/example.php');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am running Mac OSX 10.5.8. I installed matplotlib using macports. I get some
I am on a Mac running Netbeans 6.9. I downloaded and installed LWJGL using
I have installed Propel 1.5.6 onto my Mac, running PHP 5.12.14 via MacPorts. I've
Lately, I have been trying to compile php on my old PPC mac running
I'm running XAMPP for Mac. When I first started working with PHP, I would
I installed Boost with homebrew( brew install boost ) on my Mac running Lion
I recently installed python 2.7.2 on my Mac running OSX 10.6.8. Previously, I had
Running: MAMP 2.0.5 PHP 5.3.6 (bundled with MAMP) Mac OS X Lion 10.7.2 My
I'm trying to kill a long running PHP process on the Mac (Lion), running
I'm running Mac OS X Snow Leopard and wan't to access the Display from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.