Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346376 - Running script from root directory in eclipse
Summary: Running script from root directory in eclipse
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: PHP Debug CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-19 03:45 EDT by RISHI CLA
Modified: 2020-05-14 11:23 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description RISHI CLA 2011-05-19 03:45:26 EDT
Build Identifier: v20100507

I have script that needs to run from root directory //htdocs.
There is some line of code that  says include_once 'includes/dboperations.php';.
menaing it has to check file from root directory //htdocs.
problem is when i try to debug the script using eclipse, it always asks me new folder. Can I run script from //hdocs folder, instead of creating new workspace and folder in eclipse.

Reproducible: Always
Comment 1 Zhongwei Zhao CLA 2011-05-19 09:46:42 EDT
I think you can use the menu:
File->Open File...
then choose the your php file under//htdocs,then run it
Comment 2 RISHI CLA 2011-05-20 03:39:10 EDT
(In reply to comment #1)
> I think you can use the menu:
> File->Open File...
> then choose the your php file under//htdocs,then run it

Sir, The Moment you open eclipse, it asks for work space. For example


<?php
echo $_SERVER['SERVER_NAME'];
echo "\n";
echo $_SERVER["DOCUMENT_ROOT"];
echo "\n";
echo $_SERVER["SCRIPT_FILENAME"];
?>

works fine if i run it directly from IE say //htdosc/test/testing.php

localhost C:/xampp/htdocs C:/xampp/htdocs/test/testing.php 
but when I run it in eclipse, it throws me error 
PHP Notice:  Undefined index: SERVER_NAME in C:\xampp\htdocs\test\test1\testing.php on line 2
PHP Stack trace:
PHP   1. {main}() C:\xampp\htdocs\test\test1\testing.php:0
Comment 3 Zhongwei Zhao CLA 2011-05-20 04:03:59 EDT
yes, you have to create a workspace if you want to use eclipse.
and your code works fine for me,you should choose Run As->PHP Web Page.
Comment 4 Bartlomiej Laczkowski CLA 2016-07-20 04:30:50 EDT
Here is the description and answer for the similar problem: http://stackoverflow.com/questions/14543606/wamp-getting-undefined-index-on-serverserver-name
As Zhao mentioned, using "Run As -> PHP Web Page" should do the job.

Marking this one as fixed.
Comment 5 Sylvia Tancheva CLA 2016-08-26 05:12:48 EDT
Closing