How to remove Captcha from Phpmotion v3

Video site for personal videos
I have been looking around for a Youtube style video script for a while, and after trying a few, including Joomla and WordPress with video plugins, I decided to give Phpmotion a go. The main reason is that I want a site that will just play local avi/divx/mpg/mp4 videos from a local /videos directory, NOT from Youtube and other “hosted” video sites.

Problems
Phpmotion has caused me no end of problems so far, but i’m intending to see it through, as it is quite a nice site once you hack it to get it working.

Squeeze and Php 5.3 –> Lenny 5.2 and Php 5.2
1. Doesn’t support Php 5.3 yet, which is a pain as we have just upgraded all our work and home servers to Debian Squeeze, so I had to install a Debian Lenny on our work Kvm machine. Also it doesn’t look like the Phpmotion developer is going to upgrade any time soon: http://phpmotion.com/forum/index.php?topic=19028.0

Captcha is borked
2. The Captcha on phpmotion is borked, and there are a lot of support requests on the forums regarding this problem:
Google: site:phpmotion.com/forum captcha+doesn’t+show
The solution offered by the devs is “Just downgrade to Php 5.2”.
It appears the best way is to just remove it. (Hence the title of this post)

X doesn’t exist on this server
3. As I type, there are still files and directories that are be reported as not found, when clearly they are there, and have the correct permissions.

a) I created a new test account, logged in (account exists), then went to my profile http://domain/phpmotion/members/test only to get a 404 error page:
Not Found
The requested URL /phpmotion/members/test was not found on this server.

b) As administrator, I tried to upload a test video, only to be told that /cgi-bin/uu_upload.pl doesn’t exist, as you can see below it plainly does!.
test@lennyapache:/var/www/phpmotion/cgi-bin$ ls
audio uu_default_config.pm uu_ini_status.pl uu_lib.pm uu_upload.pl

c) There is more, profile directories that don’t exist, upload directories that don’t exist, phpmotion files that don’t exist etc etc. But anyway, i’ll keep hacking until I get some sort of functionality.

PS: If you want to have a Captcha-free Phpmotion, rename this “inner_signup_form.txt” to “inner_signup_form.htm” and upload it to your “phpmotion/themes/default/templates” directory 🙂

Shopt for Bash – Cdspell for cd dir change mistypes

What is shopt? A marvellous BASH builtin command, that’s what it is!

I’ve added the whole shopt list to my .bashrc below, but i’m only going to talk about CDSPELL for cd dir change mistypes. One thing to remember is that if you issue a shopt command manually as a user or root, then close your terminal, it will revert back to OFF. I have added the shopt options to my .bashrc so that I can enable and disable the specific options i need. There are a few that are enabled by default, so if you decide you want them disabled permanently you just add a -u switch before them.
See the syntax below for enabling and disabling shopt options.

Issuing shopt SET or UNSET commands: From http://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html

Syntax
shopt [-pqsu] [-o] [optname …]

Options
-s Enable (set) each optname

-u Disable (unset) each optname.

-p Display a list of all settable options, with an indication of
whether or not each is set. The output is displayed in a form
that may be reused as input. (-p is the default action)

-q Suppresses normal output; the return status indicates whether the optname
is set or unset. If multiple optname arguments are given with `-q’,
the return status is zero if all optnames are enabled; non-zero otherwise.

-o Restricts the values of optname to be those defined for the `-o’ option to
the set builtin.

The cdspell bash builtin:
As you can see below, apart from the autoset options, I have manually set cdspell. If you spend a lot of time navigating directories via the terminal, you will often make spelling mistakes like “/ect”or “/Etc” instead of “/etc”, with cdspell enabled, bash will autocorrect the mistake and allow you to hit enter and still get to your destination. This saves a lot of time having to keep going back back and correcting directory paths.

My .bashrc shopt section:
############################
#
# SHOPT AUTOSTARTS
#
############################
# autocd
# cdable_vars
shopt -s cdspell # on MANUAL
#checkhash off
#checkjobs off
#checkwinsize on AUTO
#cmdhist on AUTO
#compat31 off
#compat32 off
#compat40 off
#dirspell off
#dotglob off
#execfail off
#expand_aliases on AUTO
#extdebug off
#extglob on AUTO
#extquote on AUTO
#failglob off
#force_fignore on AUTO
#globstar off
#gnu_errfmt off
#histappend on AUTO
#histreedit off
#histverify off
#hostcomplete off
#huponexit off
#interactive_comments on AUTO
#lithist off
#login_shell off
#mailwarn off
#no_empty_cmd_completion off
#nocaseglob off
#nocasematch off
#nullglob off
#progcomp on AUTO
#promptvars on AUTO
#restricted_shell off
#shift_verbose off
#sourcepath on AUTO
#xpg_echo off
############################

Perl Functions to memorize

Remembering Perl functions
Been working my way through this Perl Functions list for a while now. I just take a “Function of the day”, do a search on perldoc or man, and put together a couple of basic for each one.

As the old adage goes:

I hear and I forget. I see and I remember. I do and I understand.” — Confucius

Other Resources:
Sometimes you’ll get something that’s a bit vague, and neither man nor perldoc gives you enough to fully understand the power of a certain function. I’ve got a collection of Perl books and .pdfs, but I still take advantage of a great resource when i’m looking for working examples of Perl-foo. Perl Monks is an awesome community of Perl…. er monks 🙂
http://www.perlmonks.org/

Here’s a few Perl Functions to memorize:

Scalar manipulation
chomp, chop, chr, crypt, hex, index, lc, lcfirst, length, oct, ord, pack, q//, qq//, reverse, rindex, sprintf, substr, tr///, uc, ucfirst, y///

Regular expressions and pattern matching
m//, pos, qr//, quotemeta, s///, split, study

Numeric functions
abs, atan2, cos, exp, hex, int, log, oct, rand, sin, sqrt, srand

Array processing
pop, push, shift, splice, unshift

List processing
grep, join, map, qw//, reverse, sort, unpack

Hash processing
delete, each, exists, keys, values

Input and output
binmode, close, closedir, dbmclose, dbmopen, die, eof, fileno, flock, format, getc, print, printf, read, readdir, rewinddir, seek, seekdir, select, syscall, sysread, sysseek, syswrite, tell, telldir, truncate, warn, write

Fixed-length data and records
pack, read, syscall, sysread, syswrite, unpack, vec

Filehandles, files, and directories
chdir, chmod, chown, chroot, fcntl, glob, ioctl, link, lstat, mkdir, open, opendir, readlink, rename, rmdir, stat, symlink, sysopen, umask, unlink, utime

Flow of program control
caller, continue, die, do, dump, eval, exit, goto, last, next, redo, return, sub, wantarray

Scoping
caller, import, local, my, package, use

Miscellaneous
defined, dump, eval, formline, local, my, prototype, reset, scalar, undef, wantarray

Processes and process groups
alarm, exec, fork, getpgrp, getppid, getpriority, kill, pipe, qx//, setpgrp, setpriority, sleep, system, times, wait, waitpid

Library modules
do, import, no, package, require, use

Classes and objects
bless, dbmclose, dbmopen, package, ref, tie, tied, untie, use

Low-level socket access
accept, bind, connect, getpeername, getsockname, getsockopt, listen, recv, send, setsockopt, shutdown, socket, socketpair

System V interprocess communication
msgctl, msgget, msgrcv, msgsnd, semctl, semget, semop, shmctl, shmget, shmread, shmwrite

Fetching user and group information
endgrent, endhostent, endnetent, endpwent, getgrent, getgrgid, getgrnam, getlogin, getpwent, getpwnam, getpwuid, setgrent, setpwent

Fetching network information
endprotoent, endservent, gethostbyaddr, gethostbyname, gethostent, getnetbyaddr, getnetbyname, getnetent, getprotobyname, getprotobynumber, getprotoent, getservbyname, getservbyport, getservent, sethostent, setnetent, setprotoent, setservent

