Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells, Scripts, Web Design

WordPress File Upload Size Limit

Submitted by on December 25, 2009 – 9:24 pm 4 Comments

By default, WordPress will not allow you to upload a file larger than 2Mb. This limit is not set by WordPress itself, but by detaul PHP configuration. This configuration file is usually /etc/php.ini, but normally your Web hosting provider will not let you modify this file. Below is a possible fix you can try. Before running the commands, edit the path (wpdir variable) for correctly reflect your WordPress installation directory.

#!/bin/ksh

wpdir=$(echo "${HOME}/public_html")

if [ -f ${wpdir}/php.ini ]
then
	cp -p ${wpdir}/php.ini ${wpdir}/php.ini.`date +'%Y-%m-%d_%H-%M'`
	egrep -v "upload_max_filesize|post_max_size" ${wpdir}/php.ini > ${HOME}/php.tmp
	mv ${HOME}/php.tmp ${wpdir}/php.ini
fi

cat >> ${wpdir}/php.ini << EOF
upload_max_filesize = 100M;
post_max_size = 100M;
EOF

if [ -f ${wpdir}/wp-admin/php.ini ]
then
	cp -p ${wpdir}/wp-admin/php.ini ${wpdir}/wp-admin/php.ini.`date +'%Y-%m-%d_%H-%M'`
	rm ${wpdir}/wp-admin/php.ini
fi

ln -s ${wpdir}/php.ini ${wpdir}/wp-admin/php.ini

This will add two lines to your current php.ini file (or create one, if you don’t have it). This will be an “add-on” php.ini file that will work together with the main php.ini to which you have no access.

Print Friendly, PDF & Email

4 Comments »

  • Lucas H says:

    I’ve got a large video files and send to a friend. I’ve got a WordPress website is it possible to send it through there as a downloadable file? Or is there someplace I can upload it where she can download it?

    thanks

  • Myles says:

    Hello. I have a problem. I bought a wordpress theme for 50$ and i can’t upload it! It says that the file is too big… 10mb. I unzipped the theme folder and took the main theme folder and created a new .zip folder, I use wordpress sel-hosted (.org) …. So what is the problem? What can I do ? I tried to upload it directly to FTP but when i try to activate it gives syntax error. Please help!

    Thanks! :)

  • Johnky J says:

    it says:
    Bad Request
    Your browser sent a request that this server could not understand.
    size of a request header field exceeds over limit.
    and it shows the cookie and stuff.
    and it says it is a “400 bad request” if that makes a difference..
    it used to work on both of my computers…then one stopped working. then later like a week this one said bad request just like the other one. Any suggestions on how to get it back? PLEASE?
    and I am using Internet Explorer

  • superdork says:

    Im looking for a gas scooter maybe around 150cc.
    I only have a permit and will probably need to get a motorcycle license to drive.
    What are some good Scooter Stores in Florida that sell mopeds/scotters?
    I really love this scooter at the bottom link . Is there a way you can find out what brand/type it is?

    http://www.panoramio.com/photo/760206

    Thank You So Much!

Leave a Reply to Myles Cancel reply

%d bloggers like this: