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 1107255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:54:42+00:00 2026-05-17T01:54:42+00:00

php include_once is failing for me with the failed to open stream: No such

  • 0

php include_once is failing for me with the “failed to open stream: No such file or directory” message, despite the existence of the file it is complaining about, and chmod’ing to 777 in order to try to mitigate the problem.

warning: include_once() [function.include]: Failed opening ‘../i_utility/WCHelper.php’ for inclusion (include_path=’.:/usr/share/pear:/var/www/html/we_/’) in /var/www/i_/php/w_corner/modules/i_ers/i_ers.module on line 6.

From the command line I can cd to the directory containing the source code file (/var/www/i_/php/w_corner/modules/i_ers), and I can ls the file about which php complains “no such”: ../i_utility/WCHelper.php

Indeed, I can do the above after su’ing to the apache user, and can even touch the file and see its last modified timestamp changed:

-bash-3.2$ whoami
apache

-bash-3.2$ cd /var/www/i_/php/w_corner/modules/i_ers
-bash-3.2$ ls -l ../i_utility/WCHelper.php
-rwxrwxrwx 1 root root 32112 Sep 14 09:49 ../i_utility/WCHelper.php

-bash-3.2$ touch ../i_utility/WCHelper.php
-bash-3.2$ ls -l ../i_utility/WCHelper.php
-rwxrwxrwx 1 root root 32112 Sep 27 17:08 ../i_utility/WCHelper.php

In light of all of the above, what could be causing PHP’s include_once to fail under these circumstances?

  • 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-17T01:54:43+00:00Added an answer on May 17, 2026 at 1:54 am

    PHP’s include paths are a bit counter-intuitive, especially when you feed it relative paths. You’d expect the path to be relative to the current file (just like with CSS for example), but PHP interprets them as relative to the current working directory, which is usually the directory where the entry point PHP file resides (e.g. /var/www/my_site/index.php).

    The easiest fix is to make use of dirname(__FILE__), which always maps to the absolute location of the current script file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to redirect to a specific path based on HTTP_HOST or SERVER_NAME
I have a snippet to create a 'Like' button for our news site: <iframe
This is beyond both making sense and my control. That being said here is
I was reading JavaScript: The Good Parts and the author mentions that JavaScript is
I'm trying to build a C++ extension for python using swig. I've followed the

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.