www.webdeveloper.com
Results 1 to 7 of 7

Thread: How do I modify my phpinfo attributes?

Hybrid View

  1. #1
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364

    How do I modify my phpinfo attributes?

    I need to change the following attribute values that show up in phpinfo():

    Code:
    post_max_size - 8MB
    memory_limit - 40M
    max_execution_time - 50000
    How do I do this? I need to increase these numbers.

    Thanks,
    Multimediocrity

  2. #2
    Join Date
    Apr 2006
    Location
    Silicon Valley
    Posts
    20
    You need to modify your php.ini or call ini_set() in your script. http://php.net/manual/en/function.ini-set.php

  3. #3
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364
    Ok, I'm trying this. It doesn't seem to be working. here's what I'm doing:
    Code:
    ini_set('post_max_size', '1000M');
    ini_set('memory_limit', '1000M');
    ini_set('max_execution_time', 50000000);
    The phpinfo() still reports the old values, and it is still not working. Am I missing something?

  4. #4
    Join Date
    Apr 2006
    Location
    Silicon Valley
    Posts
    20
    Some PHP configurations disable this function on some or all particular settings. You may need to alter the php.ini manually.

  5. #5
    Join Date
    Apr 2007
    Posts
    1,664
    There are 4 types of directives

    Code:
    PHP_INI_USER  		Entry can be set in user scripts (like with ini_set()) or in the Windows registry
    PHP_INI_PERDIR 		Entry can be set in php.ini, .htaccess or httpd.conf
    PHP_INI_SYSTEM 	 	Entry can be set in php.ini or httpd.conf
    PHP_INI_ALL 	 	Entry can be set anywhere
    Here's the list of all of them
    http://www.php.net/manual/en/ini.list.php
    Click through the links on each one and read the notes. There's more to this then you might realize. post_max_size 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. Don't host your hosts resources.

    The 3 you're interested in are

    Code:
    post_max_size - PHP_INI_PERDIR
    memory_limit  -	PHP_INI_ALL
    max_execution_time - PHP_INI_ALL
    So as you have a PHP_INI_PERDIR in there, it would make sense to set all 3 in a .htaccess for an upload directory and keep them together. I'm on IIS so am a bit rusty on .htaccess but something like this should do the trick (with whatever values you need).

    Code:
    php_flag post_max_size 1100M
    php_flag upload_max_filesize 1000M
    php_flag memory_limit 1200M
    php_flag max_execution_time 300
    Save it as a file called .htaccess. Next make sure your FTP client has the ability to see hidden files and check there is not already an .htaccess file in the directory you're FTPing to, some hosts use them. If there is dl it and add those lines to it, or just FTP it to the upload directory where your upload scripts are.

    If you're uploading big files look into the progress bar scripts. There are a few prewritten that should be easy enough to make fit your needs.
    Anti Linux rants are usually the result of a lack of Linux experience, while anti Windows rants are usually a result of a lot of Windows experience.

  6. #6
    Join Date
    May 2009
    Location
    Rochester, NY
    Posts
    364
    Ok, I'm taking a slightly different approach. I made a php.ini file for the directory. This should fix it. I added these variables, and I'm trying to upload a 12MB file.

    Code:
    upload_max_filesize = 10000M
    post_max_size = 10000M
    memory_limit = 120000M
    max_execution_time = 3000
    set_time_limit = 500000000
    After uploading (or attempting to upload), my script gives an error. Specifically, the $_FILES["file"]["error"] generates 2, meaning the file I'm uploading is larger than the allowed file size. Are there other variables I have to set?

    Thanks.

  7. #7
    Join Date
    Apr 2007
    Posts
    1,664
    Stop cross posting! Pick a thread!
    Anti Linux rants are usually the result of a lack of Linux experience, while anti Windows rants are usually a result of a lot of Windows experience.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles