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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:29:09+00:00 2026-06-15T14:29:09+00:00

I use netbeans 7.2.1 and newest phpunit. When I want to generate a unit

  • 0

I use netbeans 7.2.1 and newest phpunit. When I want to generate a unit test in netbeans by right-clicking on the php class then Tools-> Create phpUnit test the Skeleton generator throws an error: No such file or directory.

require_once(/sharedResources/connection.inc.php): failed to open stream: No such file or directory

The issue is that the path displayed in require_once is wrong. It is generatedliek this:

$sharedResources = getenv("DOCUMENT_ROOT") . "/sharedResources";

and should resolve to the absolute file path. This works fine when application is running in apache. However it seems that getenv(“DOCUMENT_ROOT”) is just wrong when running from netbeans. My question is how I can set it correctly? My application is under

getenv("DOCUMENT_ROOT") . "/MyApp";

and the file I’m creating a test for is in

"MyApp/services"

Under Project properties there is an option web root but it is greyed out and it is impossible to set it to a folder one level higher than your application.

How can I solve this?

EDIT:

Further clarification:

I initially had a relative filepath to sharedResources which did not work also. the I changed to this one and of coruse ti makes sense it is not working as DOCUMENT_ROOT is set by apache and hence not set when running in netbeans. So a temprary fix is to add

$docRoot = getenv("DOCUMENT_ROOT");
if(empty($docRoot)){
    putenv("DOCUMENT_ROOT=C:/xampp/htdocs");
}

to the head of every class. of course that is not a very practical or good solution. I would need to tell netbeans to set this environment variable or to use correct relative path.

  • 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-06-15T14:29:10+00:00Added an answer on June 15, 2026 at 2:29 pm

    Well here is my solution. It’s not ideal but simple and works. The issue is that DOCUMENT_ROOT is obviously empty when script is not called by Apache but by netbeans. Hence it must somehow be set. To do that I edited the php file phpunit-skelgen(it does not have a file ending but it’s a php file).

    Below the license text as first php line I added

    putenv("DOCUMENT_ROOT=C:/xampp/htdocs");
    

    That did the trick.

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

Sidebar

Related Questions

I use NetBeans & Zend Tool (ZT). Then i create new project, ZT create
For example I use Netbeans for PHP and have started to integrate PHPUnit &
when i use netbeans and includes a class in a phpfile and then type
I have a php project with unit tests included. I use Netbeans for development
i use netbeans to check out projects from svn repo, then i edit the
I want to use the jetty httpclient (in netbeans) but have the least number
I use netbeans on windows platform to write my code and then I commit
I use Netbeans on my windows desktop to debug a PHP web application remotely
I use netbeans for all of my Linux development (C/C++, Php, Python, Symfony). I
I'm learning to use Netbeans and for my intro pet projects, I don't want

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.