vTiger CRM missing language file causes Sorry! Attempt to access restricted file.

When you add a new user (in vTiger CRM v5.4.0) then it is possible that you can select a language setting e.g. “English GB” that has a non-existent translation file. If you do this then that user will get the error message,

Sorry! Attempt to access restricted file.

on a blank screen after they log on. They will stay in this state forever until the logon cookie is removed or the language file is created. The language files exist under the path,

include/language

To fix this you must either

  • upload the correct language file or
  • use another browser and go in as a working user e.g. admin and reset the language to a known working language e.g. English US or
  • clone the include/language/en_us.php to the correct file name e.g. en_gb.php. To identify what file is needed you can add a print_r($filepath); to the include/utils/CommonUtils.php file function checkFileAccessForInclusion() around line 2817 onwards but before the die(). You can’t keep that debug code in place as the ajax javascript breaks but it will tell you what language filename it is after.

That should solve this first-day-of-use problem.

Getting Asterisk packages and pubkey 75307751175E41DF

If you just added the  Asterisk packages using,

sudo add-apt-repository "deb http://packages.asterisk.org/deb `lsb_release -cs` main"

and are now trying to install Asterisk from packages and you get an unsigned key problem,

NO_PUBKEY 75307751175E41DF

then you must do as root,

 wget http://packages.asterisk.org/keys/175E41DF.pub -O - | sudo apt-key add -

You can now reload the packages within Synaptic.

See https://wiki.asterisk.org/wiki/display/AST/Asterisk+Packages#AsteriskPackages-APT%28Debian%2FUbuntu%29

Broken pip – not actually installed

Was trying to install unidecode using pip (python installer) on a development system to test out a django based application and got an error,

$ sudo pip install unidecode
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2675, in <module>
    parse_requirements(__requires__), Environment()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 552, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: pip==1.0.2

I don’t think the actual values of what I was installing nor the pip=x.y.z actually matter as I have seen others with this message when I did a google search but my problem eventually was that I had the pip bash shell installed at two locations but did not actually have the pip Python package installed at all.

I had a “pip” command script that comes with the python-pip package at /usr/local/bin and at /usr/bin and both were different versions. The one at /usr/local/bin was python-pip from easy_install and the other at /usr/bin was from the Ubuntu distribution package manager. Now pip is a Python package manager, and easy_install is  a Python package manager and obviously the Ubuntu itself has a package manager. Yes all of this is just asking for trouble but right now just wanted to move on and get my django server application running.

To fix I removed the Ubuntu package python-pip from within Ubuntu package manager and then ran,

sudo easy_install pip

…to actually get pip installed. Now the pip script at /usr/local/bin was wanting the latest version of pip (1.1 actually) and I had the latest version of pip package actually installed and I could now install the unidecode python package. I am now happy.

I don’t know when this mess happened but I’m not the first to get into such an odd state on a development system. I think the Ubuntu python-pip package is my culprit. Hopefully this post can help you too.

Broken PHP filter_var() hiccups ResourceSpace install on some URL

Was installing the very interesting ResourceSpace package for a client and the client domain names use “-” in the domain part. They also have the non-dashed version too which redirects to the dashed version. There is nothing wrong with having dashes in the host section of a URL as long as it is not the first character.

The install broke because of the dash and the problem is that the PHP filter_var() function is fine with an underscore in the domain name but not a dash thus filter_var(“http://www.bad_example.com”, FILTER_VALIDATE_URL)) will be true even though it’s an invalid domain name but filter_var(“http://www.good-example.com”, FILTER_VALIDATE_URL)) will be false even though it is valid.

There is not really much to do here other than upgrade PHP to the precise version that fixes this and on my development server I am at 5.3.2 but that’s not working and I’m not going to deviate from the Parallels packages for this. Also if you are on shared hosting you are not going to easily demand the hosting company fix this one bug.

So you are going to have to go into the install script and comment out the filter_url() code or alter the user provided URL to swap the “-” to a character that is always valid and swap the “_” to a character that is always invalid no matter if the filter_url() is good or bad.

So I created a “testbaseurl” from the “baseurl” and tested that rather than the original,

$testbaseurl = str_replace(parse_url($baseurl,PHP_URL_HOST), 
               str_replace(array("_", "-"), array("^", "x"), 
               parse_url($baseurl,PHP_URL_HOST) ), $baseurl  );

which you use instead of $baseurl thus in the ResourceSpace example in /pages/setup.php at about line 510 onwards set the file to,

        //Check baseurl (required)
        $baseurl = sslash(get_post('baseurl'));
        //filter_var() is broken in certain PHP versions as it doesn't permit dashes in host but does 
        //permit underscore. Swap these to always legal or illegal characters. Don't use testbaseurl other
        // than with filter_var()
        $testbaseurl = str_replace(parse_url($baseurl,PHP_URL_HOST), 
               str_replace(array("_", "-"), array("^", "x"), 
               parse_url($baseurl,PHP_URL_HOST) ), $baseurl  );
        if ((isset($baseurl)) && ($baseurl!='') && ($baseurl!='http://my.site/resourcespace') && (filter_var($testbaseurl, FILTER_VALIDATE_URL))){
            //Check that the base url seems correct by attempting to fetch the license file
            if (url_exists($baseurl.'/license.txt')){
            $config_output .= "# Base URL of the installation\r\n";
            $config_output .= "\$baseurl = '$baseurl';\r\n\r\n";
            }
            else { //Under certain circumstances this test may fail, but the URL is still correct, so warn the user.
                $warnings['baseurlverify']= true;
            }
        }
        else {
            $errors['baseurl'] = true;
        }

 

 

Foil-backed insulation blocking WIFI

Client has fixed up an old building and has used solid insulation which has an aluminium foil backing that acts as a heat and vapour block. It also stops WIFI dead.

Normally this wouldn’t be a problem and all your signals would be under the roof but this client has a 3-story rustic building with the office at the top and a bedroom at the back on the ground floor with a new roof. Whilst the WIFI signals are fine from the top to the bottom of the main building, immediately you pass under the foil-insulation of the extension then the signals stop.

The most cost effective solution to get WIFI to this back room without running Ethernet cables through meter thick stone walls is to use powerline adapters. Recently I have seen the retail prices for these plummet to less than 50 Euros per pair (for TP-Link brand from Amazon.it or Amazon.co.uk). Currently testing these out and they are looking fine but there is one caution that you need to consider.

These units give off a high frequency audible noise. It is like the flyback transformer of an old style CRT or TV. From experience with different customers these high frequencies can be annoying and frustrating to remove. So you may need to use powerline technology to sneak through the building and then for the last few meters use a cheap switch plus long pre-made ethernet cables or another WIFI AP.

Recovering from power loss-interrupted Ubuntu distribution upgrade

Was doing an Ubuntu maverick (10.10) to natty (11.04) upgrade on a test system (desktop) and the power was lost. No UPS. On reboot it didn’t come back properly and I got,

The disk drive for / is not ready yet or not present

As far as I know this was part way through the package installations. If it fails during the package download then there is never any problem but with a part-install then parts of the system are running the new version and parts are on the old distribution.

The fix is fairly easy – at the prompt above then type M to get to the manual recovery.

The disk will be mounted as read-only so then remount this,

sudo mount -o remount,rw /

then try these commands,

sudo apt-get update -f
sudo dpkg --configure -a

then reboot and then the system should come back in a partially upgraded but stable state and you can continue with the distribution upgrade with,

sudo apt-get upgrade -f
sudo apt-get dist-upgrade

After the reboot it will be on the new distribution. Note that if a package is corrupted then you may need to delete that one package file from the /var/cache/apt/… location and re-run the sudo apt-get upgrade -f command. It is a pity the distribution upgrade process doesn’t have this kind of logic built in to facilitate unattended completion or recovery of a partial distribution upgrade.

 

PandoraFMS server v4 fails to start – exits with Unknown column errors

During the Pandora FMS console upgrade the database schema may not have been upgraded correctly. If this happens then the Pandora server will be unable to start, i.e. when you try /etc/init.d/pandora_server start then it fails and logs its error messages in the /var/log/pandora/pandora_erver.error file. If there are Unknown column errors then this is a clear giveaway that the database that you are connecting to doesn’t have the expected schema,

DBD::mysql::db do failed: Unknown column 'extended_info' in 'field list' at /usr/lib/perl5/PandoraFMS/DB.pm line 567.
DBD::mysql::st execute failed: Unknown column 'disabled' in 'where clause' at /usr/lib/perl5/PandoraFMS/DB.pm line 399.
DBD::mysql::db do failed: Unknown column 'tags' in 'field list' at /usr/lib/perl5/PandoraFMS/DB.pm line 567.

The fix is easy to do (assuming you don’t want to fall back to the previous version). Ideally first make a backup of your database using whatever tools you have available (your cpanel Mysql tools or command line mysqldump or phpmyadmin).
Then run the following command line commands,

cd /path/to/pandora_console
cat extras/pandoradb_migrate_v3.1_to_v3.2.sql | mysql -u pandora -p -D pandora

and then at the Enter password: prompt enter the password of the mysql user pandora. Note that the -u is the user i.e. pandora and the -D pandora is the database of pandora. This is the default convention used on the Pandora FMS system though you can use any database username and database name. Yes that is the 3.1 to 3.2 schema upgrade file. There is no harm in repeating that command.

Then repeat that with the 3.2 -> 4.0 schema changes..

cat extras/pandoradb_migrate_v3.2_to_v4.0.sql | mysql -u pandora -p -D pandora

At the end of this then you can start the Pandora server and it should startup correctly.

 

GNU wget missing libeay32.dll on new install on Windows

When you use the command line wget for the first time on a Windows XP machine (and probably others – Vista and 7 ) you might get an error message,

Unable To Locate Component
This application has failed to start because LIBEAY32.DLL
was not found. Re-installing the application may fix this problem.

On a new Windows installation you may have installed wget but the problem is that wget32 needs other library files (libeay32.dll, libintl3.dll, libiconv2.dll and libssl32.dll) and these are not usually on a new Windows machine.

What you probably forgot to do with installing wget is install the dependencies !

Go to the GNU Wget binary download site for Windows and get the “Dependencies” ZIP file. Unpack the 4 DLLs from that /bin/ directory in the ZIP file into the same /bin/ directory where you have the wget.exe.

Wget will now work.

I use wget to download large ISO files from places that don’t have obvious bittorrent links e.g. Sourceforge. I do this because wget is more reliable than the browser in handling partial downloads i.e. where the Internet link has been closed and you have received only part of the file. Wget allows you to restart the download where it last finished.

 

SLIB 1.8 build problem with GNUCASH

The Ubuntu repository for software lags the new versions for programs. This is a good thing because it would be a nightmare if it was updated for every nightly build for the  tens of thousands of packages !

But sometimes you want the latest version of an application and I wanted the latest version of GNUCash so I wanted to build from source.

I got some odd GUILE issues which are easily fixed as below for an Ubuntu 10.10 platform.

Assuming you have all your other GNUCash make dependencies correct you will probably still get a configure failure with the error,

checking for guile - 1.6.7 <= version < 99.99.99... yes: 1.8.7
checking for guile - 1.8.0 <= version < 99.99.99... yes: 1.8.7
checking for SLIB support... configure: error: 

Cannot find SLIB.  Are you sure you have it installed?
See http://bugzilla.gnome.org/show_bug.cgi?id=347922
and http://bugzilla.gnome.org/show_bug.cgi?id=483631

…because there is no Guile 1.8-slib package (there is a 1.6 package). The package does two things,

1) Adds a soft link in the Guile 1.X to SLIB

