Error: Error locking file, please try again later.

Post your Click counter digestion problems here
Post Reply
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Error: Error locking file, please try again later.

Post by Pyrotactix »

Script URL: http://testacastaneda.ipage.com/count
Version of script: 2.0.3
Hosting company: ipage
URL of phpinfo.php: http://testacastaneda.ipage.com/count/phpinfo.php
URL of session_test.php: http://testacastaneda.ipage.com/count/session_test.php
What terms did you try when SEARCHING for a solution: Error locking file, please try again later.
Looked at this article but didn't work for me. viewtopic.php?f=8&t=2234&hilit=flock#p9376
Write your message below: Script was working fine. Then started to intermittently show the Error locking file. Checked session.save path and permissions/owner on the account, changed the PHP versions from 5.2 to 5.3. It is now every time. Tried on FireFox chrome and even ie.

Even tried to reset all links, but get the error "Error: Error writing to database file, please try again later."

Thank you for looking into this.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error: Error locking file, please try again later.

Post by Klemen »

This could be a permissions issue where CCount doesn't have permission to write to the database file.

Are you able to modify links or add new ones from the admin interface?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Yeah that's what I was thinking.
I set the database file from 644 to 777 and still not able to create a new link

-rwxrwxrwx 4.1K Jun 11 18:49 ccount_database.php

The Directory above is 755

I can supply you with ftp info if needed
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error: Error locking file, please try again later.

Post by Klemen »

Does setting the database file to 666 work?

How about saving CCount settings page - does that work?

Do you have SSH access to you server so we can verify file owner?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Doesn't work with 666
Not able to save.
Yeah checked the owner group
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Did a brand new install to a new directory
http://testacastaneda.ipage.com/count2
and same issue. Its not letting me finish the install to write the new pw to the file
checked the owner/group from parent directories and looks good. I even reset them to be sure. reset the perms too.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error: Error locking file, please try again later.

Post by Klemen »

The install script uses simply file_put_contents PHP function.

How about this:

1. create an empty file called "file.php"
2. make sure it's writable (666)
3. save this code as "test.php"

Code: Select all

<?php
file_put_contents("file.php", "<?php echo 'OK'; ?>");
echo 'Try <a href="file.php">Go to file.php</a>';
?>
4. put it in the same folder as "file.php" and run "test.php" in browser
5. does the file.php get written with the test echo "OK" code?

If that doesn't work you will need to talk to your host and check why you cannot write to files using PHP.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Yeah I was looking at file_put_contents too and it works
http://testacastaneda.ipage.com/count/test.php
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error: Error locking file, please try again later.

Post by Klemen »

Hmm, let me guess - it stops working if you change test.php to this?

Code: Select all

<?php
file_put_contents("file.php", "<?php echo 'TEST 2 WORKS'; ?>", LOCK_EX);
echo 'Try <a href="file.php">Go to file.php</a>';
?>
The file.php should now output "TEST 2 WORKS"
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Yeah that one created the file but didn't write anything to it.
Klemen
Site Admin
Posts: 10116
Joined: Fri Feb 11, 2005 4:04 pm

Re: Error: Error locking file, please try again later.

Post by Klemen »

This means PHP file locking doesn't work on your server.


The "correct" way forward would be to contact your host and ask them to check why PHP fails every time a file locking function is used.


The "hacker" way forward would be to:

1. open each CCount file and delete all instances of this exact code (including the comma):

Code: Select all

, LOCK_EX
2. Open "count.php" and change

Code: Select all

$locked = flock($fp, LOCK_EX);
to

Code: Select all

$locked = 1;
and delete

Code: Select all

flock($fp, LOCK_UN);
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Pyrotactix
Posts: 7
Joined: Fri Jun 12, 2015 9:59 pm

Re: Error: Error locking file, please try again later.

Post by Pyrotactix »

Got it resolved. It was something on this account that turned that function off.

Thank you
Post Reply