|
Posted by W Marsh on 07/15/07 14:52
On 15 Jul, 15:27, Jerry Stuckle <jstuck...@attglobal.net> wrote:
> 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...
>
> > 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.
Well, there is. Not a single person outside of the company will ever
see this code, because it's a backend system that powers customer
facing front ends. Surely you have come across such a situation
before! Not all PHP ends up as forum software.
>
> > 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.
I'm sure you don't like Google Groups, but it's a useful tool.
Searching your posts reveals the same attitude across the board. Your
prey is innocent people requesting help, and you feed on them by
taking any opportunity you can to point out flaws in their questions,
or failing that, their posting style. It's an all too common geekish
attitude, and you're only embarrassing yourself by conforming
wholesale to an unattractive, unintelligent stereotype. Pretending
that you don't understand the question because it isn't formatted to
your requirements is just obtuse. I understand your pain, and I'm
guilty of similar things to some extent, but your arrogance record and
tag team bullying is awful.
>
> > 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.
If you want to help here... etc. etc.
>
>
>
> > 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.
Yes, that would have been useful information. I would have provided it
in a much nicer way if you made a less sarcastic request, and I hadn't
just looked at your other posts!
>
> 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");
Yuck. I dislike PHP, as a language. I wish that I didn't have to use
it. It seems almost designed to catch the programmer out - a syntax
error should be rigid. The fact that the code works anyway seems more
like a "syntax recommendation". It is ridiculous for PHP to make the
assumption that the programmer has read every detail of the (poor)
documentation that exists for language elements, and punish the time-
pressed newcomer by expecting him to know that there is an option for
enabling all errors.
> Now some other questions:
>
> What versions of PHP are the two systems using?
I can't be minor version accurate about the production server on a
Sunday, but I know it's PHP5. The server I did the successful test on
is running PHP 4.4.2.
> What OS are they using?
Production: Gentoo Linux.
Test: Ubuntu Linux
> What directory are you writing the file to?
Production: /usr/censored/censored2/files/
Test: /home/var/wwwroot/vhosts/sitename.com/httpdocs
> Do you have permission to flock() the file?
Yes.
> Once I corrected the above problem your code works on two different systems.
I suspect it will work on most systems, which is unfortunate for me,
as it probably means I am facing an obscure configuration issue.
Thanks for your help.
[Back to original message]
|