Move Squirrelmail to new web server

I recently rebuild an OS X webserver and migrated websites from an old Panther box. I had a website that was using Squirrelmail and this is what I ran into in moving the site over.

#1. I wasn’t able to login to the website with a valid username and password. I kept getting an APPEND error so I found this in a google search:

Ok. I debugged squirrelmail a little, and I found out, that the error occurs when sending the APPEND Command to IMAP.

I found the error in functions/imap_general.php

Reason: The following command is sent to imap when trying to append the sent message to “Sent” folder:

A004 APPEND "Sent" (\Seen) {$length}

The $length value is not parsed / replaced by php. So I changed line 891 from

fputs ($imap_stream, sqimap_session_id() . " APPEND
\"$sent_folder\" (\\Seen) \{$length}\r\n");

to

fputs ($imap_stream, sqimap_session_id() . " APPEND
\"$sent_folder\" (\\Seen) {" . $length . "}\r\n");
That resolved the issue of logging in. 

#2. Then I was able to login but I couldn't send out messages.  
I found other google posts that pointed here so I followed the instructions in both posts below and 
was able to get send and receive working. These changes were due to the fact that the new server is running a 
more current version of PHP
http://squirrelmail.cvs.sf.net/squirrelmail/squirrelmail/class/ \
 deliver/Deliver.class.php?r1=1.18.2.22&r2=1.18.2.23
http://squirrelmail.cvs.sf.net/squirrelmail/squirrelmail/class/ \
 mime/Message.class.php?r1=1.17.2.8&r2=1.17.2.10

#3 All was working except attachments. I found all the posts about checking file_uploads enabled in php.ini 
I increased the upload size to 25M even though the attachments were 4kB.  I checked what I thought was the directory the
attachments were being save to and none of it resolved the issue. I ran the config/conf.pl and the system squirrelmail said the
attachments were at /var/db/squirrelmail/attachments.
BUT ATTACHMENTS STILL NOT WORKING!!!

#4. FINALLY I found this http://sitename.com/src/configtest.php and found that my attachments directory for 
that particular site was different than the one from the conf.pl command line! I created the directory and edited the permissions
as appropriate and viola! Finally all is working!

Reset Windows Local Administrator account password via GPO

#1. Create a script with the following net user command

net user “Administrator” %1

The %1 allows you to pass a parameter to the script (ie the password) so you don’t store it in a file on the server.

#2 Create a GPO and add the following script to the start up script in the computer section.  You can disable the User configuration if that is all you are doing.  When adding the startup script, make sure to enter the new password as the parameter to the script.

#3 Create an OU and apply the GPO and any others needed to the OU.

#4. Add a test computer to the new OU and reboot the test computer.

#5 Test that you can login with the new password.

Install Apache, MySQL and PHP on Windows Server 2008

These instructions were taken from here: http://www.trap17.com/index.php/Installing-Apachemysql-Php-Windows_t3364.html

Installing Apache , MySQL and PHP under Windows

Introduction
While many webservers run
Linux, Unix or BSD most personals computers run on Windows.


So it would be quite comfortable if web designers and developers could develop on their home computer.So in this E-book we will focus on configuring your computer to use Apache, MySQL and PHP, so you can work on your home computer.

Step 1: Installing Apache
Apache is one of the most common webservers in the world.You can
download and use it for free.

You can go to http://httpd.apache.org/download.cgi and download the webserver here yourself.

Make sure you download the version for Windows (Win 32) WITH installer (MSI Installer) .

There are currently 2 branches available of Apache .

Apache2 is the new branch, Apache 1.3 is the old one.I’d recommend installing the latest version of the Apache 2 branch.

When you finished downloading the installer package(somewhere around 6MB) you can install Apache. Just execute the installer and install Apache somewhere in a logical place.

Make sure Apache is installed, but this is only possible under Windows 2000 or XP.

When you install Apache as a server, a small tool called Apache Monitor is also installed.

It is somewhere in the notification area(lower right corner, near the clock).

When you double click the icon you can start/stop and restart the Apache server.

When you change something in the configuration file of Apache (called httpd.conf ) you always have to restart Apache!

When you have installed Apache you can open your web browser and surf to http://localhost/ .

You should now see the standard website from the Apache server that Apache was successfully installed.

So, your webserver is now up and running!!!! Congratulations!

If you installed Apache in the default path, you can go to “ C:\Program Files\Apache Group\Apache2\htdocs ” and place your own HTML pages there and see them by surfing to http://localhost/. If you want to write a HTML only website, you are done now.

If you also want to create more sophisticated website, let’s proceed to the next software package.

Step 2: Installing MySQL
Now on to MySQL.

MySQL is a database.You can also download this one for free.

Surf to the MySQL website : http://dev.mysql.com/downloads/ to download the latest MySQL database server.The default install path is C:\mysql .It is best to leave this default path or else you will need a whole lot of more work to get it up and running.So install MySQL in the default path.

