PHP.INI Changes


#1

I compiled my own PHP (and I’m a newb at it too). If I make changes to PHP.INI, do I need to restart Apache? The change I make seems to have no effect.

Thanks.

Onwards,

Matt


#2

You do not need to restart Apache. If the changes you’re making aren’t effecting your site, then I recommend to make sure you’re using Your PHP and editing the file in the right place.

Create a file with a single line: <? phpinfo(); ?> and then view it in the browser. In the top section, you will see your compile options and “Configuration File (php.ini) Path.” This configuration file path will be a Directory when it’s /not/ reading a php.ini (ie; going by defaults). When you have your php.ini file in place, it will read that.

And important note; it’s php.ini not PHP.INI. Case DOES matter in Linux.


yerba# rm -rf /etc
yerba#


#3

[quote]I compiled my own PHP (and I’m a newb at it too). If I make changes to PHP.INI, do I need to restart Apache? The change I make seems to have no effect.

You do not need to install PHP. If the changes you’re making aren’t effecting your site, then I recommend to make sure you’re using Your PHP and editing the file in the right place.[/quote]
With all due respect, my experience differs with this.
To explain: My website designs often require that I compensate for browser compatibilities (…if only IE could somehow die in a fire…) so I need to keep my browscap.ini updated; the DH copy of this file appears to be either non-existent or ancient beyond utility. I have tried setting an appropriately-updated php.ini file with the following:browscap = /home/yourname/www.yourdomian.com/php_browscap.ini using the DH-native Apache-based PHP and it had no effect at all; worked just dandy using my own compiled version.

However if you do compile your own PHP, the datum for “Configuration File” from phpinfo() is definitely where the php.ini is located and should be appropriately modified and you must also have the appropriate .htaccess file with the following lines:AddHandler phpFive .php Action phpFive /cgi-bin/php.cgi …in order to make Apache use the appropriate CGI script for PHP. It is also worthy to note that if either of the php.ini or the .htaccess file is uploaded in the inappropriate MSWindows text format that it may be ineffective or cause your site to fail altogether (…a 500-level error) respectively, so have a care when fiddling with config files.


#4

errr, proof read for the loose, I meant you do not need to restart Apache. 0.o

browsecap.ini? I never even herd of that file. That is not a PHP config file, which is why “the DH copy of this file appears to be either non-existent or ancient beyond utility”. There is no such file in PHP or even Apache. A quick search on the net shows this is an IIS specific config file.

Notepad puts in ^M, aka carriage returns (\r) at the end of all the lines, just before the new line character. Because of this, it will cause Apache to error out. It’s highly recommended NEVER use Notepad, Wordpad or MS Word on ANY text based file you plan to upload to a Unix based server. Use an editor that can understand and safe files using only New Line (\n). I recommend checking out SciTE. I’ve abolished Notepad on my Windows box and exclusively use SciTE.

yerba# rm -rf /etc
yerba#


#5

Let it never be said that I ain’t helpful:
http://us2.php.net/manual/en/function.get-browser.php

Again, I beg to differ; see the above link and also:
http://browsers.garykeith.com/downloads.asp
…if you use the php_browscap.ini file for commercial purposes be sure to send Mr. Keith a donation of some kind; he’s pretty good about maintaining that info and it’s all kinds of useful. Two particulary notable uses:

  • Set browser-specific CSS and content functions. This is helpful when dealing with popular non-W3C-CSS-compliant browsers (…grumble) and also providing alternative content for WAP devices and vision-impaired (braille) web clients.
  • Ban content to (…and sometimes poison) certain nasty web-harvesting 'bots and crawlers. It helps (in a very small way) to curtail things like harvesting of individual and role account emails from contact pages, and also adds an extra layer of protection against form abuse.
    I also plan to use the get_browser() function in some future applications to provide default language/character-set content.

In short, it’s damn nifty.


#6

Thanks guys, this is wonderful reading. Please keep posting lots of cool information. :slight_smile:

Reason I’m having to mess with the php.ini file is that I’m using a php-based forum and I’m getting the following error message:

(changed the directory name to protect the guilty)

So I’m told that I need to make changes in the php.ini file and the .htaccess file. I remember reading about some of the .htaccess changes above but have not made them. Will post back.

Onwards,

Matt


#7

Don’t change the ini file for that error. As it said, the method your using is being deprecated. The correct fix would be to remove the ‘&’ from the line that’s throwing the error.

[quote]Let it never be said that I ain’t helpful:
http://us2.php.net/manual/en/function.get-browser.php[/quote]
Interesting. But, I did notice down at the bottom: browscap.ini is not bundled with PHP, but you may find an up-to-date php_browscap.ini file here.. Which would explain why it’s not on the DH servers. :slight_smile:

I also find this interesting, it’s from the link provided by php.net:

[quote]browscap.ini
The standard version of my browscap.ini file for IIS 5.x and greater.[/quote]
Why does it say IIS 5.x and greater? 0.o


yerba# rm -rf /etc
yerba#