Jump to content

fopen flock flcose errors, but they go away with php -n (no ini file)


Recommended Posts

Not sure this is 100% script related but this looks like a section that can help.  I'm merging a script over from a old machine (i7) to a new machine (Atom)  same OS (Gentoo amd64_x86) on both and both are emerged current.  Both run PHP 5.3.3-pl1-gentoo (cli).

 

On the orginal machine all is fine.

 

when I attempt to run this script on the 2nd machine I get the following error, but it will run fine after the warnings.

php hellavcr.php

PHP Warning:  fopen(/var/lock/hellavcr.pid): failed to open stream: Permission denied in /home/stivo/SERVER/hellavcr/hellavcr.php on line 1088

PHP Warning:  flock() expects parameter 1 to be resource, boolean given in /home/stivo/SERVER/hellavcr/hellavcr.php on line 1089

PHP Warning:  fwrite() expects parameter 1 to be resource, boolean given in /home/stivo/SERVER/hellavcr/hellavcr.php on line 1090

PHP Warning:  fclose() expects parameter 1 to be resource, boolean given in /home/stivo/SERVER/hellavcr/hellavcr.php on line 1091

 

However if i run it without calling the ini file :

php -n hellavcr.php 

all works well without any warnings.

 

Anyone know off the top of their head what config I am missing in my php.ini file that would cause the above. I've attempted to diff them, but they don't match line for line and towards the end it's all showing different.  I don't think It's the script causing me errors, just my config.

 

For the curious , lines 1088-1091

 

$f = fopen($config['lock_file'], 'w');

flock($f, LOCK_EX);

fwrite($f, posix_getpid() . "\n");

fclose($f);

$config['pid_files'][] = $config['lock_file'];

 

 

Thanks

 

 

 

 

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.