Tech Loki Everything that comes to you comes to teach you.

4May/12Off

Troubleshooting Uploading Large Files in Drupal

When using Drupal (or any other CMS such as WordPress or Joomla) you will sometimes want to upload a larger file to the site through the provided uploader on the website. Unfortunately, a lot of "out of the box" web hosting set ups restrict the file sizes that are allowed to be uploaded via your web browsers (or http).

If you are having problems uploading large files here is a step by step troubleshooting guide.

1. Check in a different browser.
If the problem is browser specific, see "Browser Extension Bugs" below. If not continue on to the next item.

2. Check your php.ini file.
In your hosting create a web accessible file named phpinfo.php and add the following lines of code:

<?php
phpinfo();
?>

Then visit the file in your web browser to see the settings of your php.ini file.

There are two important things to see on your php info page. The first is the path to your php.ini near the top of the page. This is the file that is controlling your site and that needs modified or overridden. If you don't have access to this file (for example on a shared host), contact your hosting provider and ask how to create a custom php.ini file (if you decide you need to change the settings). This is unique to every server configuration and is outside the scope of this guide.

The second piece of information is the following php settings and change the value to the size of file you want to upload:

post_max_size = 10M
upload_max_filesize = 10M

For very large file sizes you may need to alter the following php settings also (if your website is timing out before completing the upload):

max_execution_time 180
memory_limit 128M
max_input_time 300

Drupal is a very memory intensive CMS and may need some of these php settings set to work properly. Note that Drupal requires both post_max_size and upload_max_filesize increased to increased file upload times. If you are change these values and are not seeing changes reflected in your Drupal site check with your hosting provider to investigate further.

3. Drupal Settings
In Drupal 7 you could have set the max file size manually when you created your content type. Check in your Structure -> Content Type and Configuration -> "Any file modules" for any set upload limits (for example the IMCE module). Make sure that your content type is listed also For example, you could have set the upload for image extensions but now want to load a pdf and need to add "pdf" to the Content Type.

4. Server Settings

Apache Settings:
This is less common, but you can check your httpd.conf file for this the "LimitRequestBody" command. If this is set (some distro's include this setting) it will limit your upload ability to the value set. If the command is set to zero or missing then you have unlimited upload. Working with httpd.conf requires SSH access and a little advanced know how. Check with your hosting provider, your distro (i.e. CentOS, Fedora, etc), your control panel documentation and a friendly Linux guru before embarking on finding/editing the httpd.conf file.

IIS Settings:
IF using a Windows server (which you should be using Linux with Drupal) you will want to look to see if their is a limitrequest set in your web.config file. If there is one, it could be limiting your uploads. Check with your web host about how to edit this file.

requestLimits maxAllowedContentLength

5. Browser Extension Bugs
Check the upload ability in different browsers before you pull your hair out checking server settings. If you can use a different browser to upload, it may be a bad add on or plug in for your browser. Start disabling extra add-on's if you want to find the culprit, or use a different browser for a quick solution.

My Problem and Solution:
The reason I wrote this guide is that I was able to upload files small files but not large files (uploads under 100kb in size were fine).

But the problem I was having was with Drupal 7 and 6 (other CMS's on the server uploaded files fine). I searched various combination of keywords searching in vane for a bug or an issue that related. Since no one else was experiencing the problem, or if they did they reported server misconfiguration, I assumed it was on my server and I pored over my server settings without luck.

I tried a Drupal installation on another server and was experiencing the problem. So it was with Drupal or with me locally, but not my server. So after sleeping on the problem, I realized the problem was most likely with me locally and abandoned Firefox (my favorite development browser) and logged in with Chrome. Large File uploads work fine in Chrome and Internet Explorer (IE)! The problem was local and specifically with Firefox and Drupal!

So I went to the Firefox menu (the orange box in the upper left) and clicked on Add-ons. A quick review found that a popular Facebook game companies toolbar was installed (Jeff, this is your fault). I uninstalled it, restarted Firefox and Drupal file uploads were working again!

Any 3rd-Party application on your browser can cause a problem with your browser, so some investigation is needed. For all I know, there could have been a bad configuration in Firefox and the problem wasn't with a specific 3rd-Party add-on.

Lesson learned:
Sometimes the problem is in your tool and not in what you are working on. Try a different tool early in the process.

6Mar/12Off

Securing SSH access to a cPanel Server

Occasionally a user will want to get SSH access to the server. There are a variety of reasons that someone would want SSH access. One is that there are some advanced uses, such as Drush, for Drupal, that allows Drupal websites to be managed from the command line. Another is someone wanted to use SFTP (secure file transfer protocol) to transfer files to and from the server (perhaps it's sensitive business documents or schematics they want encrypted while being transferred over the internet).

You will want to make sure that you take several steps to secure your users access via SSH. SSH access is how you manage your server from the command-line and giving other people access definitely increases the vulnerability to hacking or misuse of your server. Here are several steps that you can do to secure your SSH access.

28Feb/12Off

Working with Linux Permissions

When using a Linux based hosting you (the account owner) have control of the permission settings on your files and programs on the host server. The reason behind this is it gives you the best control of how your files and programs operate on the server. However with great power comes great responsibility.

Linux Permissions

Linux Permissions

28Feb/12Off

Getting started in web design

A website is collection of programs that lives on a specialized computer, known as a server. In order to build a website you have to start at the beginning of the process. There are two base components to a website, it’s domain name (also known as a URL address) and it’s host server, which is often referred to as hosting. I’ve written this article for the first time web designer. If your more advanced I still recommend reading this series of articles and I plan on more advanced topics in the future.

21Feb/12Off

Google the medium of preservation

Recently Google announced that they had reached an agreement to digitally scan and archive the Italian books.....
In the digital age preserving books and historical writings has moved from the scholar and librarian in dusty museums and libraries to server racks, databases, and electrons.

I do hail this as a great achievement of technology to preserve and provide the works of great Italians to the world. However the storage medium leaves me wondering on how ethereal is the nature of digital storage. Programming languages are constantly changing, servers do crash, not to mention man made and natural disasters could all result in lost data.