Posts Tagged ‘php’

PHP – Large File Upload Issue

No Comments »

I’m currently working on a website project where we will be uploading large MP3 files to a Joomla site. Smaller MP3 files would load fine, but larger files just refused to upload. I checked all the obvious settings within Joomla, all of which were fine and set for 100MB max upload.

I then thought to check my php.ini settings, and sure enough upload_max_filesize variable=2M (maximum of 2MB), I changed this, restarted Apache and it still didn’t work!

Eventually I found out that PHP uses the POST method to upload files and an additional variable post_max_size was set too low. I upped the size, restarted Apache and ihey presto, upload of large files now worked fine.


Top 10 Linux Open Source Applications

4 Comments »

I’m always going on about how fantastic Open Source applications are, so here is my top list of applications that I feel people should not be without. There are also a couple of applications here which are not Open Source, but are still free and are worthwhile considering.

All of these products are free, but consider donating either a little bit of time or money to enable these fantastic applications to continue to be supported.

1. UBUNTU SERVER – (http://www.ubuntu.com/products/whatisubuntu/serveredition)
Linux, or in my particular case, Ubuntu Server is a fantastic product, is well supported, has a huge range of easy to install applications and is the foundation of many other Open Source applications.

2. PHP – (http://www.php.net)
PHP is the backbone of many web-applications, and although not really an application in itself, it is really a programming language that plays really well with HTML and has become the backbone of many web applications. Chances are if you use a web based application it probably utilises PHP somewhere.

3. MYSQL – (http://www.mysql.com)
The Open Source database for Linux, but also available for Windows, Solaris, FreeBSD, HPUX and others. Like PHP this is not a standalone application, but used to provide functionality to other applications.

4. APACHE – (http://www.apache.org)
Used by millions of organisations, companies and web-hosts the world over, the definitive Open Source webserver. A very powerful piece of software.

5. JOOMLA! – (http://www.joomla.org)
Joomla is a Content Management System, think of it as a design tool for people that do not like deisgning websites conventionally (i.e. HTML/CSS). It is extremely powerful, and although a little more involved that some other CMS’s it is worth the effort. Like most successful open source applications, Joomla is really well supported, has a very active community and the last time I looked, had 3000+ extensions to enhance its functionality.

I use this in my web design business for clients who want to control their own website content, but dont want to get involved in the technicalities of HTML . You can visit my website www.zimt.co.uk for more information.

6. ASTERISK/PBX IN A FLASH (http://www.asterisk.org and http://www.pbxinaflash.net)
One of my favourite applications. PBX in a Flash builds on the functionality of Asterisk, a leading open source IP Telephony PBX and enables you to build an enterprise telephone system on a shoestring. Hold music, call diversion, follow me, voice mail and conference calls barely scratch the surface of an incredible product. Incorporating the easy to use FreePBX web interface together with script based updates and extension installs makes incorporating features a breeze. If you have ever considered IP telephony this is the software to go for.

7. PFSENSE (http://www.pfsense.org)
An open source router and firewall with VPN, proxy and proxy content capabilities. It is powered by FreeBSD which makes it fast, reliable and it utilises few system resources. Although not as flashy as some it gets the job done quietly and without fuss.

8. WORDPRESS (http://www.wordpress.org)
Well, it had to be here didn’t it? Full of blogging goodness and everyones favourite blog software. WordPress is open source and is not just used for blogging but for increasingly capable websites, indeed some are now using it as a Content Management System. Whilst it doesn’t have the functionality of say Joomla! in this role, it is still a great solution and shows how flexible WordPress can be.

9. VMWARE ESXI (http://www.vmare.com)
Although not open source, this software is free, and is a cut down version of its big brother (now part of VMware vSphere). That said it has plenty to recommend it, and is plenty powerful by itself. Many companies and individuals utilise ESXi to consolidate their applications and servers and to provide a central repository to enable easy backup, migration and disaster recovery.

ESXi has a very small footprint, less than 32MB, making hardware utilisation much more efficient than say Microsofts Hyper-V technology or VMware server as it does not run on top of any operating system, instead it has its own small footprint loader which all your virtualised applications and servers run on.

VMware also have another free piece of software called VMware Player. This enables you to take a virtualised server (these are called Virtual Machines or VM for short and are just files) and take it with you on the road. I can therefore take development systems with me on my laptop when I am travelling, can still continue my work and can just copy my VM files back to my ESXi server when I get home. It is like taking a physical server with you on your travels, but with none of the hassle of a really long network cable!

If you really dont want to use a non open source product then Xen (http://www.xen.org) is another alternative.

10. Microsoft Office Accounting Express 2009 (http://office.microsoft.com/en-us/accountingexpress/FX101729681033.aspx)
What is this? A Microsoft application in an open source list? Well, yes; although obviously not open source it is free, and in these tough economic times that matters to a lot of people. More importantly Microsoft Office Accounting Express is a good piece of accounting software, and does what it says on the tin. It doesnt have all the features of the Professional version, but you can upgrade if you really have to.

Microsoft are just doing what many open source vendors have been doing for a while, releasing a version of their product with the majority of the commercial features implemented, and leaving it up to the customer to decide if it is worthwhile paying the extra to upgrade.

The hook being that you have invested time and effort to get to know the software, so you are much more likely to upgrade than go to a competitive product. Relax, it’s only marketing!!


Magento Installation HOWTO and FAQ

2 Comments »

Magento, as I have found, is a tad tricky to set-up, most things are easy to resolve, but there are lots of little things that can have you searching around the Internet for while trying to find answers. I thought I would collect the most common issues in a single article.

I am assuming you already have a fully working Ubuntu LAMP stack (Linux, Apache, MySQL and PHP) and are resonably familiar with Linux. This information was based around using Ubuntu Server 8.10 and Magento 1.3.1.

The full Magento system requirements can be found here:-

http://www.magentocommerce.com/system-requirements

Installation instructions

I like to keep a copy of the install and sample data files in my home directory for reinstallation in case of any problems. As described above I then copy the files to the webserver root. What I forgot is that the cp –R command does not copy hidden files, so make sure you copy the .htaccess file separately if this is the case.

The steps I follow for installing Magento are basically as follows:-

  1. Copy magento install file to temporary directory and unpack
  2. Copy magento sample data to temporary directory and unpack
  3. Copy unpacked magento install files to /var/www
  4. Copy unpacked magento sample media to /var/www/media
  5. Create database in MySQL
  6. Copy sample SQL database to mySQL using following command:-

sudo mysql -u user -p dbname < sqldata

Where user = MySQL user name, dbname = name of database to be used for storing the Magento data and sqldata is the name of the Magento sample data file, which is usually called something like magento-sample-data-1.2.0.

You could also install phpmyadmin for db admin if you have not already done so (if not, do so it is very handy) using:-

sudo apt-get install phpmyadmin

You can access it using http://localhost/phpmyadmin. Don’t worry if you can’t see it in your webserver root directory, it is not meant to be there.

Why cant I access Magento admin backend?

Some people have reported problems logging into the admin back end once Magento has been fully installed. I did a search on Google and found that there was a bug where using localhost only as the server hostname did not set the cookies correctly and did not allow you to log in.

I normally log into my test servers using just the server name, and my DNS server then resolves this, however Magento doesn’t seem to like this, and won’t allow you to log in!

So either use a FQDN (i.e. server.domain.local or somesuch) or just edit your hosts file in /etc/hosts and give it a dummy FQDN and it should work.

The page you requested was not found, and we have a fine guess why.

After installation of Magento and ensuring that mod_rewrite is enabled and working on the apache server, if Magento shopping cart still gives you the following error:

Whoops, our bad…The page you requested was not found, and we have a fine guess why.

If so, log into the Magento admin area and navigate to system->cache management.  Click the “refresh” button next to “catalog rewrites”. This should resolve the error.

Thanks goes to the site nickbartlett.com for this tip.

How do I enable Magento SEO?

I wanted to use Magento with SEO turned on, with friendly URLs. This requires the use of the Apache rewrite module mod_rewrite. To install this use:-

sudo a2enmod rewrite

You will also have to amend Apache to allow the use of .htaccess files. By default the Ubuntu 8.10 Server version of Apache disables this function. Edit the following file:

/var/www/available-sites/default

and find the following section:

<Directory /var/www/>
AllowOverride None
</Directory>

change it to:

<Directory /var/www/>
AllowOverride All
</Directory>

Don’t forget to restart Apache using – “sudo /etc/init.d/apache2 restart”.

Finally, login to the Magento admin backend, navigate to System > Configuration and change the option to YES.

Strict Notice: date() [function.date]: It is not safe to rely on the system’s timezone settings. Please use the date.timezone setting

If you get this error, Magento is complaining that you have not set your relevant timezone in the php.ini (located at /etc/php5/apache2) configuration file.

The default setting is as follows:

;date.timezone = 

Change this to, for example:

date.timezone = “Europe/London”

Remember to remove the semi-colon! Look at www.php.net for further information on the available timezones and locations available.

Forgotten Admin Password

If for some reason you have forgotten your admin password, and your email pasword option is not working (or you forgot to configure it – oops), you can reset your password in MySQL using the following command:-

UPDATE admin_user SET password=MD5(‘newpassword’) WHERE username=‘admin’;