2011-04-27
Change location of WSUS update files
2010-11-24
Running Apache 2.2.x PHP 4.4.x and MySQL 5.1.x under Windows Server 2003
These are steps I took to successfully launch old PHP 4 website on windows 2003 using following software:
Apache 2.2.17
MySQL 5.1.53
PHP 4.4.9
1. Download and install PHP 4.4.9
You can download PHP 4.4.9 from here
After download is finished just extract it to C:\php
2. Download, install and configure Apache 2.2.17
Download windows installer from here
Installation should go without any problems so I will jump to the Apache configuration for PHP:
Open Apache configuration file (default location C:\Program Files\Apache Software Foundation\Apache2.2\conf\Httpd.conf) with any text editor.
To enable Apache processing of PHP pages find a line similar to this:
DirectoryIndex index.html
and edit it to something like this:
DirectoryIndex index.php index.html
You’ll also need to permit the use of .htaccess files in any directory, so search for an AllowOverride setting and change it from None to All
Copy all dlls from C:\Php\dlls to the Windows system directory (default C:\windows\system32). Look for the section of Apache’s configuration file that contains AddType commands, and add this one:
AddType application/x-httpd-php .php
Copy C:\Php\Php.ini-recommended to your Windows\system32 directory, rename it to Php.ini, and open it in a text editor. Edit the lines that set doc_root, extension_dir, and session.save_path so they look like the following:
doc_root = "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs"
extension_dir = "c:\php\extensions"
session.save_path = "c:\temp"
You’ll need to create C:\Temp if it doesn’t already exist.
The next two steps are to enable Apache to run PHP programs as modules.
First, copy C:\Php\Php4ts.dll to your Windows\system32 folder.
(note that the default file php4apache2.dll which comes in the php package won't work with apache 2.2 so you will have to download the file in the link above, if the link is no longer valid - contact me I still might have a copy).
Look for the LoadModule section in Httpd.conf and add this line:
LoadModule php4_module modules/php4apache2.dll
3. Downloading, installing and configuring MySQL
Download MySQL 5.1.53 from here
After installing it, open configuration file (default location C:\Program Files\MySQL\MySQL Server 5.1\my.ini) and add the following line:
old-passwords
when you change the server to use old-passwords, any existing accounts need to have their password changed to the old password format. Example:
mysql> SET PASSWORD FOR 'username'@'hostname' = OLD_PASSWORD('mypassword');
Where 'username'@'hostname' is the account and client host you use, and 'mypassword' is the password you want to use for that account.
You need that last step to enable a PHP4 application to connect to a MySQL 4.1 or later, else you will probably see the following message: "Client does not support authentication protocol"
4. Testing
First of all after saving all previous changes restart the Apache server.
Now to see if we set everything correctly navigate to the htdocs folder (default location: C:\Program Files\Apache Software Foundation\Apache2.2\htdocs) and create 2 php files there.
First one to test php - name it index.php and add following line to it:
Save the file and navigate to http://localhost on you broswer, if you see PHP information - congrats PHP and Apache are setup correctly.
Name second file testsql.php and add following code to it:
<?
$db_link = mysql_connect ("localhost", "root", "mypassword") or die ("Connection Failed!");
if($db_link) { echo "<b>Connection to MySQL server initiated successfully!</b>"; }
mysql_close();
?>
Links:
http://forge.mysql.com/wiki/PHP_FAQ
Errors encountered:
httpd.exe: Syntax error Cannot load php4apache2.dll into server: The specified module could not be found. - Solved by replacing php4apache2.dll to one downloaded
Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client - Solved by adding "old-passwords" line to MySQL configuration file my.ini
2010-03-15
Upgrade Windows 7 RC to Windows 7 RTM
You can also do this with ISO image before burning it to dvd.
Just tested - works with Server 2008 R2 RC to Server 2008 R2 RTM.
One more thing, upgrade from windows, don't boot from usb or dvd it will ask you to boot up you windows and launch setup then.
2009-11-16
2009-11-13
Move databases from SQL 2005 to SQL 2008
Contents:
Step 1 - Making a backup of database.
Step 2 - Restoring databases.
Step 3 - Transfer of logins and passwords
Source: Server A - SQL 2005
Destination: Server B - SQL 2008
Step 1 - Making a backup of database.
On the source server: Open Microsoft SQL Server Management Studio
method a) (preferable when backuping a single database)
expand ServerA -> Databases
right click on the database you want to backup and choose Tasks -> Back Up
Backup type: Full
Backup component: Database
now choose where you want to put your backup file - click Add and enter path and file name (you can enter share location as well for example \\Server_B\backups\database1.bak)
Click OK.
method b) (when backuping few, lots or all databases)
expand ServerA -> Management
right click Maintenance Plans and choose Maintenance Plan Wizard
on the first page of the wizard click Next
on the second page enter name for your backup plan, choose "Single schedule for the entire plan or no schedule", enter schedule setings or leave it on demand if you want to run it manualy, and click Next.
third page select "Back Up Database (Full)" and click Next
fourth page - Next
fifth page - choose which databases you want to backup, select "Create a backup file for every database" and select a location for backups (preferably share on the destination server \\Server_B\backups\)
sixth page - Next
and at last - Finish
after wizard finishes to create your maintenance plan - click Close
Now expand Maintenante Plans and you will see your maintenance plan listed there. Right click it and Execute.
Step 2 - Restoring databases.
On the destination server: Open Microsoft SQL Server Management Studio
expand ServerB, right click Databases and choose Restore Database
enter the name of database you are going to restore
To database: database1
then choose "From device" and browse for you database backup file
once you add it select it and press OK
Step 3 - Transfer of logins and passwords (http://support.microsoft.com/kb/918992/)
3.1 On source Server A open New Query in the Microsoft SQL Management Studio
paste and execute the following code:
GO
IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL
DROP PROCEDURE sp_hexadecimal
GO
CREATE PROCEDURE sp_hexadecimal
@binvalue varbinary(256),
@hexvalue varchar (514) OUTPUT
AS
DECLARE @charvalue varchar (514)
DECLARE @i int
DECLARE @length int
DECLARE @hexstring char(16)
SELECT @charvalue = '0x'
SELECT @i = 1
SELECT @length = DATALENGTH (@binvalue)
SELECT @hexstring = '0123456789ABCDEF'
WHILE (@i <= @length) BEGIN DECLARE @tempint int DECLARE @firstint int DECLARE @secondint int SELECT @tempint = CONVERT(int, SUBSTRING(@binvalue,@i,1)) SELECT @firstint = FLOOR(@tempint/16) SELECT @secondint = @tempint - (@firstint*16) SELECT @charvalue = @charvalue + SUBSTRING(@hexstring, @firstint+1, 1) + SUBSTRING(@hexstring, @secondint+1, 1) SELECT @i = @i + 1 END SELECT @hexvalue = @charvalue GO IF OBJECT_ID ('sp_help_revlogin') IS NOT NULL DROP PROCEDURE sp_help_revlogin GO CREATE PROCEDURE sp_help_revlogin @login_name sysname = NULL AS DECLARE @name sysname DECLARE @type varchar (1) DECLARE @hasaccess int DECLARE @denylogin int DECLARE @is_disabled int DECLARE @PWD_varbinary varbinary (256) DECLARE @PWD_string varchar (514) DECLARE @SID_varbinary varbinary (85) DECLARE @SID_string varchar (514) DECLARE @tmpstr varchar (1024) DECLARE @is_policy_checked varchar (3) DECLARE @is_expiration_checked varchar (3) DECLARE @defaultdb sysname IF (@login_name IS NULL) DECLARE login_curs CURSOR FOR SELECT p.sid, p.name, p.type, p.is_disabled, p.default_database_name, l.hasaccess, l.denylogin FROM sys.server_principals p LEFT JOIN sys.syslogins l ON ( l.name = p.name ) WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name <> 'sa'
ELSE
DECLARE login_curs CURSOR FOR
SELECT p.sid, p.name, p.type, p.is_disabled, p.default_database_name, l.hasaccess, l.denylogin FROM
sys.server_principals p LEFT JOIN sys.syslogins l
ON ( l.name = p.name ) WHERE p.type IN ( 'S', 'G', 'U' ) AND p.name = @login_name
OPEN login_curs
FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @defaultdb, @hasaccess, @denylogin
IF (@@fetch_status = -1)
BEGIN
PRINT 'No login(s) found.'
CLOSE login_curs
DEALLOCATE login_curs
RETURN -1
END
SET @tmpstr = '/* sp_help_revlogin script '
PRINT @tmpstr
SET @tmpstr = '** Generated ' + CONVERT (varchar, GETDATE()) + ' on ' + @@SERVERNAME + ' */'
PRINT @tmpstr
PRINT ''
WHILE (@@fetch_status <> -1)
BEGIN
IF (@@fetch_status <> -2)
BEGIN
PRINT ''
SET @tmpstr = '-- Login: ' + @name
PRINT @tmpstr
IF (@type IN ( 'G', 'U'))
BEGIN -- NT authenticated account/group
SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name ) + ' FROM WINDOWS WITH DEFAULT_DATABASE = [' + @defaultdb + ']'
END
ELSE BEGIN -- SQL Server authentication
-- obtain password and sid
SET @PWD_varbinary = CAST( LOGINPROPERTY( @name, 'PasswordHash' ) AS varbinary (256) )
EXEC sp_hexadecimal @PWD_varbinary, @PWD_string OUT
EXEC sp_hexadecimal @SID_varbinary,@SID_string OUT
-- obtain password policy state
SELECT @is_policy_checked = CASE is_policy_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END FROM sys.sql_logins WHERE name = @name
SELECT @is_expiration_checked = CASE is_expiration_checked WHEN 1 THEN 'ON' WHEN 0 THEN 'OFF' ELSE NULL END FROM sys.sql_logins WHERE name = @name
SET @tmpstr = 'CREATE LOGIN ' + QUOTENAME( @name ) + ' WITH PASSWORD = ' + @PWD_string + ' HASHED, SID = ' + @SID_string + ', DEFAULT_DATABASE = [' + @defaultdb + ']'
IF ( @is_policy_checked IS NOT NULL )
BEGIN
SET @tmpstr = @tmpstr + ', CHECK_POLICY = ' + @is_policy_checked
END
IF ( @is_expiration_checked IS NOT NULL )
BEGIN
SET @tmpstr = @tmpstr + ', CHECK_EXPIRATION = ' + @is_expiration_checked
END
END
IF (@denylogin = 1)
BEGIN -- login is denied access
SET @tmpstr = @tmpstr + '; DENY CONNECT SQL TO ' + QUOTENAME( @name )
END
ELSE IF (@hasaccess = 0)
BEGIN -- login exists but does not have access
SET @tmpstr = @tmpstr + '; REVOKE CONNECT SQL TO ' + QUOTENAME( @name )
END
IF (@is_disabled = 1)
BEGIN -- login is disabled
SET @tmpstr = @tmpstr + '; ALTER LOGIN ' + QUOTENAME( @name ) + ' DISABLE'
END
PRINT @tmpstr
END
FETCH NEXT FROM login_curs INTO @SID_varbinary, @name, @type, @is_disabled, @defaultdb, @hasaccess, @denylogin
END
CLOSE login_curs
DEALLOCATE login_curs
RETURN 0
GO
this creates a stored procedure named sp_help_revlogin in ServerA/Databases/System Databases/Master/Programmability/Stored Procedures
3.2 Open New Query window again and run this code:
3.3 copy the outcome of the step 3.2 and paste it in the New Query window on destination Server B, execute it.