cd  /usr/share/guile/1.8/
 sudo ln -s ../../slib slib

2) Builds a slibcat file which can be done with this command,

sudo guile -c "(use-modules (ice-9 slib)) (require 'printf)"

Thus do those two steps and you’ll fix this SLIB issue and can proceed with your make.

Note that after building GNUCash you will probably get the error,

gnucash: error while loading shared libraries: libgnc-qof.so.1: cannot open  shared object file: No such file or directory

…which is because the ldconfig cache is not updated.
You must run,

sudo ldconfig -v

after you have done the make install to fix this issue.

Getting Plesk default domain page and not your WordPress install ?

If you have uploaded the WordPress files to a new site and are still getting the Plesk Default domain display then you have probably forgotten to delete the old Plesk skeleton site especially the index.html file. By default a site will pick the index.html before index.php and so the WordPress index.php file is never read.

You should ideally delete all of the files in this httpdocs location before uploading and installing a new site.

Using WP-Mail-SMTP if host provider has disabled PHP Mail

One of our hosting companies that we have a reseller account on has disabled PHP Mail function for security reasons. This causes the WordPress sites that use Contact Form 7 (with Really Simple CAPTCHA) to fail with,

“Failed to send your message. Please try later or contact administrator by other way.”

To fix this you need to enable the WP-Mail-SMTP  plugin. To install this download the plugin and upload to your site as normal and then activate this on a per-site basis (not Network activate).

You will now have new options in the Settings -> Email on your site dashboard of which the most important is “Send all WordPress emails via SMTP.”  (checked by default).

