Keetah
Keetah

Reputation: 271

Eclipse - PHP Include Path

I´m working with Eclipse 3.4.2 with PDT. I´ve added some libraries in the applications folder, and add that folder to the PHP Include Path.

When I run as script, it works perfect, but if I access the page outside eclipse, the libraries are not accesible, i need to add this line:

set_include_path( implode(PATH_SEPARATOR, array(realpath('../application'), get_include_path(),)) );

Is this necesary? how can avoid this?

Upvotes: 1

Views: 2023

Answers (2)

Kel
Kel

Reputation: 7780

You may also specify path in include() statement, but it's not very convenient.

Also, you may specify corresponding include_path value in php.ini configuration file (see here for details), but usually this directive contains path to system-wide libraries, not application-specific paths.

If you are using OOP, you may implement your own class-loader, which will look for classes in specific directories. See this article for details.

Upvotes: 1

Alex Pliutau
Alex Pliutau

Reputation: 21957

Yes. It is necessary. Because PHP interpreter should know, from what folders load libraries.

Upvotes: 1

Related Questions