Joomla! migration headaches

Recently I moved an installation of Joomla! with VirtueMart to a new web host. The previous web host had restricted most of the export functionality in cPanel so I had to FTP everything over to the new host manually.

This created a lot of extra headaches. The most persistent was not being able to consistently save/update/create users in the administrative back-end. Every so often the form would time out and give the error message ‘Error Loading ModulesMySQL server has gone away’.

It took around 24 hours of constant searching, but I finally found a solution that worked for me at the Joomla forums.

Basically it states that the configuration.php needs to be edited so that it is in UTF-8 encoding without BOM. You can open the file in Notepad++ and set the encoding to this, then upload it and VIOLA.

Hopefully this saves someone else a headache.

Head in the clouds: Amazon s3 and CloudFront with Joomla! and PHP

I’m managing a LAMP server on a virtual dedicated setup and have recently run into some performance issues. During periods of higher user visits the CPU usage shoots up This could be partly because of the platform running on it, but I’m not sure that the PHP scripting is the root cause.

To alleviate some of my concerns, I’ve moved most of the static images, css, and javascript over to Amazon s3 and set up a CDN for that data with CloudFront. It’s fast. Really fast compared to what we’re used to. It has drastically helped load times and from what I can tell it is improving the performance of the site altogether by reducing the load on the server.

Caching is out in full force for the main joomla site while the content being served from amazon s3 is gzipped, minified, and speedy. I’m still working through YSlow to get things even more streamlined, but I’m more satisfied now than before.

I was using a minify component to grab scripts on-the-fly and combine them but that’s just a nightmare for performance so I’m going to revamp and get the remainder of those files out to the CDN and compressed.

For those who are interested, I’m serving gzipped js and css but using some varied methods also depending on if the connection is secure or not. Since S3 does not function over https using cnames, I had to set up a check to see which URL to use for my CDN files.

Something like this did the trick for my Joomla! template (placed in the template’s index.php):

//check to see if the browser supports gzip content
$gz = strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false ? 'gz' : '';
if ($_SERVER['HTTPS'] != "on") {
//insert your code to execute over http here
//enter your https code here

I’ve got this loading the CNAME urls such as for the non-secure connection but using the secure URLS that amazon provides for the secure connection.

And no, style.gzcss is not a typo. There were issues with how the browser was grabbing files with the regular style.gz.css extension, even when I had set the content-encoding to gzip and the content-type to text/css. This has worked for me, but there may be a more elegant solution floating around. Cloudberry explorer has been a great asset in doing this quickly and efficiently.

Integrating VirtueMart with Constant Contact

This week I’ve been tackling a project that has been in the back of my mind for a few months now. I was able to leverage the Constant Contact API to integrate Constant Contact user records with VirtueMart/Joomla user profiles. Now when a user is viewed from within the VirtueMart user manager you will also be able to see/edit their related constant contact record and list subscriptions.

New contacts can be created at the same time as Joomla users and it will auto fill information into the constant contact record based on the VirtueMart information. If an existing user profile that does not have a constant contact record is viewed, then when the profile is saved a new constant contact record will be created for that user. I’ll eventually be making more use of the API to allow users to select from various newsletters when registering so that they will be able to have more targeted communications.

The only issue I ran into was when I uploaded the changes to the live web server with PHP 5.2.11. It seems that on my local server with PHP 5.2.9 everything worked well but the comments in the constant contact class file were causing parse errors. I was able to get around the errors by deleting some of the comments.

I don’t like PEARS or mail today

One of the websites I work a lot on has files offered for download. When a user clicks to download it runs through a script and verifies the user’s access prior to sending the file to the browser, then it sends an email to a group of admins to notify them that the user has downloaded the file.

Everything was dandy until Friday. I noticed today that there have been no download notifications since then…

There was also another element of the site that wasn’t working and it just so happened to be another mailer script.

Both scripts use the PHP PEAR mail and mime includes.

Based on some preliminary troubleshooting it appears that the script will execute just fine as long as this line is commented out:

$mail_object->send($recipients, $headers, $message);

Which kind of defeats the purpose since it is responsible for sending the mail message. I still can’t find the problem, but I suspect it has to do with the mail host.

For now I am using the built-in Joomla! mailer, which for some reason is working just fine.