Bug 288809 - php.ini include_path overridden by eclipse
Summary: php.ini include_path overridden by eclipse
Status: CLOSED NOT_ECLIPSE
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 minor with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: PHP UI CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-08 05:54 EDT by scott quakkelaar CLA
Modified: 2020-05-14 11:27 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description scott quakkelaar CLA 2009-09-08 05:54:44 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2
Build Identifier: 20090621-0832

i hope this isn't a repost - i searched and searched, but found nothing.  maybe this is expected behaviour.

i have the following include_path in my php.ini file, which is the .ini file picked up by php outside of eclipse:

;***** Added by go-pear
; appended by me
include_path = ".;C:\Program Files\PHP\pear;C:\Program Files\PHP\smarty\libs"
;*****

when i am in the debugger, however, my Smarty.class.php file is not found.  why?  i see this in the console:
PHP Warning:  require(Smarty.class.php): failed to open stream: No such file or directory in F:\data\apache\html\smarty\index.php on line 4
PHP Fatal error:  require(): Failed opening required 'Smarty.class.php' (include_path='.;F:\data\apache\html\workspace.3.5\smarty') in F:\data\apache\html\smarty\index.php on line 4

so i do a phpinfo(), and i find that eclipse is using a php.ini in a temp directory.  
Loaded Configuration File => F:\temp\windows\zend_debug\session6646935088367937444.tmp\php.ini
Scan this dir for additional .ini files => (none)
additional .ini files parsed => (none)

i diff this with my own global php.ini, and other than spaces, i find that the new php.ini has included at the top of the file the path referenced directly above, and omitted my own path:
include_path=".;F:\data\apache\html\workspace.3.5\smarty"

;***** Added by go-pear
; appended by me
;*****

i can work around this by setting the include path explicitly for every project, but that should be unnecessary when there are global libraries to be included on every project.

in the PHP Executables option, i did set the php.ini to point to my global php.ini.  looks like it's picking it up ok, but just overrriding the include_path.

Reproducible: Always

Steps to Reproduce:
1.create a new project
2.require a user lib outside the workspace
3.debug or run
Comment 1 Michael Spector CLA 2009-09-14 03:42:36 EDT
Yes, include_path is generated automatically (using your original PHP.ini file as a template) from the Include Path defined on PHP project that you're debugging. So, in order to have Smarty added to the include_path directive setup your PHP project in Eclipse to have Smarty included into Include Path.
Comment 2 scott quakkelaar CLA 2009-09-14 03:51:26 EDT
(In reply to comment #1)
> Yes, include_path is generated automatically (using your original PHP.ini file
> as a template) from the Include Path defined on PHP project that you're
> debugging. So, in order to have Smarty added to the include_path directive
> setup your PHP project in Eclipse to have Smarty included into Include Path.

thanks for your response.  maybe i wasn't clear.

i meant to say that eclipse is picking up my php.ini file, but it's ignoring the include_path in that file.

this is in my php.ini:
;***** Added by go-pear
; appended by me
include_path = ".;C:\Program Files\PHP\pear;C:\Program Files\PHP\smarty\libs"
;*****

this is what ends up in my eclipse php.ini file:
include_path=".;F:\data\apache\html\workspace.3.5\smarty"
...
;***** Added by go-pear
; appended by me
;*****

in the include_path, the ...\workspace.3.5\smarty is my workspace, with a project named smarty, NOT the smarty library that's included in my global php.ini.

hope that clarifies the problem.
Comment 3 Michael Spector CLA 2009-09-14 04:01:28 EDT
I think you misunderstand how this works. "include_path" directive is generated automatically from your Eclipse workspace status, in order to represent one-to-one  relation between developing & debugging/running. In order to setup the resulted include_path you need to arrange your project's Include Path properly. It can be achieved using 'right-click' -> Include Path -> ...
Comment 4 scott quakkelaar CLA 2009-09-14 04:10:11 EDT
(In reply to comment #3)
> I think you misunderstand how this works. "include_path" directive is generated
> automatically from your Eclipse workspace status, in order to represent
> one-to-one  relation between developing & debugging/running. In order to setup
> the resulted include_path you need to arrange your project's Include Path
> properly. It can be achieved using 'right-click' -> Include Path -> ...

ok.  i wondered if that was expected behaviour.

how can i set global includes, then, to be included by all projects automatically?  that would be the point of pulling in the global php.ini.
Comment 5 Michael Spector CLA 2009-09-14 04:22:09 EDT
(In reply to comment #4)
> (In reply to comment #3)
> > I think you misunderstand how this works. "include_path" directive is generated
> > automatically from your Eclipse workspace status, in order to represent
> > one-to-one  relation between developing & debugging/running. In order to setup
> > the resulted include_path you need to arrange your project's Include Path
> > properly. It can be achieved using 'right-click' -> Include Path -> ...
> 
> ok.  i wondered if that was expected behaviour.
> 
> how can i set global includes, then, to be included by all projects
> automatically?  that would be the point of pulling in the global php.

There's no way to specify global includes at this point. Can you report a feature request, if you think it's reasonable to add such a feature? Thanks!
Comment 6 Gadi Goldbarg CLA 2010-01-20 03:56:52 EST
This issue is not Eclipce relevant.
Closing...

Kalin Yanev
kalin.a@zend.com
Comment 7 Matthieu CLA 2010-03-18 12:22:00 EDT
(In reply to comment #6)
> This issue is not Eclipce relevant.
> Closing...
> 
> Kalin Yanev
> kalin.a@zend.com

How is that not Eclipse relevant ????

To what is that relevant then ? I have this problem and don't understand how this is not going to be fixed.
Comment 8 Andre Baumeier CLA 2010-09-01 05:23:25 EDT
This is should be fixed. On a normal development system using a lamp/ mamp whatever configuration one usually does the main settings in the php.ini - eclipse overwrites the include_path which results in strange behaviour: missing PHPUnit, Zend, Pear and so on.

There are two possible solves for this:

1. just append the project directory to include_path
2. include a function for setting global include_paths which can be everywhere on the machine, not limited to the project directory

In my opinion the first solution is the best because everything else will be confusing.
Comment 9 Andre Baumeier CLA 2010-09-01 05:24:52 EDT
this problem is also not limited to one platform: PC Windows XP its a general problem.