When MySQL is installed we need to test it, right?

We need a simple way to start and stop the MySQL server.

So, let’s create a .bat file to start the MySQL server.(I assume you installed the MySQL server in the directory C:\mysql)

Open Notepad.

Enter the following text:

C:\mysql\bin\mysqld –console

Save this file as mysqlstart.bat on your desktop.

Create a new file in Notepad and enter the following text:

C:\mysql\bin\mysqladmin -u root shutdown

Save this file as mysqlstop.bat on your desktop.

If everything is right you should now be able to start your MySQL server by executing(double click) the mysqlstart.bat file and stopping it by double clicking mysqlstop.bat .

What can we now do with the MySQL server?

A lot! But let’s first install PHP.

Step 3: Installing PHP
PHP is one of the most popular scripting languages used on the Internet nowadays.

You can create anything from guestbooks and shopping carts to complete auction sites and webmail applications with this language. So , let’s install it .

Go to http://www.php.net/downloads.php and download the latest version.

Go to “Windows binaries” and then the ZIP package, not the installer.We need the ZIP package, because we installed Apache and the ZIP package works best with the Apache server.

When you finished extract the zip package into C:/php .

Now comes the most difficult part: We need to let Apache know that PHP is installed.

Rename php.ini-recommended to php.ini .

Open this php.ini file in Notepad.

Look for the following line:

doc_root =

Set this to the Apache htdocs directory:

doc_root = “C:\Program Files\PHP”

This let’s PHP know where the PHP files should be…

Now we need to let Apache know that PHP in installed.

Go to the configuration folder of Apache( :\Program Files\Apache2\conf\ ) and open httpd.conf in Notepad .

Add the following lines to the file (doesn’t really matter where, I’ll leave that up to you):

LoadModule php5_module php5apache2.dll

AddType application/x-httpd-php .php

Look for the following line:

DirectoryIndex index.html index.html.var

and add index.php to the end of the line like this:

DirectoryIndex index.html index.html.var index.php

So, now Apache knows that PHP is installed.

And now what?

Let’s see what we can do with PHP 🙂

Start Apache (or restart if you already have it running).

Open Notepad and enter the following:

<?php

echo phpinfo();

?>

Save this file as phpinfo.php in your htdocs directory (“C:\Program Files\Apache Group\Apache2\htdocs”).

If you now surf to http://localhost/phpinfo.php you should see a page that shows all the info about your PHP installation you ever want to know. This is the proof that PHP is properly working.

Upgrade ESX 3.5 to 4.0 with Upgrade Manager

  1. Backup VirtualCenter Server database just to be safe.
  2. Perform an upgrade from VirtualCenter Server 2.5 to vCenter Server 4.0
  3. Download latest ESX 4.x update .iso from VMware. You will need your license account to login
  4. Login to vSphere client and enable the Upgrade Manager
  5. Browse to the Upgrade Manager tab
  6. Click on Admin View -> Download the patches from VMware through Upgrade Manager
  7. Exit Admin view
  8. Click on “Attach …” and create a baseline with the .iso you downloaded. Finish the install instructions.
  9. Create a Baseline group
  10. Select “Scan …” NOTE: Non-compliant means the ESX host or virtual machine is unpatched or out of date
  11. Make sure the host is in maintenance mode and there are no running virtual machines on it
  12. Select “Remediate …”
  13. Choose to update to upgrade to 4.0

FreeTDS

FreeTDS on Leopard 10.5

* Installed Entropy PHP 5.2.9.
* Installed freetds 0.82 via ports.
* Set the following environment variables:
FREETDS=/usr/local/php5/etc/freetds.conf
SYBASE=/usr/local/php5/lib
TDSLOG=/tmp/freetds.log
TDSPORT=1517
Note: We have a specific port for our queries, you will need to use the appropriate port (ie. 1433 for MSSQL default queries)
Created a couple symbolic links to the active freetds.conf file.
ln -s /usr/local/php5/etc/freetds.conf /etc/freetds.conf
ln -s /usr/local/php5/etc/freetds.conf /usr/local/etc/freetds.conf
ln -s /usr/local/php5/etc/freetds.conf /opt/local/freetds/etc/freetds.conf
REBOOT the server!!!
If that doesn’t fix it then it was the only other thing I did which was to force Apache to run in i386 mode:
There is currently an issue resulting from the fact that Apache on Mac OS X 10.5 is built as a 64 bit application. On Macs that support 64 bits (all current Mac models), Apache will run in 64 bit mode. This is incompatible with most ODBC drivers, including those currently available from Actual Technologies.
Until we can make 64 bit versions of our drivers available, we recommend a workaround to force Apache to run in 32 bit mode. Using the Terminal prompt, enter the following commands:
sudo mv /usr/sbin/httpd /usr/sbin/httpd.64
sudo lipo -thin i386 /usr/sbin/httpd.64 -output /usr/sbin/httpd.i386
sudo ln -s /usr/sbin/httpd.i386 /usr/sbin/httpd
Now restart Web Sharing in the System Preferences, and continue with the instructions for “Invoking ODBC Functions from ODBC” below.
NOTE: if you ever need to restore Apache to 64 bit mode, just enter the following command:
sudo mv /usr/sbin/httpd.ub /usr/sbin/httpd

