LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-24-2013, 08:24 AM   #1
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Rep: Reputation: 0
want to disable htaccess from updating the default php values set in php.ini


In my development server PHP is installed as Apache module.

Some developers are changing php values for some projects by putting like "php_value memory_limit 512M" in htaccess file.

I want to block this. I want to disable htaccess from updating the default php values set in php.ini.

Since we are using htaccess for rewrite rules, I can't disable entire htaccess of the server. I just wanted to block htaccess from updating the default php values set in php.ini.

How can I do this ?

My server - CentOS - Apache/2.2.23, PHP 5.3.22

Last edited by nikeshp; 05-24-2013 at 08:34 AM.
 
Old 05-25-2013, 01:09 AM   #2
bloodstreetboy
Member
 
Registered: May 2012
Posts: 201
Blog Entries: 3

Rep: Reputation: 37
To prevent users setting PHP config values in .htaccess files, do not give AllowOverride Options permissions on their virtual hosts.

Alternatively, install PHP as CGI instead of as an Apache module, as the CGI version is unaffected by .htaccess files. However, since PHP 5.3.0, PHP CGI does parse per-directory php.ini files. I am not aware of a method that turns this off.

I've just seen this in the latest default php.ini:

Quote:
; Directives following the section heading [PATH=/www/mysite] only
; apply to PHP files in the /www/mysite directory. Directives
; following the section heading [HOST=www.example.com] only apply to
; PHP files served from www.example.com. Directives set in these
; special sections cannot be overridden by user-defined INI files or
; at runtime. Currently, [PATH=] and [HOST=] sections only work under
; CGI/FastCGI.
; http://php.net/ini.sections
So if you put directives in your main php.ini under per-directory headings they cannot be overridden. However, the downside is that you'll have to do this for every virtual host so it'll be a PITA in environments where there are many or where new ones are frequently added.

Further reading has revealed this:

Quote:
; Name for user-defined php.ini (.htaccess) files. Default is ".user.ini"
;user_ini.filename = ".user.ini"
; To disable this feature set this option to empty value
;user_ini.filename =
So just uncomment that last line to disable per-user ini files.
 
Old 05-26-2013, 08:09 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
This is one of the reasons Apache recommend NOT using htaccess files, but putting the reqd directives inside the relevant Dir tags
https://httpd.apache.org/docs/curren.../htaccess.html
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
php.ini:upload_max_filesize reverts to default when error_reporting = All geokker Linux - Server 4 07-11-2011 10:39 AM
[SOLVED] phpinfo display_errors not set to On after value set to On in php.ini famsinyi Programming 4 03-25-2011 07:41 PM
PHP won't recognize my Configuration File (php.ini) path kriezo Programming 4 02-14-2008 02:31 AM
php5 apache2 mysql4 don't work, php does not seem to read php.ini atom Linux - Software 5 03-24-2005 11:05 AM
php.ini / .htaccess memory issues rioguia Linux - Software 2 11-19-2004 01:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration