Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

setting php include path on Windows XP?

Posted on 2008-11-02
7
Medium Priority
?
2,225 Views
Last Modified: 2013-12-13
I have an interesting problem.  I have PHP installed on the system root of a Windows XP install (G:\PHP)

In my php.ini (G:\Windows\php.ini) I have the include path set to:

include_path = .;G:\php\includes

If I run a simple phpinfo(); however, under "PHP Core" the include path shows up as:

.;C:\php5\pear

And as a result it's throwing the obvious errors.   Where then, is that directive pulling from?

The obvious fix (and one thats tested/works) is to just create that said directory on the C partition and shove my included files into there, but the C partition belongs to another user, and I'd prefer to fix it properly.

 My first thought was an errant php.ini but I confirmed the loaded config file as G:\WINDOWS\php.ini


Any suggestions?

Thanks!
0
Comment
Question by:jmoriarty
[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
  • 4
  • 3
7 Comments
 
LVL 13

Assisted Solution

by:AielloJ
AielloJ earned 2000 total points
ID: 22861812
The directive is being pulled from the Windows path.  The .ini file tells PHP how to find its files once it's running.  Next you have to tell Windows how to find the PHP files to get them running in the first place.  There's also a search order of how PHP looks for files.  I don't have the particulars in my head, but the process below will clear it up.

Add G:\WINDOWS to the default Windows path.  You can alter it by clicking on System in the Windows Control Panel, click on the Advanced tab, then click on the Environment Variables button at the bottom on the panel.
0
 

Author Comment

by:jmoriarty
ID: 22862652
Hi AielloJ,

Thanks for the comment! Unfortunately, that didn't fix it.  I'd already had G:\PHP in the environment path, and I did add G:\Windows like you suggested, but with, unfortunately, the same result.
0
 

Author Comment

by:jmoriarty
ID: 22862757
Hrm, maybe the problem is the format I'm using to set the directory? I was actually able to get it to change, I had forgotten quotes around the path, so it acted as if the line were commented I'm guessing.

I'm still getting weird include errors though.  

Here's what I have right now, to both set a specific directory (php\includes) and set the \includes directory one level above the current one. Is this the correct format to use for that on Windows?

include_path = "G:\php\includes; .\includes"

Thanks again.
0
Industry Leaders: 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!

 
LVL 13

Accepted Solution

by:
AielloJ earned 2000 total points
ID: 22864049
jmoriarty:

What drive is PHP installed on?  I've found the php.ini file must be installed in the Windows folder (Usually C:\Windows) and the folder PHP is installed in (Usually C:\PHP).  The include path should also include the current folder (the dot), the folder PHP is installed in, as well as the includes folder.  I also suggest that all relative paths (.\includes) be formatted as full paths.  You can't make any assumptions about the base path Windows, and any other program, is using.  Thus a relative path easily introduces errors.  The following is the path in my php.ini file.  If you install PHP on the G; drive, then you should be able to not have to place any files in the C partition, except for a copy of the .ini file in the Windows folder.

include_path = ".;c:\php;c:\php\includes"
0
 

Author Comment

by:jmoriarty
ID: 22864641
PHP is installed on G:, which is the same as Windows. Structurally speaking, everything is installed as you've said -- except under G: instead of C: i.e., G:\Windows, G:\PHP, etc.  with the php.ini under G:\Windows\php.ini.

It does seem to be more of a relative path issue at this point though.  

I.E., if I write:

include_once("classes\db.inc.php"); (where classes is a sub directory under the "includes" directory) it doesn't work, but if I use the full path of

include_once("G:\Inetpub\wwwroot\includes\classes\db.inc.php"); it works fine.  I suppose that's a solution, to fully qualify each file path, but there's a good 40 of 'em, so I was trying to find a better way to make relative paths work.

Thanks for the verification on the include_path directive as well.
0
 
LVL 13

Expert Comment

by:AielloJ
ID: 22865831
The php.ini file should also be in the G:\PHP directory.  I've found that it has to be in both places.
0
 

Author Closing Comment

by:jmoriarty
ID: 31512464
Thanks - sorry for the delay in response.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

660 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