Link to home
Start Free TrialLog in
Avatar of lfabbric
lfabbric

asked on

Custom php.ini or equiv.

I registered a domain and am setup with a hosting company, one thing I am trying to do is upload a file greater then 2M, I was able to modify a .htaccess file to modify the upload_max_filesize to 1024M, and that worked, but the post_max_size would not set the value.

.htaccess
#-----------------------------------
php_value post_max_size 1024M
php_value upload_max_filesize 1024M
#-----------------------------------

Because upload_max_filesize stays at the default of 8M It will not modify this value.

ini_set() does not work.  So the last solution I can think of is too upload a custom php.ini file.

If anyone know how to set this up.  please help.
Avatar of harwantgrewal
harwantgrewal
Flag of Australia image

there is nothing much problem just know where is your php.ini file download it modify it and upload it and restart your server.

Harry
Avatar of lfabbric
lfabbric

ASKER

I do not have access to do this.  Someone is hosting my site, otherwise I would.
Have you tried this

echo ini_set("upload_max_filesize","100MB");

Sets the value of the given configuration option. Returns the old value on success, FALSE on failure. The configuration option will keep this new value during the script's execution, and will be restored at the script's ending.

Harry
Actually yes.  

I used:
if(ini_set("upload_max_filesize", "4M")
  echo "Worked";
else
  echo "Failed";


Try this it worked with me

<?
if(ini_set("upload_max_filesize", "4M")){
 echo "Worked";
}
else{
 echo "Failed";
}
?>

Harry
Im sorry,

If you do the exact same thing

<?
if(ini_set("post_max_size", "4M")){
echo "Worked";
}
else{
echo "Failed";
}
?>

This will fail everytime.

The upload_max_filesize works fine for me as well.

(I am actually having problems with post_max_size, not upload_max_filesize)

I can set upload_max_filesize to any value I want, through set_ini or .htaccess.  But not the post_max_size.

neither ini_set or .htaccess will set those values.
Oh that is the case

see post_max_size,sendmail_path,user_dir,user_dir these are the example of SYSTEM ini attribute and Entry can be set in php.ini or httpd.conf not else where


Harry
Or take a look at this url

http://www.php.net/ini_set

Harry
from the doc:
post_max_size integer
Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize.

If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

check memory_limit
look for few things

http://www.php.net/manual/en/configuration.directives.php#ini.memory-limit

try to work on memory limit...
regards
It doesn't complain when I modify the memory_limit (Yet it also doesn't show with phpinfo())

I do not believe memory limit is enabled.

Could someone test to see if this works with a version of apache and php.

create a .htaccess file within your webroot.

.htaccess
 php_value upload_tmp_dir          /var/tmp
 php_value post_max_size           1024M
 php_value file_uploads               On
 php_value upload_max_filesize      1024M
 php_value memory_limit               20M

And set all same values within your php.ini to a different value.

And then restart apache, I just want to see if restarting apache fixes this problem.
Do you have access to httpd.conf of php.ini as the post_max_file can be set in anyof two I also mentioned before.

Harry
Please read the link they mentioned it that you can change in php.ini and httpd.conf file only. Sorry for my previos comment its post_max_size

http://www.php.net/ini_set

Harry
My site is being hosted by someone else, and they refused to set that one parameter, so I am stuck trying to set this parameter.
So if they are not allowing you to use this parameter why not use ftp instead of biguploads. If you want it

Harry
Becuase I want them to be able to upload through a web forum.  I have to put the file within a database as well other information.
I think then there is no solution what I suggest you that ask you host to increase the upload file size. Or do one thing what every you take information from the use which he is going to key in take the value and put into database and take the upload file and use ftp function to upload to the perticulat directory.

Harry
A request for a refund has been made.  Experts, you have 72 hours to object or I intend to grant the request.

SpideyMod
Community Support Moderator @Experts Exchange
ASKER CERTIFIED SOLUTION
Avatar of SpideyMod
SpideyMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial