Jump to content

[SOLVED] Warning: flock() expects parameter 1 to be resource


Recommended Posts

i'm getting the error in the topic with this code. i don't think i'm pointing to the correct path using  $DOCUMENT_ROOT.

 

$DOCUMENT_ROOT = $SERVER['DOCUMENT ROOT'];

// open file for appending
@ $fp = fopen("$DOCUMENT_ROOT/www.domain.com/orders/orders.txt", 'ab');

flock($fp, LOCK_EX);

if (!$fp) {
echo "<p><strong>Your order could not be processed at this time.
	 Please try again later.</strong></p></body></html>";
exit;
}

 

- the .php file is uploaded in /www.domain.com/test/processorder.php

- the orders.txt is uploaded in /www.domain.com/orders/orders.txt

 

how do i know 100% if i'm pointing to the right file in fopen?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.