omreport

Command level 1 Command level 2 Command level 3 User privilege required Use
omreport
about U, P, A Shows version number and properties for the Server Administrator program.
chassis U, P, A Shows a general status for all main components.
acswitch U, P, A Shows failover settings where redundant power units are installed in a system.
bios U, P, A Shows BIOS facts such as manufacturer, version, date last updated.
biossetup U, P, A Shows BIOS setup properties that you have configured during system boot.
currents U, P, A Shows the status and thresholds for the current system sensors.
events U, P, A Shows chassis event information.
fancontrol U, P, A Shows properties you have set for fan speed.
fans U, P, A Shows status and thresholds for system fans.
firmware U, P, A Shows firmware properties such as version, date of last update, and whether the firmware is updatable.
info U, P, A Shows a status summary for main system chassis components.
intrusion U, P, A Shows the status of the system’s intrusion sensor(s).
leds U, P, A Shows the properties you have set for LEDs to flash under various alert conditions.
memory U, P, A Shows properties of your system’s memory arrays.
nics U, P, A Shows number of NICs installed in your system, NIC vendor, NIC description, IP address, and connection status.
ports U, P, A Shows properties for your system’s parallel and serial ports, such as I/O address, IRQ level, connector type, and maximum speed.
powerbutton U, P, A Shows the power button control settings.
processors U, P, A Shows properties of your system’s processors, including speed, manufacturer, and processor family.
pwrsupplies U, P, A Shows properties of power supplies.
slots U, P, A Shows properties of your system’s expansion slots and other slot types.
temps U, P, A Shows the status and thresholds for the system temperature sensors.
volts U, P, A Shows the status and thresholds for the system voltage sensors.
storage U, P, A See “omreport: Using the Storage Reports.”
system U, P, A Shows a high-level summary of system components.
alertaction U, P, A Shows warning and failure threshold values, as well as actions that have been configured when an essential components detects a warning or failure state.
alertlog U, P, A Allows the administrator to show the alert log.
assetinfo U, P, A Shows cost of ownership information for your system.
cmdlog U, P, A Allows the administrator to show the command log.
esmlog U, P, A Allows the administrator to show the hardware log.
events U, P, A Shows the system’s SNMP event settings.
operatingsystem U, P, A Shows the name and version of your operating system.
postlog U, P, A Shows your system’s POST log.
recovery U, P, A Shows how your system is configured to respond to a hung operating system.
shutdown U, P, A Shows how the shutdown action is to be performed.
summary U, P, A Shows key facts for all system components, including main system chassis, software, and storage.
thrmshutdown U, P, A Shows what shutdown action, if any, is to be taken when a temperature warning or failure condition is detected.
version U, P, A Shows a summary for all updatable components on your system.
rac U, P, A See “omreport rac: Viewing Remote Access Controller Components.”

Enable RAID Leopard boot disk without a reinstall of OS

Instructions were taken from here: http://www.macosxhints.com/article.php?story=20041013121106176

The “enableRAID” command to change an existing active volume into a RAID slice doesn’t always work (diskutil sometimes refuses to do this). Here’s a safer and surer way to turn your boot disk into a RAID group with minimal down time and without installing OS X on the new disk.

The basic idea is to turn the new disk into an empty RAID slice (this seems to always work) and then copy the boot disk onto it. Boot up into this one-disk RAID group, and then turn the original boot disk into the second RAID slice. This is safe because you’ve already successfully booted into the copy before you overwrite the original. In more detail:

1) I started by using Disk Utility to erase the new drive I was adding. (Or OS X may offer to do this for you when you first plug the drive in). Make sure the format of the drive is OS Extended (Journaled). I named the new drive “BootRAID”. I then quit Disk Utility and from a terminal window ran “diskutil enableRAID mirror /Volumes/BootRAID” NOTE: The name of the drive is NOT relevant, as it can be changed when the process is compete.

2) I then restarted Disk Utility, clicked on the new drive and used the Restore option to copy the boot disk onto “BootRAID”. Note that the new drive has two entries in the list of volumes (slice name and RAID group name) and only one of these has the Restore option.

3) When the copy was complete I selected “BootRAID” as my boot disk in System Preferences and rebooted. This reboot was the only downtime.

4) Now I was booted into the one-disk (degraded) RAID group and I again used the graphical Disk Utility and dragged the old boot disk into the RAID
group. This erased the old boot disk and started the mirror “repair”.

NOTE: If you have issues just dragging and dropping the disk into the RAID group, you may need to erase the drive first!!

The repair copied the mirror disk onto the original disk, and a few hours later I had an intact mirrored RAID group as my boot disk.