參觀我的【 伊生活小舖】

2014年1月9日 星期四

Change APACHE default php.ini values upload limite 2MB using .htaccess

Put there in php.ini
upload_max_filesize = 10M
post_max_size = 10M

Or you can put these in .htaccess: 先由xp編輯後再copy to mac .
php_value upload_max_filesize 10M
php_value post_max_size 10M
Replace 10M with anything you want.

When u want save it...
I had changed the permissions using the 'get info' and then adjusting the sharing and permissions from there.
I had changed three areas. First I changed the private folder, then the etc folder then the php.ini file to all read and write settings.

As you might be knowing that php.ini is the configuration file for the PHP and resides at the server. It contains all the options/settings for the PHP language. There are instances you need to change these options. In local environment you can change these settings very easily but when on remote server you do not have permission to edit/change this file.

Before you can overwrite the php.ini values, you need to have the following two lines present at the top of your .htaccess file to make the changes work.
AllowOverride Options
AllowOverride All
Following is the way to set values in php.ini using .htaccess. For example if you want to enable PHP error log and turn on the error display using .htaccess you will need to write the following in your .htaccess file.
php_flag display_errors On
php_flag log_errors On
There are two kind of directives which can be set in .htaccess. php_value for the string type of values and php_flag for the boolean values. In the above example we used later to set the errors on which is a boolean value. An example to set php_value  would be to change the default memory limit and default post size.
php_value post_max_size 8M
php_value memory_limit 32M
You can change the values of various options listed in php.ini via .htaccess. Hope this helps.


Ratings and Recommendations by outbrain