User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 426,141 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,688 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 2012 | Replies: 1
Reply
Join Date: May 2007
Posts: 59
Reputation: dudegio is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
dudegio dudegio is offline Offline
Junior Poster in Training

Question mkdir() failed (No such file or directory)

  #1  
Jun 29th, 2007
Have a nice day to everyone!

Pls help me on how am i going to configure my document root and drives for the fact that i encounter this errors: pls... pls... pls...

Warning: mkdir() failed (No such file or directory) in C:\websites\pjs3\BillingRegularDetailedSave.php on line 1928

Warning
: fopen("/PJS/2007-06-29/000002.txt", "a") - No such file or directory in C:\websites\pjs3\BillingRegularDetailedSave.php on line 1935
Cannot open file (/PJS/2007-06-29/000002.txt)


Here is my code in creating directory and file.txt in doc root:

$dir1 = $_SERVER['DOCUMENT_ROOT'];
$datetoday =date("Y-m-d");
if (!file_exists("$dir1/PJS/$datetoday"))
{
$dir = mkdir("$dir1/PJS/$datetoday", 0700);
}
$result1 = mysql_query ("select bs_number, date, transactionType, subject_id, matter_id, client_id, attorney_id, rate, time, currency_nick, legalFees, fax, misc, misc_1, misc_2, misc_3, misc_4, photocopying, postage, printing, processing, telephone, transportation, vat, particulars from billingstatement") or die (mysql_error());

$filename = $_SERVER['DOCUMENT_ROOT'].'/PJS/'.$datetoday.'/'.$bsnum.'.txt';

if (!$handle = fopen($filename, 'a')) {
print "Cannot open file ($filename)";
exit;
}

if (is_writable($filename)) {

while ($row = mysql_fetch_row($result1)) {
$row_content = implode (",",$row)."\r\n";
// Write $row_content to our opened file.
if (!fwrite($handle, $row_content)) {
print "Cannot write to file ($filename)";
exit;
}
}

print "Success, content wrote to file ($filename)";

fclose($handle);

} else {
print "The file $filename is not writable";
}

Warning: unlink() failed (No such file or directory) in C:\websites\pjs3\BillingStatementRecordPerBSNumberShow.php on line 508




Here is my code for deleting a file in doc root and database.

$filename1 = $_SERVER['DOCUMENT_ROOT'].'/PJS/'.$fldbsnumdate1.'/'.$fldbsnumdelete.'.txt';

unlink($filename1);

$result2 = mysql_query("delete from billingstatementhistory where bs_number = $fldbsnumdelete");



Please help. Im fresh to Php and for sure the error is does not direct to the document root and drives for the fact that it does not trace the directory of the doc root. pls help me. im meeting my deadline. this system works before but i used xampp so they require me to use IIS so i have to configure it manually. pls help. thanks a lot...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2006
Posts: 138
Reputation: php_daemon is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 2
php_daemon php_daemon is offline Offline
Junior Poster

Re: mkdir() failed (No such file or directory)

  #2  
Jul 1st, 2007
$_SERVER['DOCUMENT_ROOT'] is not defined in IIS, check this user comment on PHP Manual: http://www.php.net/manual/en/reserve...bles.php#59409
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:00 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC