Life of a Geek Admin

The Daily adventures of a true geek administrator

Life of a Geek Admin - The Daily adventures of a true geek administrator

Changing Print Size in Firefox 11+ with NoSquint

Recently came across and issue with emails and other web pages printing the fonts in an unreadable size. This was not an issue with Internet Explorer or Chrome. Found that this is a fairly common issue that users were experiencing.

This is where Firefox AddOns fill the gap. Enter NoSquint. NoSquint allows you to adjust the viewing and printing size of the pages and fonts and alleviates the issue. Installation is simple as clicking on Add To Firefox and allowing Firefox to restart.

Controls are handles by the zoom buttons in the toolbar and the Add-on bar on the bottom of Firefox.

NoSquint allows you to adjust the text-only and full-page (both text and images) zoom levels as well as color settings both globally (for all sites) and per site.  NoSquint can:

  • Override the default text-only and full-page (both text and images) zoom levels for all websites
  • Enforce your own foreground and background colors
  • Remember your zoom levels and color settings per site, automatically applying them when you return.
  • Disagree with what NoSquint calls a site? A powerful exceptions mechanism lets you split up or group together sites with URL patterns.

Download and install the Add-on and give it a try and see if it resolves your Firefox printing issues.

Update!!!

I also found that the Scale setting in Page Setup can also correct printing size. Click File > Page Setup and un-check Shrink to fit Page Width, change the Scale value to 100% and  re-check Shrink to fit Page Width and click OK to save the changes will correct the printing small fonts issue.

Running ASP.NET on Apache 2.2

Continuing with running Apache 2.x on Windows systems (Windows 7 and Windows 2008 R2) I found the desire to be able to deliver ASPX pages on the Windows server in my development environment. Upon searching the Internet I came across an Apache module mod_aspdotnet.so found here. The module is no longer being actively updated but works well on Apache 2.0 – 2.2 installations.

This implementation is limited  and true ASP hosting should be done with IIS, but no one said we couldn’t have a try at it!

Download mod_aspdotnet-2.2.0.2006-setup-r2.msi but do not double click to run the installation. Instead we need to extract the contents to a temporary directory and will manually copy Apache.Web.dll and mod_aspdotnet.so to the correct directory’s. The reason is that double-clicking will not put the Apache.Web.dll file in the correct location and will register with the GlobalAssemblyCache.

Open a command prompt and change to the directory where you downloaded the file to and run the command.

msiexec /a  /qb TARGETDIR=

Example:

msiexec /a mod_aspdotnet-2.2.0.2006-setup-r2.msi /qb TARGETDIR=c:\temp

The files will be extracted into

First, copy mod_aspdotnet.so to your Apache modules directory c:\Apache2\modules next copy Apache.Web.dll to the c:\apache2\bin, assuming this is where you have installed Apache.

Modify Apache’s httpd.conf file and add this section to the end of the file.

# asp.net support
LoadModule aspdotnet_module modules/mod_aspdotnet.so

AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
licx rem resources resx soap vb vbproj vsdisco webinfo

AliasMatch "^/(?i)aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*)" \
"C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"


Options FollowSymlinks
Order allow,deny
Allow from all

# Create Temporary ASP.NET Files directory under .NET framework 2.0.
AspNetMount /asp "C:/apache2/htdocs/asp"
Alias /asp "C:/apache2/htdocs/asp"

# Allow asp.net scripts to be executed

Options FollowSymlinks Indexes
AspNet Files
Order allow,deny
Allow from all
DirectoryIndex default.htm default.aspx

Save the changes and restart Apache service, hopefully the service will restart without errors. Now we need to test the setup, in the Directory directive I have created a test asp site.

Open your editor of choice and paste in the following code. This will display the .NET version.

<%@ Page Language="VB" %>








Save the file as default.aspx in the c:\apache2\asp\ directory.

Hope this works for you as it did for me. This will only work on Apache 2.0 / 2.2.

Install mod_perl on Apache 2.2 on Windows 7

To continue on with developing on Windows using Apache/MySQL/PHP I wanted to add mod_perl to the mix. For this post I chose to make it work on Apache 2.2 but it could possibly work on Apache 2.4 as well, but I have not tested they portion yet.

First piece of the puzzle is to download a version of Perl that supports the Module on Apache. In the past I have gone with ActiveState’s ActivePerl but lately I have been using Strawberry Perl due to changes in retrieving older releases.I settled on Perl 5.10 release.

Download Strawberry Perl 5.10.5 from http://strawberryperl.com/releases.html and click on strawberry-perl-5.10.1.5.msi under the Strawberry Perl May 2011 section.
Once downloaded just double-click to install it, you can change the default installation path or change it to your preference. Once the installation is completed then, open a command prompt to set the perl environment and reboot the system.

c:\> cd C:\strawberry

Run the command

c:\strawberry> perl\bin\perl.exe update_env.pl.bat

Next download and compile the mod_perl using ppm (Perl Package Manager)

ppm install http://cpan.uwinnipeg.ca/PPMPackages/10xx/mod_perl.ppd

The installation process will start. Once it compiles the module it will ask where to put it. This will be your Apache modules directory (ex:c:/Apache2/modules)

Close the command prompt and edit c:\Apache2\conf\httpd.conf
We must tell Apache to load the module and tell it where the perl Dll lives. You can add this to the bottom of the file.

LoadModule perl_module modules/mod_perl.so
LoadFile "C:/strawberry/perl/bin/perl510.dll"

Find the mime section and modify this

AddHandler cgi-script .cgi .plx .plex .pl

Now we need to enable and add a few items to allow perl to execute.

Look for the alias_module section and make sure the cgi-bin line is pointed to the correct location.

ScriptAlias /cgi-bin/ "c:/Apache2/cgi-bin/"

Next you will need to add ExecCGI in the Option section.

Options Indexes FollowSymLinks ExecCGI

Save the changes and restart Apache service. We are now ready to test to see if it displays a simple Perl Hello script.

You can copy the code and save it as test.pl in c:\apache2\htdocs or anther directory of your preference.

#!c:\strawberry\perl\bin\perl.exe
# ^^^ this must be the first line of the script! ^^^
# start code

use strict;
use CGI;
my $q = new CGI;

# print header and start the markup output

print $q->header( "text/html" ),$q->start_html( "hello from perl cgi!" );
print $q->h2("Hello Mark...");
print $q->end_html;
# end code

I hope this helps get Perl working in your Windows Apache install.

How install Apache 2.4 PHP 5.4 and MySQL 5.5.21 on Windows 7

Recently decided to install a working Apache 2.4 / PHP 5.4.9 and MySQL 5.5 running locally on my Windows 7 laptop for web design, not using XAMPP or WAMP installation methods. Which are great but this round I wanted to match my Linux server.

Apache 2.4 Install

First download Apache 2.4 from http://www.apachelounge.com/download/ (httpd-2.4.1-win32.zip) Apache 2.4.1
with IPv6 apr-1.4.6 apr-util-1.4.1 apr-iconv-1.2.1 pcre-8.21 lua-5.1 libxml2-2.7.8 openssl-1.0.0g zlib-1.2.6. This release is supported by the PHP 5.4 install from windows.php.net for Apache 2.4.

Extract the zip and copy it to the root of C:\. This will be C:\Apache24 when it is all done.

Update 01-17-2013: The version of the php5apache2_4.dll must match the version of PHP you are installing. The link that was reference before has been changed and moved to http://www.apachelounge.com/download/additional/ for versions 5.4.9 and earlier. As of PHP 5.4.10 the module is now included in the Windows build.

PHP 5.4.9 and Earlier

Download PHP 5.4.9 VC9 x86 Thread Safe from http://windows.php.net/download/releases/archives/php-5.4.9-Win32-VC9-x86.zip . Extract and rename folder to php and move to C:\
Also, download php5apache2_4.dll-php-5.4-win32.zip (http://www.apachelounge.com/download/win32/modules-2.4/php5apache2_4.dll-php-5.4-win32.zip)
Runs with PHP 5.4 Thread Safe (TS), and only with Apache 2.4 Win32 VC9 or VC10.

PHP 5.4.10 and higher

Download PHP 5.4 VC9 x86 Thread Safe from http://windows.php.net/download/ . Extract and rename folder to php and move to C:\.

Update 01-17-2013: This next edit seems to cause issues with php5apache2_4.dll not found errors, so I have added two options for PHP 5.4.9 and earlier and PHP 5.4.10 and above. I want to thank all those who have brought this to my attention and I hope this helps out. Also, due to the addition of the php5apache2_4.dll being included in PHP 5.4.10 and above builds you no longer need to download the module separately.

PHP 5.4.9 and earlier Option 1

Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c:\php\ directory. This is needed to allow Apache to use PHP.  Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

PHP 5.4.9 and earlier Option 2

Extract php5apache2_4.dll-php-5.4-win32.zip and copy php5apache2_4.dll to the c:\php\ext directory. This is needed to allow Apache to use PHP.  Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/ext/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

PHP 5.4.10 and newer

Edit Apache’s config file, c:\Apache24\conf\httpd.conf and add the following lines to the bottom of the file.

LoadModule php5_module "c:/php/php5apache2_4.dll"
AddHandler application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php"

While we are at it we can add index.php to Apache’s list just incase we want to have a starting page as php.

Find Directory index and add index.php

DirectoryIndex index.html index.php

Next we need to input a value  for ServerName variable. You will have to un-comment it. Save the changes to the config file. Next move to the Register Apache Service step.

Register Apache Service

Now let’s register Apache as a service. Open a command prompt and type.

c:\apache24\bin\httpd -k install

If do not want Apache starting automatically at start-up/reboot:

GUI Way

  • START | RUN
  • Type in services.msc, hit Enter or click OK
  • Locate Apache2 service and double-click (or right-click for Properties)
  • Find the caption Startup type: (in the middle of the dialog box), use the pull-down and select Manual
  • Click OK

Command line

C:\> sc config Apache2.4 start= demand

Add

c:\Apache24; c:\Apache24\bin

to PATH in Environment variables. PATH ENVIRONMENT (System Properties | Advanced | Environment Variables | System variables | Path).
Example:
;c:\php;c:\apache24;c:\apache24\bin;

Now lets check Apache settings by issuing the command, c:\Apache24\bin\httpd -S

PHP Edits

Now we have to do a few edits to the php.ini file to tell it to load support for mysql and the location for the extensions. Since there is not a already set php.ini file we need to rename one of the two examples to php.ini.

Rename c:\php\php.ini-development to php.ini

Now let’s edit php.ini
Uncomment extension directory.

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
extension_dir = "ext"

Uncomment mysql modules
extension=php_mysql.dll
extension=php_mysqli.dll

Save the changes and open a command prompt. Check to make sure it shows loaded modules.

C:\> php -m

So now we have Apache running and configured to use php. Lets create a file called info.php, save it and see if Apache parses the info correctly to display the results.

Open Notepad or your favorite Windows editor and type and save the following.

 <?php
phpinfo();
?>

Open your browser and type, localhost/info.php for the location and you should receive alot of information about PHP.

MySQL
Download and install mysql-5.5.21-win64.msi. Change installation directory to C:\MySQL\MySQL Server 5.5 instead of Program files as there could be permissions issues. Once the installation is completed you can let the configuration wizard run and setup the database server. The defaults will work just fine, but remember what you set the password to for root.

PHPMyAdmin
PHPMyAdmin is a very nice tool to use for administering your MySQL installation.
Download and install phpmyadmin-3.4.10.1-english.zip.
Extract the file and move to c:\apache24\htdocs. Rename directory to phpmyadmin.
Create a config directory under phpmyadmin. Open a browser and type localhost/phpmyadmin/setup/index.php to complete the installation.

At this point you should have a working Apache / PHP / MySQL installation running and ready for you to start developing !!!

Install BlueGriffon Web Editor on Fedora 16 x64

Just recently had the need to try out a new wysiwyg web editor and remember from years ago using NVU which is a simple graphical editor based on Netscape / Gecko engine. Development stop and was taken up by Kompozer which was stopped as well, but now has new life under BlueGriffon.

BlueGriffon is a new WYSIWYG content editor for the World Wide Web. Powered by Gecko, the rendering engine of Firefox 4, it’s a modern and robust solution to edit Web pages in conformance to the latest Web Standards.

There are a few prerequisites to install first when running 64 bit for the 32 bit libraries.

Open a terminal and run the following commands.

$ sudo yum install libXt.i686 oxygen-gtk.i686 oxygen-gtk gtk2-engines.i686

This will install all the needed libraries for BlueGriffon. Now lets download BlueGriffon itself from here. The current version at this writing is 1.4.

Now lets install it.

$ sudo rpm -Uvh bluegriffon-1.4-1.fc16.i686.rpm

That’s all that is needed and now we are ready to fire it up and start editing. When opening up the program you will receive a simple but effective interface.

There are several free addons available here and also pay addons. If you want a free, lightweight GUI editor then BlueGriffon is the one for you.

phpmyfaq on CentOS 5.5

Recently I ran into the need to create a Knowledgebase on my local network, basically a Faq that I could post how I have resolved issues with different hardware and software issues with my company. With a search on Google I came across phpmyfaq that runs on PHP with MySQL. The current version will not run on CentOS due to the requirement of PHP 5.2.x or higher which is not available in the stable repositories for the current CentOS release. However I was able to find 2.0.17 supports PHP 5.1.x series which is available.

Download 2.0.17 tar.gz file from phpmyfaq 2.0.17 tar to your server.

$ sudo su -
# tar zxvf phpmyfaq*.tar.gz -C /var/www/html/
# cd /var/www/html
# mv phpmyfaq-2.0.17/ faq/
# cd faq/

Create some sub-directories needed by the application.
# mkdir directory attachments
# mkdir directory data
# mkdir images/Image
# mkdir pdf
# mkdir xml

Set a few directory permissions for the installer to create the files it needs.

# chmod -R 755 attachments/
# chmod -R 755 data/
# chmod -R 755 pdf/
# chmod -R 755 xml/
# chmod -R 777 inc/
# chmod -R 777 images/

Exit as root and revertback to your user id. Create blank MySQL database and faq user and grant access For this example we are creating a user called faq with the password pHpmyf8q and a database called phpmyfaq and granting the faq user all rights to the database.

$ mysql -u root -p
mysql> CREATE DATABASE `phpmyfaq` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
mysql> CREATE USER 'faq'@'localhost' IDENTIFIED BY 'pHpmyf8q';
mysql> CREATE USER 'faq'@'%' IDENTIFIED BY 'pHpmyf8q';
mysql> GRANT ALL ON `phpmyfaq` . * TO 'faq'@'localhost';
mysql> GRANT ALL ON `phpmyfaq` . * TO 'faq'@'%';
mysql> exit

Now we are ready to open the installer web page and set the database settings and admin user account to finish the installation. Open a web browser and type http://<your_server_name>/faq/install/installer.php.

You will be presented with a page asking for database type and connection information as well as admin user and id. Using the information from this example

SQL Server: MySQL 4.x/5.x/6.x (PHP 4/PHP 5)
SQL server host: localhost
SQL username: faq
SQL password: <super secret pasword>
SQL database: phpmyfaq
Table prefix: knowledgebase (if you plan to have more than one Faq you need to put a value here, otherwise leave it blank)

Fill in the information in the phpMyFAQ information and click on Install phpMFAQ 2.0.17 now! and you are done.

phpMyFAQ is now running and is just in need of a few users with rights to post. Access the admin page at http://<your_server_name>/faq/admin/index.php and supply the credentials you setup. Once you are in, you can add users. To access the faq http://<your_server_name>/faq/.

Switch to our mobile site