Solved

PHP includes issue

Posted on 2007-04-10
11
207 Views
Last Modified: 2013-12-13
PHP on Plesk / Linux

I have a custom app that I wrote and osCommerce installation.

If I want the custom app to work, I have to change php.ini's include directive to:

include_path = ".;/php/includes"

If I want the osCommerce install to work, I have to change it back to

include_path = ".:/php/includes"

The only difference is a semi colon versus a colon. How do I get them to both work at the same time?

______________________________
Error Messages
---------------------------------------------

When I have the semi colon in effect, osCommerce gives me:

Warning: main(includes/configure.php) [function.main]: failed to open stream: No such file or directory in /var/www/vhosts/domain.com/httpdocs/shop/catalog/includes/application_top.php on line 29

Warning: main(includes/configure.php) [function.main]: failed to open stream: No such file or directory in /var/www/vhosts/domain.com/httpdocs/shop/catalog/includes/application_top.php on line 29

Fatal error: main() [function.require]: Failed opening required 'includes/configure.php' (include_path='.;/php/includes') in /var/www/vhosts/domain.com/httpdocs/shop/catalog/includes/application_top.php on line 29

When I have th COLON in effect, I have:

Warning: main() [function.main]: open_basedir restriction in effect. File(/php/includes/lng.php) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) in /var/www/vhosts/domain.com/httpdocs/powerpanel/includes/classes/wysarea.class.php on line 16

Warning: main(lng.php) [function.main]: failed to open stream: Operation not permitted in /var/www/vhosts/domain.com/httpdocs/powerpanel/includes/classes/wysarea.class.php on line 16

Fatal error: main() [function.require]: Failed opening required 'lng.php' (include_path='.:/php/includes') in /var/www/vhosts/domain.com/httpdocs/powerpanel/includes/classes/wysarea.class.php on line 16
0
Comment
Question by:DrDamnit
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
  • +2
11 Comments
 
LVL 24

Expert Comment

by:glcummins
ID: 18882580
The semicolon is never valid in this setting. A colon is used to join two or more paths. If the custom application works with the semicolon, it needs to be altered to work using the correct format, a colon.
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18882616
Hello DrDamnit,

The format of include_path is like the system's PATH environment variable: a list of directories separated with a colon in Unix or semicolon in Windows.

i.e.

in *nix include_path will be
include_path=".:/php/includes"

In Windows include_path will be
include_path=".;c:\php\includes"

you cannot use both and this is set when PHP is installed on the machine...

HTH

!i!
0
 
LVL 48

Expert Comment

by:hernst42
ID: 18882634
The setings depends on your os. For Windows you need a ; to seperate the search pathes, on linux you must use the : to seperate the search pathes. See http://www.php.net/manual/en/function.set-include-path.php for more information
0
WordPress Tutorial 4: Recommended Plugins

Now that you have WordPress installed, understand the interface, and know how to install new parts, let’s take a look at our recommended plugins.

 
LVL 32

Author Comment

by:DrDamnit
ID: 18886443
THAT's the funny part. This is a linux box. FC4. So, when the setting is incorrect, one thing works, and when it is wrong something else works......

How do I get it so that EVERYTHING works?
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18887606
Hello DrDamnit

It might be something else causing problems... Please explain when there is problem and what php is pringins as an Error or Warning or whatever...

Because delimiter is a rule for php for a long time it is most likely the problem to be somewhere else...

Regards

!i!
0
 
LVL 48

Expert Comment

by:hernst42
ID: 18887798
On linux you must use the :
Maybe /php/includes is the wrin path should'nt it be more:  /var/www/vhosts/domain.com/php/includes
It depens where those global includes have been place by your webhoster and If he has added those files to the allowd dirs.
0
 
LVL 32

Author Comment

by:DrDamnit
ID: 18888876
ivostoykov:
What do you mean by pringins ? The error messages are in the original post.

hernst42:

What other information can I provide you so that we can see if I need to put the full path in there?
0
 
LVL 22

Expert Comment

by:Ivo Stoykov
ID: 18888898
Hello DrDamnit

Following message is quite descriptive... I've missed it

Warning: main() [function.main]: open_basedir restriction in effect. File(/php/includes/lng.php) is not within the allowed path(s): (/var/www/vhosts/domain.com/httpdocs:/tmp) in /var/www/vhosts/domain.com/httpdocs/powerpanel/includes/classes/wysarea.class.php on line 16

This means that the serve reject access to the supplied path and the reason is given -> "not within the allowed path(s):"

regards

!i!
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 500 total points
ID: 18889390
The script tries to include an lng.php locate that file and put the path into you include-path. If you still get open_basedir restriction contact your hoster to fix that bug (if you are unable to move that directory, else moe the directory into your document root. THen set the include_patch accordingly and it should run.
0
 
LVL 5

Expert Comment

by:PatrickAdrichem
ID: 18893562
How do you use then in your code to include?
files in your basic include dir should just be called by

include ('filename.php');

Could you post an include tag from both cases? from the script.
0
 
LVL 5

Expert Comment

by:PatrickAdrichem
ID: 18893572
Because in the first case it cannot locate the file
in the second case its redirected to: /var/www/vhosts/domain.com/httpdocs:/tmp
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question