Categories
Linux Solutions Ubuntu Web

WordPress: Error Uploading Media Files

I recently got the following error while uploading media to my wordpress site:

Unable to create directory uploads/2016/06. Is its parent directory writable by the server?

Here are the steps to fix the issue:

  • Possible Issue 1: Incorrect Directory pointed to in the settings:
    • Open your WordPress Admin page (this is usually at /wp-admin)
    • Hover over the sidebar menu “Settings” and then click on “Media
    • Check the section “Uploading Files“(If this section is missing then try the next solution)
    • check the value for “Store Uploads in This Folder
    • Most commonly the value should be “wp-content/uploads“, if not is should be pointing to the correct folder on the server. My setup had it pointing to the wrong directory with the wrong permissions.
  • Possible Issue 2: Wrong permissions
    • Login to your server via ssh or ftp
    • Traverse to the installation folder of the WordPress site
    • Check and see if the user:group settings are correct (Usually for UNIX systems its www-data:www-data)
    • If that is fine look at the permissions for the ‘uploads‘ directory and its sub directories
    • running a command ‘ls -l uploads‘, will give you the permissions set
    • The ideal permission is of 755. For this run the command “chmod -r 755 uploads

Hopefully that will solve your problems.

Categories
Linux Solutions

Compressing files in Linux & Unix – Cheat Sheet

Here is a quick cheat-sheet on How To Compress files in Linux & Unix

Zip
zip archive file1 file2 file3
Compresses file1 file2 file3 into an achive with filename archive.zip

zip archive *
Compresses all files in the current directory into an achive with filename archive.zip

zip -r archive dir
Compresses the directory dir(and its subdirectories) into an achive with filename archive.zip

unzip archive.zip
Uncompresses the archive archive.zip to the current directory

unzip archive.zip -d dir
Uncompresses the archive archive.zip to the directory dir

Categories
Solutions Ubuntu

Splitting and Joining Files in Ubuntu

Ubuntu has a neat application to split large files into smaller chunks(for emails or to burn into disks).  The application splits files into the format <filename>.<extension>.<part>.  The same application can be used to rejoin the files to recreate the original larger file.

Spliting:

To be able to split file you need the application “lxsplit”. It can be installed using the following command:

sudo apt-get install lxsplit

To split a sample file we will consider a file “archive.zip” of the size 5.5Mb and split it into 1Mb chunks:
{adinserter 2}
lxsplit -s archive.zip 1M

The program generates the following output:

Splitting archive.zip into 6 pieces.
archive.zip.001 1048576 bytes
archive.zip.002 1048576 bytes
archive.zip.003 1048576 bytes
archive.zip.004 1048576 bytes
archive.zip.005 1048576 bytes
archive.zip.006 548727 bytes
Done!

The smaller files are stored in the same directory. Split size can be specified as follows: 15M, 100m, 5000k, 30000000b

Joining the smaller files:

To join the chunks of files we again call lxsplit but this time with the -j option and pass the first file of the series as the parameter

lxsplit -j archive.zip.001

It generates the following output:

Creating merged file `archive.zip’.
Complete size: 5791607 in 6 files.
Processing file `archive.zip.001′ …
Processing file `archive.zip.002′ …
Processing file `archive.zip.003′ …
Processing file `archive.zip.004′ …
Processing file `archive.zip.005′ …
Processing file `archive.zip.006′ …
Done!

The resultant file is stored in the same directory.

Enhanced by Zemanta