Change the Upload size on Ubuntu PHP.ini

On Ubuntu server, maximal file size upload limit in php scripts is set to 2Mb as default. There may be different filesize updated later in php.ini which is not sufficient to upload large database backup in phpMyAdmin.

In order to change that, two things are important,
– Current upload_max_filesize value
– Current location of php.ini file

On Ubuntu server, maximal file size upload limit in php scripts is set to 2Mb as default.  There may be different filesize updated later in php.ini which is not sufficient to upload large database backup in phpMyAdmin.

In order to change that, two things are important,

  • Current upload_max_filesize value
  • Current location of php.ini file

To find current upload_max_filesize value, create a file called ‘pinfo.php’ at your webserver root folder with following content:

phpinfo();

Now, open recently created file in browser via http://localhost/pinfo.php (replace localhost with the servername if necessary) and look for the line

upload_max_filesize 2M

which will show you the actual maximum file size.

To change the upload_max_filesize value, open php.ini file from the location provided in information displayed from pinfo.php file. If php.ini file location is/etc/php5/apache2/php.ini, then open a ssh connection to your server and edit the file /etc/php5/apache2/php.ini as follows

sudo nano /etc/php5/apache2/php.ini

search for “upload_max_filesize” with Ctrl-W and change “2M” to “20M”. Save the file with Ctrl-O and exit with Ctrl-X. Restart the apache server with

sudo /etc/init.d/apache2 restart

and visit again http://localhost/info.php to check if the maximum file size was changed.

There is another way to change upload_max_filesize value for specific project or website only.

If you enabled mod_rewrite you can also put this to your .htaccess file:

php_value upload_max_filesize = 16G
php_value post_max_size = 16G

So, upload_max_filesize value in php.ini file can be changed using .htaccess for project specific and from php.ini file itself for whole server specific.

cPanel SoftException: GID of script is smaller than min_gid

After upgrading EasyApache in WHM, sometimes it gives 500 (Internal Server Error) error in the browser.  If you check the error_log file, you find:

SoftException in Application.cpp:363: GID of script "/home/current_user/public_html/index.php" is smaller than min_gid

OR

SoftException in Application.cpp:363: UID of script "/home/current_user/public_html/index.php" is smaller than min_uid

If you check the permission of user/group for this file, it gives you root. So, apache can’t read these files uploaded by the root user. One solution is to change the permission of user/group to your current user.

chown current_user:current_user /home/current_user/public_html/ -R

This will solve the permission related issue on your site.

References :
http://www.flynsarmy.com/2011/10/cpanel-softexception-uid-is-smaller-than-min_uid/
http://forums.eukhost.com/f15/how-solve-error-softexception-application-cpp-303-a-6205/

Some websites are not loading: DNS misconfiguration

Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider. It’s speed up your browsing experience and also providing more secure data during browsing.

I have a weird problem few days back. After changing my ISP, some websites are stopped working by giving mis-configuration error in the DNS (Domain Name System) . So, I have started digging on that. I found so many users with Same problem. Some providing solution to change the MTU size of the router. I don’t even know, what is an MTU and how to change it?

After a few days, I found an answer from random forum, that change the DNS of the adaptor to Google Public DNS. So, I searched in google for it and found it.

Google Public DNS is a free, global Domain Name System (DNS) resolution service, that you can use as an alternative to your current DNS provider.  It’s speed up your browsing experience and also providing more secure data during browsing.

The Google Public DNS IPv4 addresses are as follows:

  • 8.8.8.8
  • 8.8.4.4

The Google Public DNS IPv6 addresses are as follows:

  • 2001:4860:4860::8888
  • 2001:4860:4860::8844

You can use either number as your primary or secondary DNS server. You can specify both numbers, but do not specify one number as both primary and secondary.

You can configure Google Public DNS addresses for either IPv4 or IPv6 connections, or both.
To change your DNS settings, please refer the following link, https://developers.google.com/speed/public-dns/docs/using

Note: Before start using Google Public DNS, please write down your current setting IP addresses of DNS for backup. In case you need to revert the settings.