Forum Moderators: coopster

Message Too Old, No Replies

PHP.ini

about the php.ini file

         

maxi million

1:27 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



I am new here and don't know if a similar thread exists or not.

ok to get on with it...i am basically a php hobbyist and do my php development (for testing) on machine running win xp (please dont ban me for this...ill grow up soon) and have complete control over the php.ini.

but in reality my apps are hosted on shared linux server and so can not change any configuration over there.

i was wondering if its possible to change some vital php.ini configuration in my scripts which would override the default configs?

i can now control error reporting but can i similarly change the default include_path?

eg the default include_path is /usr/local/lib/php
id like to have it /home/includes

any help will be hugely appreciated

dreamcatcher

2:37 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ini_set() [us2.php.net] might be what you are after.

dc

ergophobe

4:49 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month




please dont ban me for this...ill grow up soon

I develop on a Win2K box and haven't been banned for it so far, so I think you're in the clear. And I don't plan to grow up any time soon in this respect or any other (old maybe, but not up!).

Anyway, php settings can be controlled in a variety of contexts

- runtime (with ini_set() in your script)
- per directory (with .htaccess)
- system (php.ini only).

So it depends on what you actually want to change. A complete list if which is which is available here:
[us2.php.net...]

maxi million

6:43 pm on Jun 30, 2005 (gmt 0)

10+ Year Member



Thanks a lot to both dreamcatcher and ergophobe

yes ini_set works for me...but only for the time being

i'll explain => im doing all my site configuration in a file called "config.php" which im including in all other files. typically id love to put even this ini_set directive there...as id mentioned my local development platform and production level platforms are different, the include paths would be different too. and i dont want any include file to be available in my public html directory. as a result right now im doing ini_set in every file and that somewhat defeats the whole purpose of wanting to have a config.php

as ergophobe suggested and the manuals say it can be done with .htaccess too. i think thats a better idea. problem is my .htaccess doesnt seem to be working. i tried:
php_value include_path c:/php/includes
and put that in c:/www/site_v2 (thats where my index.php is) which includes config.php (residing in c:/php/includes which in turn has ini_set directive). so id not require to do .htaccess everywhere.
that should have solved all my problems...but it doesnt. am i doing something wrong here?

and thanks ergophobe for reassuring me about win xp

:)

Philosopher

6:54 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I haven't had to mess with changing things in htaccess, but looking at the manuals they show an example syntax as being

php_value include_path ".:/usr/local/lib/php"

In your post it looks as if you are not placing quotes around your include path so I'd try that.

Also, try removing the drive letter and replacing it with the period as in above.

coopster

11:19 pm on Jun 30, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



On Windows you will need the drive letter as that is how the OS defines the root directory. *nix uses the slash (/).

The single dot just tells your include() that relative includes will work too, that is, it should also use the current working directory as part of the include_path.

An example of how to specify a single simple include path in Windows:

php_value include_path "C:/php/includes"

An example of how to use your current script working directory, plus the PEAR directory, and your own special includes directory:

php_value include_path ".;C:/php/PEAR;C:/php/includes"

maxi million

3:51 am on Jul 1, 2005 (gmt 0)

10+ Year Member



oh right...i missed the "s...not only in the post but in my .htaccess too

i hope ill be able to make it work now

Thanks a lot all of you...ill come back here with all my doubts...may be we can continue this thread to discuss future issues concerning php.ini

Thanks again