abhig10
abhig10

Reputation: 555

Change php.ini settings without modifying the original php.ini file or using the htaccess

The default php.ini value on my server for file uploading(upload_max_filesize, post_max_size) is 10M. I wanted to increase it to 40M. How do I do that?

Method 1: I can't use. This method doesn't work in this specific case.

ini_set("upload_max_filesize", "40M");
ini_set("post_max_size", "40M");

Method 2: I can't do it using the htaccess either. Because when I do so my server changes my .htaccess file with the following error

# For security reasons, mod_php is not used on this server. Use a php.ini file for php directives

Method 3: And I don't want to make changes to the default php.ini file because that will change the settings throughout the whole server.

Method 4: I have heard that I can create a php.ini file in my site and define the settings there but it didn't work either. My code for that file. (I kind of have a feeling that I applied this method in a wrong way)

[PHP]

upload_max_filesize =40M
post_max_size =40M

Upvotes: 0

Views: 1831

Answers (2)

user2251168
user2251168

Reputation: 1

On Bluehost cpanel PHP Configuration I selected PHP 5.2 "All files with the extension .php will be handled by the PHP 5.2 engine. Legacy PHP with security updates. Compatible with most environments. "

To eliminate the "#For security reasons, mod_php is not used on this server. Use a php.ini..." message.

Upvotes: 0

abhig10
abhig10

Reputation: 555

Well, method 4 worked for me as I thought. I just had to do it the right way. Adding this specific line to my .htaccess file reads the newly created php.ini file in that folder.

AddHandler application/x-httpd-php5 .php

Upvotes: 1

Related Questions