|
Posted by Jerry Stuckle on 07/15/07 14:27
W Marsh wrote:
> On 15 Jul, 14:41, Jerry Stuckle <jstuck...@attglobal.net> wrote:
>> Sorry, my crystal ball is in the shop. I have no idea what might be
>> happening. Maybe if you post your code...
>>
>> --
>> ==================
>> Remove the "x" from my email address
>> Jerry Stuckle
>> JDS Computer Training Corp.
>> jstuck...@attglobal.net
>> ==================
>
> No. For one thing it's private, commercial code, and secondly, I've
> given enough information about the problem.
>
Maybe in your opinion you have. But you have given us no idea about how
you're going about the problem or a lot of other things.
If you had given enough information, we could help you.
And BTW - in PHP there is no such thing as "private" code. Once you
give it to a customer the source is available, unless you get one of the
encryption engines, i.e. from Zend.
> I don't appreciate people making sarcastic comments like that. If you
> have no idea about the problem then keep quiet, or if you genuinely
> are missing important details, make a polite request, e.g. "Are you
> doing X between closing and re-opening the file?". I'm not an outlet
> for problems with your insecurities and ego.
>
And I don't appreciate people arguing that they have provided enough
information when they are asking for help.
I have no insecurities, and my ego isn't a problem. But obviously yours
are.
> If you really are that unimaginative, then here's some code (using my
> own original description as a design spec, proving my point somewhat):
>
I don't need to be "imaginative". I can come up with at least a half
dozen ways to do what your description says you're doing.
I need to see the code YOU are using.
If you want help here, you need to get rid of the attitude and post
something which SHOWS the problem.
> define(FILE_NAME, "somefile.txt");
>
> $dataOrig = array("here", "is", "some", "data", "to", "be",
> "serialized");
>
> $file = fopen(FILE_NAME, "w");
> flock($file, LOCK_EX);
> fwrite($file, serialize($dataOrig));
> fclose($file);
>
> $file = fopen(FILE_NAME, "r");
> $dataNew = unserialize(fread($file, filesize(FILE_NAME)));
>
> print_r($dataNew); // Expected output: Array ( [0] => here [1] => is
> [2] => some [3] => data [4] => to [5] => be [6] => serialized )
>
> It is not representative of the original code in terms of design or
> error checking, but it does reproduce the problem on the production
> server (no output, due to getting no data in the original file). It
> does however run correctly on a my own web server, which suggests the
> problem is one of configuration that somebody with experience in this
> field could shed some light on, which I would be grateful for.
>
> Do you see?
>
Now we're getting someplace - and this is MUCH DIFFERENT than your
original problem. The fact it works on one server but not another is
something you never mentioned before, for instance.
For one thing, you don't have all errors enabled - or you would have
seen that your first line is wrong. It should be:
define('FILE_NAME', "somefile.txt");
Now some other questions:
What versions of PHP are the two systems using?
What OS are they using?
What directory are you writing the file to?
Do you have permission to flock() the file?
Once I corrected the above problem your code works on two different systems.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|