Time
gmtime, localtime, time, times

Script to edit first letters of multiple files

This is a simple one, and there are just loads of ways to replace lines/characters/spaces with Perl one-liners and Bash.

The main point of this script is when I install a new distro and want to shutdown services that startup automatically on each run level, for Ubuntu in the directories rcS.d, rc0.d, rc1.d, rc2.d, rc3.d, rc4.d, rc5.d, rc6.d

Each item begins with an “S” for START or a “K” for KILL with a number that pertains to the order of priority (ie S25bluetooth). And depending on the run-level, and how many apps you have installed, this could be 10-20 services launched at boot.

#!/bin/bash
############################################
#KILL STARTUP SERVICES
############################################
#By richs-lxh – http://richs-lxh.com
############################################
#CHANGE “ONLY” THE “FIRST” CHARACTERS AT THE
#BEGINNING OF A FILE (EG FILES S20* to K20* )
############################################
for i in S* ;
do mv “$i” “${i//S/K}”;
done

So if you want to kill all the processes that start with S20, it would be:
for i in S20* ;
do mv “$i” “${i//S20/K20}”;
done

The reason I posted this little script is that when you Google search for scripts and one-liners to edit filenames via the CLI, practically every guide offers newbies an example of how to change the “suffixes” (ie replace .html with .htm) but no clue on how to batch-replace the beginning of filenames.

Squeeze and IpV6 mean a fun 2011 for Debian server admins

Bye bye IpV4
Well, it looks like our good old fashioned, 4-digited IP addresses are about to meet their maker and go to the digit matrix in the sky for good. There has been a lot of talk about the v4 to v6 doomsday, but everybody was hanging on until the last minute before making any changes.

I for one have spent years removing IpV6 from the network settings on my Debian desktop as there was a notable speed difference. But that was only because there was slowdown caused by a search for non-existent IpV6 addresses before the IpV4 search. Now it seems this will no longer be necessary as everybody slowly converts to IpV6.

2011 – Big year for Debian server admins
I work as a Debian server Admin, and 2011 is going to be a memorable year for my colleagues and I. Firstly, Debian Squeeze (6.0) was released as “Stable” yesterday (Feb 6th), which means we will start upgrading all our clients’ servers pretty soon, although we do still have a year of Security updates. And now we are facing more future changes with the changeover to IpV6.

Google and World IpV6 Day

In the same way your phone is associated with a unique number, your computer is assigned a unique Internet Protocol (IP) address when you connect to the Internet. The current protocol, IPv4, allows for approximately 4 billion unique addresses—and that number is about to run out.

This morning the Internet Corporation for Assigned Names and Numbers (ICANN) announced (PDF) that it has distributed the last batch of its remaining IPv4 addresses to the world’s five Regional Internet Registries, the organizations that manage IP addresses in different regions. These Registries will begin assigning the final IPv4 addresses within their regions until they run out completely, which could come as soon as early 2012.

As the last blocks of IPv4 addresses are assigned, adoption of a new protocol—IPv6—is essential to the continued growth of the open Internet. IPv6 will expand Internet address space to 128 bits, making room for approximately 340 trillion trillion trillion addresses (enough to last us for the foreseeable future).

Google, along with others, has been working for years to implement the larger IPv6 format. They’re also participating in the planned World IPv6 Day, scheduled for June 8, 2011. On this day, all of the participating organizations will enable access to as many services as possible via IPv6.

Today’s ICANN announcement marks a major milestone in the history of the Internet. IPv6, the next chapter, is now under way.
http://googleblog.blogspot.com/2011/02/ipv6-marks-next-chapter-in-history-of.html

Debian 6.0 "Squeeze" Released – New Stable

Great news for Desktop users, the fun begins for Debian server admins

Desktop Users
Well the day all Debian and Debian derivative users (Crunchbang Linux) have been waiting for has finally arrived, a shiny new Debian Stable release. Desktop users get to dist-upgrade to a plethora of updates, but what about all the Linux Sysadmins out there.

Server Administrators
I work for a company in Barcelona, Spain (Eurogaran Informatica) who supply Debian servers with everything from MySQL Clusters, RAID, Asterisk PBX systems with Automated dialing, running our clients’ Java based web applications, firewalls, mail servers, web-servers, the list goes on, and we have obviously been talking about the impending upgrades.

Debian Security Updates
The good news is, that anybody running Lenny still has a year of security updates which allows plenty of time to make the transition. The only thing I am worried about is if our clients’ applications will bee 100% forward compatible with the new versions that have arrived with Squeeze, or if we will have to downgrade anything.

New Version Problems (Php5.3)
I’ve already noticed a few php websites which aren’t compatible with php-5.3, ie PHPmotion. This was only a testsite I was playing with last week, and obviously won’t be offering to any of our clients, but it is a valid example of how even minor upgrades can effect a company.

I’ll be posting any major Upgrade headaches in the weeks to come, and i’ll certainly be keeping my eye on the Debian mailing lists for Apache/Mysql/Cluster/Asterisk problems.

Any way, it was great news to wake up and read this today 🙂

—————————————————————————————————————-

Debian 6.0 Squeeze released

February 6th, 2011

After 24 months of constant development, the Debian Project is proud to present its new stable version 6.0 (code name Squeeze). Debian 6.0 is a free operating system, coming for the first time in two flavours. Alongside Debian GNU/Linux, Debian GNU/kFreeBSD is introduced with this version as a technology preview.

Debian 6.0 includes the KDE Plasma Desktop and Applications, the GNOME, Xfce, and LXDE desktop environments as well as all kinds of server applications. It also features compatibility with the FHS v2.3 and software developed for version 3.2 of the LSB.

Debian runs on computers ranging from palmtops and handheld systems to supercomputers, and on nearly everything in between. A total of nine architectures are supported by Debian GNU/Linux: 32-bit PC / Intel IA-32 (i386), 64-bit PC / Intel EM64T / x86-64 (amd64), Motorola/IBM PowerPC (powerpc), Sun/Oracle SPARC (sparc), MIPS (mips (big-endian) and mipsel (little-endian)), Intel Itanium (ia64), IBM S/390 (s390), and ARM EABI (armel).

Debian 6.0 Squeeze introduces technical previews of two new ports to the kernel of the FreeBSD project using the known Debian/GNU userland: Debian GNU/kFreeBSD for the 32-bit PC (kfreebsd-i386) and the 64-bit PC (kfreebsd-amd64). These ports are the first ones ever to be included in a Debian release which are not based on the Linux kernel. The support of common server software is strong and combines the existing features of Linux-based Debian versions with the unique features known from the BSD world. However, for this release these new ports are limited; for example, some advanced desktop features are not yet supported.

Another first is the completely free Linux kernel, which no longer contains problematic firmware files. These were split out into separate packages and moved out of the Debian main archive into the non-free area of our archive, which is not enabled by default. In this way Debian users have the possibility of running a completely free operating system, but may still choose to use non-free firmware files if necessary. Firmware files needed during installation may be loaded by the installation system; special CD images and tarballs for USB based installations are available too. More information about this may be found in the Debian Firmware wiki page.

Furthermore, Debian 6.0 introduces a dependency based boot system, making system start-up faster and more robust due to parallel execution of boot scripts and correct dependency tracking between them. Various other changes make Debian more suitable for small form factor notebooks, like the introduction of the KDE Plasma Netbook shell.

This release includes numerous updated software packages, such as:

KDE Plasma Workspaces and KDE Applications 4.4.5
an updated version of the GNOME desktop environment 2.30
the Xfce 4.6 desktop environment
LXDE 0.5.0
X.Org 7.5
OpenOffice.org 3.2.1
GIMP 2.6.11
Iceweasel 3.5.16 (an unbranded version of Mozilla Firefox)
Icedove 3.0.11 (an unbranded version of Mozilla Thunderbird)
PostgreSQL 8.4.6
MySQL 5.1.49
GNU Compiler Collection 4.4.5
Linux 2.6.32
Apache 2.2.16
Samba 3.5.6
Python 2.6.6, 2.5.5 and 3.1.3
Perl 5.10.1
PHP 5.3.3
Asterisk 1.6.2.9
Nagios 3.2.3
Xen Hypervisor 4.0.1 (dom0 as well as domU support)
OpenJDK 6b18
Tomcat 6.0.18
more than 29,000 other ready-to-use software packages, built from nearly 15,000 source packages.
Debian 6.0 includes over 10,000 new packages like the browser Chromium, the monitoring solution Icinga, the package management frontend Software Center, the network manager wicd, the Linux container tools lxc and the cluster framework Corosync.

With this broad selection of packages, Debian once again stays true to its goal of being the universal operating system. It is suitable for many different use cases: from desktop systems to netbooks; from development servers to cluster systems; and for database, web or storage servers. At the same time, additional quality assurance efforts like automatic installation and upgrade tests for all packages in Debian’s archive ensure that Debian 6.0 fulfils the high expectations that users have of a stable Debian release. It is rock solid and rigorously tested.

Starting from Debian 6.0, the Custom Debian Distributions are renamed to Debian Pure Blends. Their coverage has increased as Debian 6.0 adds Debian Accessibility, DebiChem, Debian EzGo, Debian GIS and Debian Multimedia to the already existing Debian Edu, Debian Med and Debian Science pure blends. The full content of all the blends can be browsed, including prospective packages that users are welcome to nominate for addition to the next release.

Debian may be installed from various installation media such as Blu-ray Discs, DVDs, CDs and USB sticks or from the network. GNOME is the default desktop environment and is contained on the first CD. Other desktop environments — KDE Plasma Desktop and Applications, Xfce, or LXDE — may be installed through two alternative CD images. The desired desktop environment may also be chosen from the boot menus of the CDs/DVDs. Again available with Debian 6.0 are multi-architecture CDs and DVDs which support installation of multiple architectures from a single disc. The creation of bootable USB installation media has also been greatly simplified; see the Installation Guide for more details.

In addition to the regular installation media, Debian GNU/Linux may also be directly used without prior installation. The special images used, known as live images, are available for CDs, USB sticks and netboot setups. Initially, these are provided for the amd64 and i386 architectures only. It is also possible to use these live images to install Debian GNU/Linux.

The installation process for Debian GNU/Linux 6.0 has been improved in various ways, including easier selection of language and keyboard settings, and partitioning of logical volumes, RAID and encrypted systems. Support has also been added for the ext4 and Btrfs filesystems and — on the kFreeBSD architecture — the Zettabyte filesystem (ZFS). The installation system for Debian GNU/Linux is now available in 70 languages.

Debian installation images may be downloaded right now via BitTorrent (the recommended method), jigdo or HTTP; see Debian on CDs for further information. It will soon be available on physical DVD, CD-ROM and Blu-ray Discs from numerous vendors, too.

Upgrades to Debian GNU/Linux 6.0 from the previous release, Debian GNU/Linux 5.0 (codenamed Lenny), are automatically handled by the apt-get package management tool for most configurations, and to a certain degree also by the aptitude package management tool. As always, Debian GNU/Linux systems may be upgraded painlessly, in place, without any forced downtime, but it is strongly recommended to read the release notes as well as the installation guide for possible issues, and for detailed instructions on installing and upgrading. The release notes will be further improved and translated to additional languages in the weeks after the release.

About Debian

Debian is a free operating system, developed by thousands of volunteers from all over the world who collaborate via the Internet. The Debian project’s key strengths are its volunteer base, its dedication to the Debian Social Contract and Free Software, and its commitment to provide the best operating system possible. Debian 6.0 is another important step in that direction.

Contact Information

For further information, please visit the Debian web pages at http://www.debian.org/ or send mail to .