RSS

Tag Archives: php

Ubuntu – How to Create and Host favicon.ico Files on Apache

I recently installed an web-based feed aggregator called Gregarius on Apache and found that there was no favicon displayed next to the URL or in the browser tab.

So I took this as an opportunity to learn two things – first how to create a favicon.ico file on Ubuntu and second how to configure Apache to display favicon files.

A favicon is typically 16×16 pixles. You can create an image yourself (as a.png file for now) or use your favorite search engine to find some free ones.

I found some great, hand drawn icon sets and decided to use one of the 16×16 .png files from them:



Click the above images to download the icon sets.

I extracted the downloaded icon sets and copied the icon of my choice (rss_16x16) to my home directory.

Now we just have to convert the .png icon file to an .ico file. To do this we will install a command line utility called icoutils.

Click Applications, Accessories and then Terminal and enter the following command:

sudo apt-get install icoutils

Convert the .png icon to an .ico file as follows:

icotool -o favicon.ico -c rss_16x16.png

Obviously you will need to change the filename of the .png file to the name of your chosen icon.

The final step is a little configuration on your Apache web-server. The following line of code is a basic template that we will adjust according to our environment. Typically this line of code just needs to be inserted into the site header between the <head> and </head> tags.

<link rel="shortcut icon" href="htttp://domain.com/favicon.ico" />

For my environment I had to adjust the href destination to the ip-address of my web-server followed by the path to my favicon.ico:

<link rel="shortcut icon" href="http://192.168.0.43/rss/favicon.ico"
 />

Gregarius is written in PHP and so I had to add the above line to /var/www/rss/themes/defaut/web/header.php. This location will vary depending on your application / environmrnent.

Then I restarted Apache:

sudo /etc/init.d/apache2 restart

All that was left to do was to refresh my Gregarius web-page and my favicon was there in all its glory!

Sources:

http://steve.kargs.net/hosting/create-a-website-faviconico-with-ubuntu-linux/

Many thanks to my brother for helping me figure out where the shortcut icon code belonged in my Gregarius installation.

 
Leave a comment

Posted by on April 10, 2011 in Linux, Ubuntu, Ubuntu Server

 

Tags: , , , , , , , ,

Ubuntu Server – Apache: PHP Files Are Downloaded Instead of Opening in Browser

After installing a basic LAMP (Linux, Apache, MySQL & PHP) stack in Ubuntu you will find that Apache will prompt you to download .php files (rather than opening them in your browser).

The solution is to edit the /etc/apache2/mods-available/php5.conf file:

sudo nano /etc/apache2/mods-available/php5.conf

The lower half of php5.conf reads as follows:

# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
</IfModule>

Simply comment out the lines from <IfModule …> to </IfModule> as directed:

# To re-enable php in user directories comment the following lines
# (from <IfModule ...> to </IfModule>.) Do NOT set it to On as it
# prevents .htaccess files from disabling it.
#    <IfModule mod_userdir.c>
#        <Directory /home/*/public_html>
#            php_admin_value engine Off
#        </Directory>
#    </IfModule>
#</IfModule>

Save php5.conf as then restart Apache:

sudo /etc/init.d/apache2 restart

You will now be able to open .php files in your browser.

 
11 Comments

Posted by on April 2, 2011 in Linux, Ubuntu, Ubuntu Server

 

Tags: , , , , ,

Ubuntu Server 10.4 Lucid – Setting Up eXtplorer

eXtplorer is a PHP and JavaScript web-based file manager. It has a great user interface, lots of features, and is nice to work with. I downloaded version 2.0.1 from http://extplorer.sourceforge.net/.

Installation is quite straight-forward but there are some things that need to be done to get everything working. I am going to assume that you already have Ubuntu Server installed with a LAMP stack running. If not just issue the following command and select the LAMP Server role for installation:

sudo tasksel

Download eXtplorer and extract it.

On the server browse to /var/www and create a new folder, for example extplorer:

cd /var/www
sudo mkdir extplorer

Make the extplorer folder writable:

sudo chmod 777 extplorer

Copy the extplorer files to the extplorer folder on the server. I used WinSCP for this (with openssh-server installed on the server).

To get things working smoothly I had to go back and re-apply the chmod 777 command to the extplorer folder.

Next we need to take care of the permissions for the ftp_tmp folder and for extplorer/config/.htusers.php. The former is a temporary upload directory and the latter is a user file that needs to be writable so that the default password can be changed after the first log-in.

cd etxplorer
sudo chmod 777 ftp_tmp
cd config
sudo chmod 666 .htusers.php

At this point you should be able to log in to eXtplorer and change the default password. I found that eXtplorer did not like Internet Explorer for some things and so I use Firefox instead.  Open Firefox and browse to http://<YourServerIP>/extplorer.

The default username and password are both ‘admin‘. Change the default password straight-away!

The last step that you are definately going to want to perform is some editing of php.ini – this will allow you to upload files to extplorer that are larger than 2 Mb! On Ubuntu the default location for php.ini is /etc/php5/apache2/php.ini.

cd /etc/php5/apache2
sudo nano php.ini

In nano press Ctrl and w together and type in ‘upload_max‘ and press enter – this will search php.ini for the line that reads upload_max_filesize = 2M. Change the 2M vaule to a more reasonable upload limit.

Repeat these steps for the post_max_size line in php.ini also. I made this value the same size as for upload_max_filesize.

Now restart apache and you should be able to upload without any issues:

sudo /etc/init.d/apache2 restart

That was enough to get things working for me – further troubleshooting is available from the project web-pages at sourceforge.net.

 
1 Comment

Posted by on July 11, 2010 in Linux, Ubuntu, Ubuntu Server

 

Tags: , , , , ,

 
Follow

Get every new post delivered to your Inbox.

Join 29 other followers