Set these parameters as per your hosting provider recommendation though you usually can just specify one of your own email addresses on your domain as the From Email and set it to localhost and no authentication and it should work.

It is usually only when the from email domain is not a local domain on that server that you will have problems and need to authenticate your connection or if the SMTP server is not “localhost”.

If you have it right then you will get the message “Your message was sent successfully. Thanks.”

 

 

Swapping Windows product keys.

When you re-install a Windows XP based laptop then the licensing is easy as just about every laptop that is sold will have a legitimate Windows sticker on its bottom. Trouble is that you might not have the right install CD.

To use that laptop sticker you need the OEM install disk. If you use a retail disk then the key will be rejected.

However you get the Windows XP installed you can get the correct OEM laptop key into Windows by running the program provided by Microsoft from,

http://windows.microsoft.com/en-US/windows/help/genuine/product-key

This program will update the product key and correctly set your product ID to match the key i.e. if it is a big-name brand then your key (and probably the BIOS) is decoded by Microsoft and the MPC (Microsoft product code) will be set to (probably) “76477″ i.e. the Royalty OEM and the Channel ID will be set to “OEM” if you add a legitimate OEM key from the base of the laptop.

This also seem to correctly validate Windows.

 

 

 

Old Acer 1360 Laptop hot hot hot….

Reinstalling a very old laptop (Aspire 1360) with its Windows XP Home and it halts just like a power shutdown. Trouble was that when trying an Ubuntu install then that worked. Odd.

Redid the WinXP install and it failed – retried the Ubuntu install and finally got an error message that shot off the screen but it was useful – overtemperature (80 Deg C) shutting down. The ACER BIOS (v1.09) doesn’t actually show the hardware sensors – gee that’s useful.

Interestingly I had also tried to start a Window Vista install and I got a “STOP: c000021a (Fatal System Error)” Error

I’d already cleaned out a whole ecosystem of colonies of “dust bunnies” from this machine but looks like something else has a problem. So took off the plastic cover with the feature buttons on on the top of the laptop to see if there was anything else and then tried the heatsink screws – one seemed looser than the others.

So far vacuum, tighten heatsink screws, remove dust and cat hair and swapped around memory chip positions seems to have done the trick on the install. I now have it back as a Windows XP with dual-boot to Ubuntu 11.04.

 

 

ACER 1360 BIOS 1.15 Model ID check error

I’m recovering a heat-damaged Acer Aspire 1360 and I wanted to update the BIOS. I went to the Acer web site and found the 1.15 version. This didn’t install but failed with a “Model ID check error”.

I re-downloaded the file from a different Acer site (UK and US) but same problem. I then tried the Acer FTP site,

ftp://ftp.acer-euro.com/notebook/aspire_1360/

and sure enough I found the problem.

The old BIOS files had two models in them, the 1520 and the 1360 but the version 1.15 only has the Acer Aspire 1520 files.

So AFAIKS you can only flash to version 1.11 of the BIOS (this gives 64 bit support).

 

Using host file changes to migrate a site

The simplest way of migrating a web site from one IP to another and testing it before changing your DNS is to just change a local test PC host file.

It varies by operating system but if you change the host file and make the new IP address point at e.g. www.example.com then you can install your new content management system and add the content at your leisure by just referring to it by its normal URL.  Everyone else in the Internet gets the old site on the old IP but you (and only you) gets the new site on the new IP.

Upload your content, edit and test it as usual.

You can also test POP3 and SMTP in this same way by editing your test PC hosts file to point at the new IP address for the POP3 and SMTP addresses e.g. pop3.example.com or even webmail.example.com.

When you are ready then simply change the DNS (@) A (and AAAA) records to the new IP addresses.

Do this in two steps,

1) switch the www and similar Web site related IP addresses but keep the webmail and MX records on the OLD IP address. If the web site works as expected (remember to remove any “test” entries in your test PC hosts files) then…

2) at a suitably idle time change the Webmail and MX records. Now test the incoming and outgoing email works. On any test machines make sure that a ping to the relevant record e.g. mail.example.com or pop3.example.com returns the expected IP address.

If it is fine then after a suitably long delay you can decommission the old web site. Do this as follows,

a) backup all databases – mark them as the OLD SITE
b) backup all web site content (media etc) – mark them as the OLD SITE
c) backup any other OS specific configuration files – mark them as the OLD SITE
d) delete the old site. How you do this will vary (delete containers on VPS or reformat a server disk on standalone machines or delete the files via FTP or ssh) but never leave it hanging around.