php.ini max_upload only 2MB,despite set to 10MB

Discussion in 'Installation/Configuration' started by morten44, Jun 6, 2012.

  1. morten44

    morten44 New Member

    Hi
    I have used
    http://www.howtoforge.com/perfect-server-ubuntu-11.04-ispconfig-3
    pritty mutch default

    I am using the server for joomla websites

    Problem is that I can not upload bigger than 2MB files

    I have checked my PHP.ini in /etc/php5/apache2 and /cgi

    This is what it says:
    However when i make a phpinfo file it shows 2MB only. See link:
    http://new.dapp-malawi.org/phpinfo.php

    I have no clue where to look now. I have not done any work in .htaccess files or local php.ini files

    Any hint on what can cause this?
    I think this is the right php.ini files within the install?

    Kind Regards
    Morten
     
  2. orasis

    orasis Member

    I use ispconfig 3 on ubuntu 12.04 since 3 days ago (I was previously on ubuntu 10.04), and had to once again alter the upload_max_filezise to 50M once I had to import large databases via phpmyadmin.

    I only had to edit /etc/php5/apache2/php.ini and restart apache
    Then, it right away appeared in phpmyadmin as: (Max: 50MiB)

    Try to check if using MB instead of M is the problem:
    Code:
    upload_max_filezise = 10M                      
    instead of
    Code:
    upload_max_filezise = 10MB                      
    Also try to touch the php.ini files of the system the less the possible and only if needed, once you can do most of the job with custom php.ini files within your website directory (outside the public webroot /web/ of course), or by using the Sites > Website > Options tab > Custom php.ini settings. You can paste there the entire default /etc/php5/apache2/php.ini contents and alter it. Or copy the default php.ini and upload to your website (outside the public dir) and then point to it by setting an .htaccess file in your site public directory, with this code (I use suphp):
    Code:
    ### Use custom php.ini for this Joomla site
    <IfModule mod_suphp.c>
    suPHP_ConfigPath /var/www/clients/client1/web1/my_custom_dir_name/for_this_joomla_site/php.ini
    <Files php.ini>
    order allow,deny
    deny from all
    </Files>
    </IfModule>
    EDIT:
    by the way, exposing your phpinfo is not secure.
    If you use Joomla, set this in your php.ini:

    Code:
    disable_functions = show_source, system, shell_exec, passthru, exec, phpinfo, popen, proc_open
    more info here: http://docs.joomla.org/Security_Checklist_2_-_Hosting_and_Server_Setup

    cheers
     
    Last edited: Jun 6, 2012
  3. morten44

    morten44 New Member

    php.ini issue

    Hi
    Thanks alot of for your explenation and advise. It was very usefull

    Despite chaning 10M to 10MB, it still shows 2MB in my phpoinfo (only published it for you to see it)
    I cant understand where it takes it from
    I have done a search on the server and there are 3 php.ini files:
    /etc/php5/apache2/php.ini
    /etc/php5/cgi/php.ini
    /etc/php5/cli/php.ini

    I have set them all to 10MB, restarted the server and still it shows 2M!!
    In site-webiste-option I also added this line
    but still no joy. Not sure if i need to add anything else?
    I have no idea where it takes from

    I therefore would like to look into using local php.ini instead

    I saw your example and I understand what you mean.
    However i use CGI(not fast CGI) and not suphp (the only one i managed to generally do upload with)

    Do you know the code i have to use in .htaccess as the one you show probably only work with suphp

    Hope anyone has some input as I start to get quite lost!

    Kind Regards
    Morten
     
  4. falko

    falko Super Moderator Howtoforge Staff

    I think you made a typo:

    Code:
    upload_max_file[COLOR="Red"]z[/COLOR]i[COLOR="Red"]s[/COLOR]e = 10M
    should be

    Code:
    upload_max_file[COLOR="Red"]s[/COLOR]i[COLOR="Red"]z[/COLOR]e = 10M
     
  5. morten44

    morten44 New Member

    Thanks for the English Lesson Falko
    Stupid mistake
    However I have changed it now as pr attached file, but still showing 2M in phpinfo
    I have checked 3 different site on the server and they all show 2M

    So 2 questions
    1. Why does it not change when I change php.ini
    2. Why can I not get it to read the setting on the "option" tab?

    I am also still interesting on howto add code for CGI to .htaccess to refere to local php.ini as that might be an option

    Kind Regards and thanks for comming back to me
    Morten
     

    Attached Files:

  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you resated apache after you cahnged the files?
    Have you edited the correct file? You see the path to the php.ini which is used for this site in the phpinfo() output.

    You might have not waited until the cahnges were written to disk or you used mod_php instead of cgi, fastcgi or suphp.

    You can do that directly inside ispconfig, so no need to add any code. Just insert the lines that you want to have in the custom php.ini field on the options tab of the website in ispconfig and wait until the changes have been processed. You see that in the jobqueue in the ispconfig monitor. Beaware thet a ciustom php.ini is only possible for cgi, fcgi and suphp and not for mod_php.
     
  7. morten44

    morten44 New Member

    Hi
    I have restarted Webserver
    I have waited 2 hours after doing changes to "Advanced"

    It still does not want to change away from 2M
    I have also tried to change other settings and still no joy

    as pr phpinfo file i have to edit

    /etc/php5/cgi/php.ini
    and
    /var/www/conf/web13/php.ini

    As pr screenshot i have hanged them to 6MB, rebooted still no joy.
    Still showing 2MB

    I have chaged from CGI to FastCGI, same thing
    Joomla 2.5 also have a setting so I can see the php.ini and that shows 2MB as well

    Have have done differnt test with 6M and 6MB
    I have settled with M as the rest of the php.ini file uses only M to define MB

    Is there a chance that the websites for some reason can not read the php.ini files?
    Any other idears?

    Kind Regards
    Morten
     

    Attached Files:

  8. falko

    falko Super Moderator Howtoforge Staff

    Do you have any .htaccess files where upload_max_filesize is set?
     
  9. sjau

    sjau Local Meanie Moderator

    and you might also want to alter:

    Code:
    post_max_size
    memory_limit
    
     
  10. morten44

    morten44 New Member

    Hi
    Sorry for some delay. Was testing and test but still no joy

    I have a .htaccess file but all it does is the Rewrite URL
    There are no more infomration in this file

    As you see from phpinfo file there are only 2 locations for the php.ini file:
    /etc/php5/cgi/php.ini
    and
    /var/www/conf/web13/php.ini

    I have changed it both places to 6M but no joy. It does not change.
    I have also tried to change "post_max_size" and "memory_limit" but its the same with that. It does not change.

    I have also in Option Tab in ISPConfig for this domain added:
    upload_max_filesize = 5M
    max_execution_time = 60

    Its not reading it.

    I have no idea where it takes this settings from if its not reading the php.ini files.

    Is there anything I can check in order to see if the folders with the PHP files are readable for the webuser?

    You think this is the problem or you think its something else?

    Is there any log files I can look it, post here?

    Kind Regards
    Morten
     
  11. falko

    falko Super Moderator Howtoforge Staff

    Did you restart Apache?

    If you want to search for all files where upload_max_filesize is used, do this:

    Code:
    cd /
    grep -R upload_max_filesize *
     
  12. morten44

    morten44 New Member

    Hi
    Thanks for reply
    I tried "grep -R upload_max_filesize *" but it seems like just hanging. After 1 Hour i ctrl+c it

    I tried "grep upload_max_filesize /etc/php5/apache2/php.ini /etc/php5/conf.d/*"
    That works, so not sure why it does not show output

    Anyway I found another article:
    http://bytes.com/topic/php/answers/563555-php-upload_max_filesize-problem

    One suggested to move the statement "upload_max_filesize" towards the top of the php.ini file and so I did

    Surprise, surprise it worked

    I now did
    /etc/php5/cgi/php.ini -sat to 8M
    /var/www/conf/web13/php.ini -sat to 7M
    In the Option Tab in ISPConfig - sat to 5M


    When i check phpinfo now it shows 8M
    So moving it up worked.

    I am still surprised why i can not get the OPTION TAB or the /web13/php.ini does not work

    If you have any ideas please let me know. At least my immediate problem has been resolved but still would be good that I can actually use the Option Tab. Where should this information be saved?

    Kind Regards
    Morten
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    /var/www/conf/web13/php.ini
     
  14. morten44

    morten44 New Member

    I see.
    Thanks for replay, so the problem is that fore some reason my system is not able to read anything in the /var/www/conf/web13 folder i guess.

    Is there a setting anywhere I have to make for it to be able to read this folder within ISPconfig or should this just work straight out of the box?


    Kind Regards
    Morten
     
  15. till

    till Super Moderator Staff Member ISPConfig Developer

    This should work right out of the box. I tested it here on debian and ubuntu.
     
  16. morten44

    morten44 New Member

    Thanks for reply TilL and Falco for all your replies

    At the moment I can run it like this and then I have to look into it later if needed

    Kind Regards
    Morten
     

Share This Page