Define php.ini path with .htaccess inside a Wordpress theme to change upload_file_size?
I have a wordpress blog. I made a custom page-template that allows users to upload files to my server. Just a simple php script which connects to my server with a form to select a file, blabla.. you know!
However the upload-feature doesn't make any sense with a max_upload_filesize of 2开发者_高级运维0mb. Now i want to change that. According to my hosting-provider it's REALLY EASY, but i think for normal people without experience in that field it's not. Anyway...
they told me i should create a .htaccess file where my upload-script is housed. So that's actually in my wordpess theme folder.
in the .htaccess file i should place "suPHP_ConfigPath" and the path to this directory.
so in my case this would be: (at least i think that's the path)
suPHP_ConfigPath /clientdata/n5200-2-dynamic/a/l/mydomain.com/www/wp-content/themes/mytheme/
Moreover i should create a php.ini file in the same directory that says:
upload_max_filesize = 500M ;
post_max_size = 500M ;
I did all of that and even created a info.php file in the same directory to check if the thing worked. However the php_info tells me still that the upload-size is set to 20mb.
Did I get anything wrong here? Do you guys have an idea what I'm doing wrong? Does the php_info in that case even tell me the truth and the script should normally work? or should the php_info tell me that the size is set to the value I changed it to?
First of all, create a test.php file in the theme folder and put this into it;
<?php
phpinfo();
?>
Run http://mydomain.com/.../test.php in a browser and find 'Configuration File Path' on the page. If it does not match the one you mentioned in .htaccess, then the .htaccess is not working. Verify the name of .htaccess file and first make sure .htaccess is actually working first. If not, call your hosting support to help you out.
If the configuration path is showing as the one you specified in .htaccess, then try putting these lines in the .htaccess file also and see if it works.
php_value upload_max_filesize "500000" php_value post_max_size "500000"
If htaccess is working, also trying changing the value of the numbers in php.ini to 500000, instead of 500M.
I Hope your problem gets solved soon.
php_value upload_max_filesize 500000000
php_value post_max_size 500000000
instead of that very strange thing you put there
However, it would work only with Apache mod_php
精彩评论