|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2002-02-01 11:05 UTC] mike at dct-mail dot com
 Running the 4.1.1 binaries from php.net:
Using mssql_query() to issue a backup statement doesn't work
$conn = msssql_connect("localhost", "sa", "") or die("bad");
$sql = "BACKUP DATABASE Northwind TO DC_Northwind";
$result = mssql_query($sql, $conn);
mssql_close($conn);
sets $result to 1 and the script prints:
MS SQL message: Cannot create worker thread. (severity 16) in Unknown on Line 0
MS SQL message: BACKUP DATABASE is terminating abnormally. (severity 16) in Unknown on Line 0
Then a dialog box reports:
The instruction at "0x100a0f9d" referenced memory at "0x00000000". The memory cannot be "written".
SQL Profiler confirms that the backup failed.
If a sleep(25) is placed after the call to mssql_query():
1) The warning messages aren't displayed
2) The backup actually succeeds
but
3) The dialog box still appears (and the script terminates).
Using the 4.0.6 binaries from the web site the backup behaves identically, BUT the dialog box does not appear and the script terminates cleanly.
The SQL Server has all service packs installed and the backup commands work without problem from the query analyzer or isql.exe
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
Both php4 and php5 works fine with backups. You need to create the decice fiest with a command like this: sp_addumpdevice 'disk', 'DC_Northwind', 'c:\backup' This code create the backup $con = mssql_connect("pear_mdb", "sa", ""); if ($con) { mssql_select_db("master", $con); $rs = mssql_query("BACKUP DATABASE Northwind TO DC_Northwind with format", $con); mssql_close($con); } Notice the with format, this forces the device to be overwritten on each backup.