php-general Digest 22 May 2007 04:07:58 -0000 Issue 4804

Topics (messages 255286 through 255303):

Re: [Linux] PHP and SQL Server
        255286 by: Mike Smith

Re: Include files....
        255287 by: Jason Pruim
        255300 by: Richard Lynch

How can i help
        255288 by: James Savage
        255289 by: Jay Blanchard
        255302 by: Ligaya A. Turmelle

Re: When does PHP free-up memory allocated to it?
        255290 by: Richard Lynch
        255297 by: Richard Davey

Re: Uploading Files Should I use MySQL or Server for storage?
        255291 by: Richard Lynch
        255292 by: Richard Lynch
        255301 by: Al

Re: PHP & MySQL Problem
        255293 by: Richard Lynch

Re: Marketplace Framework
        255294 by: Richard Lynch

Re: PHP Data Mining/Data Scraping
        255295 by: Richard Lynch

Re: Adserver programming with php
        255296 by: Richard Lynch

Re: php5 cert
        255298 by: Richard Lynch
        255299 by: Richard Lynch

Enabling LDAP on Plesk 8
        255303 by: Sn!per

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On 5/21/07, David BERCOT <[EMAIL PROTECTED]> wrote:
Hi Mike,

Le Mon, 21 May 2007 10:24:52 -0400,
"Mike Smith" <[EMAIL PROTECTED]> a écrit :
> David,
>
> Is MSDE running in mixed mode authentication? I believe by default it
> only uses Windows authentication. If you're not sure you can readup on
> how to check (and change if necessary):
>
> http://support.microsoft.com/kb/325022

I've just had a look and MSDE is in mixed mode (2 !) :-(

Thank you.

David.
I vaguely remember having to add :1433 to the freetds.conf on one
Debian server. A quick google turns up this, but I think I put the
server:port on one line (i.e. 192.168.1.11:1433):

http://lists.evolt.org/archive/Week-of-Mon-20030915/148291.html


--
Mike

--- End Message ---
--- Begin Message ---
Hi Everyone,

Thanks for the info, putting the opening and closing tags in the include file worked like a charm! Now I just need to get the SQL injection protection junk to work... Back to the web to read more!




--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
3251 132nd ave
Holland, MI, 49424
www.raoset.com
[EMAIL PROTECTED]

--- End Message ---
--- Begin Message ---
An include jumps back into HTML "mode" so you need:

<?php
  $server = "";
  $username = "";
.
.
.
?>

On Fri, May 18, 2007 3:05 pm, Jason Pruim wrote:
> Okay, Very Newbie-ish question coming!
>
> I can't figure out why my include won't work... Here's the text:
>
> index.php:
> <?PHP
>
> include 'defaults.php';
>
> $link = mysql_connect($server, $username, $password) or die('Could
> not connect: ' . mysql_error());
> echo 'Connected successfully <BR>';
> mysql_select_db($database) or die('Could not select database: ' .
> mysql_error());
> echo 'DB selected <BR>';
>
> $result = mysql_query($query) or die(mysql_error());
> $num=mysql_numrows($result);
> $i= 0;
>
>
> while($i < $num) {
>
>       $FName = mysql_result($result, $i,"FName");
>       $LName = mysql_result($result,$i,"LName");
>       $Add1 = mysql_result($result, $i,"Add1");
>       $Add2 = mysql_result($result, $i,"Add2");
>       $City = mysql_result($result, $i,"City");
>       $State = mysql_result($result, $i,"State");
>       $Zip = mysql_result($result, $i,"Zip");
>       $Date = date("m-d-y h:i:s",mysql_result($result, $i, "Date"));
>       $Record = mysql_result($result, $i, "Record");
>       $subName = mysql_result($result, $i,"subName");
>       $subEmail = mysql_result($result, $i,"subEmail");
>       $subPhone = mysql_result($result, $i,"subPhone");
>       $chkMember = unserialize(mysql_result($result, $i,"chkMember"));
>       $chkAdd = unserialize(mysql_result($result, $i,"chkAdd"));
>       $chkDel = unserialize(mysql_result($result, $i, "chkDel"));
>
>       $i++;
>
>       //echo "<P>$Record $FName, $LName,</P> <P>$Add1,<BR> $Add2,<BR></P>
> <P>$City, $State, $Zip,</P> $Date,<BR> $subName, $subEmail,
> $subPhone, $chkMember[$row], $chkAdd[$row], $chkDel[$row]<BR>";
>
>       echo "<H3>Name Address</H3>";
>       echo "<P id ='test'> $FName $LName $Add1 $Add2 $Date</P>";
>
> };
>
>
>
>
> ?>
> *
> defaults.php:
>
> $server = 'localhost';
> $username = 'USERNAME';
> $password = 'PASSWORD';
> $database = 'DATABASE';
> $query = 'SELECT * FROM current';
>
> Yes I changed the values of username, password, and database. But
> when I use the same info inside the index.php file it all works just
> fine. Here is the error that it gives me:
>
> [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
> server in /Volumes/RAIDer/webserver/Documents/tests/legion/index.php
> on line 5
> [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
> username in /Volumes/RAIDer/webserver/Documents/tests/legion/
> index.php on line 5
> [Fri May 18 15:32:07 2007] [error] PHP Notice:  Undefined variable:
> password in /Volumes/RAIDer/webserver/Documents/tests/legion/
> index.php on line 5
> [Fri May 18 15:32:07 2007] [error] PHP Warning:  mysql_connect() [<a
> href='function.mysql-connect'>function.mysql-connect</a>]: Access
> denied for user 'USERNAME'@'localhost' (using password: NO) in /
> Volumes/RAIDer/webserver/Documents/tests/legion/index.php on line 5
>
>
> Thanks in advance for helping me through my obvious friday afternoon
> brain fart...
>
>
>
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424
> www.raoset.com
> [EMAIL PROTECTED]
>
>
>


-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
I am a PHP web programmer with a little bit more than basic knowledge. What 
could i do to help with developing PHP? 

--- End Message ---
--- Begin Message ---
You can participate in the developers list. 

--- End Message ---
--- Begin Message ---
There are a number of ways to help depending upon what you want to do.
Any help is always appreciated.  An incomplete listing -
http://www.khankennels.com/blog/index.php/archives/2006/08/10/25-ways-to
-help-out-php/ 

Lig

-----Original Message-----
From: James Savage [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 22, 2007 7:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP] How can i help

I am a PHP web programmer with a little bit more than basic knowledge.
What could i do to help with developing PHP? 

--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Mon, May 21, 2007 4:23 am, Richard Davey wrote:
> Quick question - does anyone know when PHP actually frees allocated
> memory during the process of a script?

When it can be sure that a variable is no longer needed.

Specifically, when the .refcount of a zval turns to 0.

> I'm using 5.2.2. For example I
> see the following results when profiling:
>
> Memory: 256 KB
> Load a 1024x768 JPEG (via GD)
> Memory: 4 MB
> Create thumbnail (via GD)
> Memory: 5.2 MB
> Destroy original image resource (imagedestroy)

Try unset($image) as well, so PHP "knows" you no longer need access to
that variable that was holding all that stuff...

> Memory: 5.2 MB
>
> I would have expected (or rather, hoped) that the memory use would
> have dropped down quite dramatically after destroying the image
> resource that was using up nearly 4MB of memory, but it didn't seem to
> change.

How are you measuring this?

What version of PHP?

The Memory Manager changed over the course of time.

I'm also not at all sure that you *can* measure it as precisely as you
are trying to do.

> Is this a limitation of the memory_get_usage(true) function, or does
> imagedestroy not actually do what it implies?

Almost for sure imagedestroy() does what it should -- and GD frees up
the internal memory structures for that image.

PHP still has a variable sitting around pointing to that resource,
however, and you may need to notify PHP through unset() that you are
"done" with it.

That said:
PHP doesn't really allocate that 5.2M of RAM.
GD does.
PHP may not be able to tell you accurately about what GD is doing
internally -- but it's probably not *really* losing that 5.2M or you'd
hear an awful lot more screaming about it from all quarters. :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
Hi Richard,

Tuesday, May 22, 2007, 1:24:35 AM, you wrote:

>> I would have expected (or rather, hoped) that the memory use would
>> have dropped down quite dramatically after destroying the image
>> resource that was using up nearly 4MB of memory, but it didn't seem to
>> change.

> How are you measuring this?

memory_get_usage(true)

> What version of PHP?

5.2.2 (I did say :)

> The Memory Manager changed over the course of time.

Sure, but I'm only interested in how it works now :)

> I'm also not at all sure that you *can* measure it as precisely as you
> are trying to do.

I don't think you can measure it *accurately* right down to the byte,
but with big sweeping operations such as image resource deletion you
should see significant changes in value, and in some circumstances you
do (see blog link at the bottom)

> That said:
> PHP doesn't really allocate that 5.2M of RAM.
> GD does.

Horses for courses, surely? PHP asks GD to do it, the end result is
the same, the memory is being used.

> PHP may not be able to tell you accurately about what GD is doing
> internally -- but it's probably not *really* losing that 5.2M or you'd
> hear an awful lot more screaming about it from all quarters. :-)

True :)

Using the 5MB in the first place doesn't bother me, that's just a
simple allowance for each pixel of the image + RGB/Alpha values, which
is how GD works with it. What I found fascinating on further research
was how the memory can still be used depending simply on how you store
the image resource.

After more research I wrote about it here:
http://www.corephp.co.uk/archives/42-Interesting-memory-use-with-GD-images.html

Cheers,

Rich
-- 
Zend Certified Engineer
http://www.corephp.co.uk

"Never trust a computer you can't throw out of a window"

--- End Message ---
--- Begin Message ---

On Sun, May 20, 2007 8:16 pm, [EMAIL PROTECTED] wrote:
> I am in the process of adding a part to my website which would include
> pictures, pdf files, txt files, and excel files.  The files sizes
> could be anywhere on average of 100k to 2mb.  Do you think I should be
> uploading the files to a MySQL database or to my server?
>
> I have head that there are pros and cons to both, but have never
> really received a definitive answer that helps much.  I appreciate all
> your opinions on the pros and cons of both.

We've pretty much beat this horse to death around here...

So I'll try to give just one sample of each:

DB PRO:
Deleting image data can be simpler.

DB CON:
Difficult to scale out the DB when it has so much blob data; easy to
set up "image server" to segment architecture when it's just a bunch
of files to move and a line of PHP code to change the base URL.

There are enough fanatics on both sides of this coin...
I'm in the "put it in the file system" camp.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sun, May 20, 2007 10:43 pm, Robert Cummings wrote:
> On Sun, 2007-05-20 at 20:35 -0500, Greg Donald wrote:
>> On 5/20/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> > I am in the process of adding a part to my website which would
>> include
>> > pictures, pdf files, txt files, and excel files.  The files sizes
>> > could be anywhere on average of 100k to 2mb.  Do you think I
>> should be
>> > uploading the files to a MySQL database or to my server?
>>
>>
>> http://www.zend.com/zend/trick/tricks-sept-2001.php?id=342
>>
>> [snip]
>> cuts performance by approximately a third
>> [/snip]
>
> Sure, if you use database file storage in the naive way described in
> the
> document. But I'm quite certain a database stored binary file
> dispensed
> to multiple servers that keep a locally cached copy for subsequent
> requests beats NFS retrieval hands down. Sure, you could do the same
> caching with the NFS file but then the solution is quite likely just
> as
> good as the database storage solution. So the 1/3 performance penalty
> is
> for the naive solution.

Or you could put all the images on a multi-million dollar
content-distribution-network of image servers...

There are so many ways to skin this cat and make up a "benchmark" to
prove whatever you want to prove.

So just do whatever makes sense to you for your application at the tim
you do it, and accept the consequences, either way, down the road.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
Best of both worlds may be SQLite.  ZEND has a nice article on the subject.

[EMAIL PROTECTED] wrote:
I am in the process of adding a part to my website which would include
pictures, pdf files, txt files, and excel files.  The files sizes
could be anywhere on average of 100k to 2mb.  Do you think I should be
uploading the files to a MySQL database or to my server?

I have head that there are pros and cons to both, but have never
really received a definitive answer that helps much.  I appreciate all
your opinions on the pros and cons of both.

--- End Message ---
--- Begin Message ---
On Mon, May 21, 2007 2:26 am, Christian Haensel wrote:
> Good morning friends,
>
> I have a script that collects data from a form and puts together a
> mysql
> query to search a database.
> Now, everything worked fine until I added a few new form fields... now
> the
> $_POST['var'] don't reach the script...
>
> I have about 20 to 25 form fields which are all taken into the
> query...
>
> Now my question: is there a limit in the fields that I can use in the
> query
> string to query the database? Somehow the script doesn't even output
> the
> value of the POST data anymore... been using this stuff for years now,
> and
> i'm feeling really silly at the moment.
>
> I'd appreciate any help.

POST data *does* have a limit, possibly, based on your selection of
browser/server software...

It's a ridiculously high limit however, so it seems more likely that
you just added a typo to your code.

Show us code to get an answer.

And estimate for us the size of the POST data as well.

Without those bits of info, our answers will be:

Maybe.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sun, May 20, 2007 5:33 am, PHP Mailing List wrote:
> Is there any PHP's framework for developing a marketplace site ?

Yes.

Here is a site that will let you play with many of them:
http://www.opensourcecms.com/index.php

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sat, May 19, 2007 10:22 pm, Shannon Whitty wrote:
> I'm looking for a piece of software or coding that will let me post a
> form
> to another URL, accept the response, search it for a specific
> "success"
> string and then let me continue processing the rest of my program.

http://php.net/curl

> I want to accept queries on behalf of my supplier, forward it to them
> behind
> the scenes, accept their response and display it within my website.
>
> Has anyone had any experience with this?  Is there a simple, basic
> utility
> to let me do this?
>
> I was kind of hoping I could avoid developing it myself.

Search for PHP curl examples online, and you should find the code
simple enough to copy/paste and alter to taste...

It won't be quite as easy as "install forum X" but it shouldn't kill
you either...

The tricky bit is to figure out what to do when your result from the
supplier is not "success" nor "failure" but their site has gone down
and you've got some weird answer you've never seen before...

Or when they alter their web application and then yours breaks because
of it...

You'll end up taking a simple 5-line program and adding about 50 lines
of "what if" error handling if you do this right...  Or leave it at 5
lines and pray nothing goes wrong :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sat, May 19, 2007 7:15 pm, Merlin wrote:
> I am thinking about creating a kind of adserver which is customized
> for
> my needs.

The odds on your needs being THAT different from the existing dozens
of highly customizable adservers seems remote...

Save yourself a TON of money and do more research :-)

> As I would be most confident in doing this with php, I am
> asking myself if this is the right choice or if it would be wiser to
> take a C++ aproach for example to get a higher performance just in
> case
> the site grows fast.
> Do you guys think that a php build webserver would be able to scale
> and
> perform well enough for serving millions of adimpressions daily?

There are PHP sites handling millions of impressions daily, and that's
not even all that tricky, as I understand it...

What you might consider, if you decide to go down this path at all, is
to write it in PHP with an eye to developing a custom PHP extension by
re-writing your PHP code in C once you've worked out all the details.

This would give you the rapid prototyping and flexibility of PHP in
the early days, and satisfy any reasonable need for speed after you
are suitably crusty to not feel the need to make sudden changes, by
just porting the PHP code to C code.

Shouldn't be too hard to discipline yourself to only write PHP that
you know how to convert to C -- and, really, PHP ends up as byte-code
executed by C, so worst-case is you could dig into PHP Internals to
figure out what your tricky PHP is doing...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Fri, May 18, 2007 4:45 pm, Greg Donald wrote:
> Anyone wanna share their insights into the php5 cert test?  The php4
> test was pretty simple for me, but that was a couple of years ago.  It
> seems there's quite a bit of new material being covered on the php5
> version.  I figure with the same number of questions, things had to
> get more general if anything, right?

Didn't take either, but surveyed a half-dozen who took it at php|tek
last week...

My basic impression was that they threw out a lot of the "stupid"
questions that relied on arcane knowledge or were just plain Bad Code
of nasty loops with silly breaks etc.

What got added was a lot of OOP stuff and stream stuff and...

'Course, there's more than just one "test" that they hand out, as I
understand it, so there are variations to it, and I had a very very
very small sample of people who I chatted with.

And none of them know for sure if they passed yet or not, really. :-)

I was busy both times the test was being administered, but would
probably fail anyway on the new features parts.  I'm pretty set in my
ways... :-)

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
On Sun, May 20, 2007 10:14 am, Danial Rahmanzadeh wrote:
> are volcan exams really harder than actual php5 exam as phparch
> asserted?

I'm pretty sure after seeing Star Trek: Voyage Home, that Vulcan exams
are MUCH harder than the PHP 5 exam.

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some indie artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

--- End Message ---
--- Begin Message ---
Am currently running Plesk 8.0.1 . A php script with phpinfo() will give:
...
...
'--with-kerberos' '--with-ldap=shared' '--with-mysql=shared,
...
...

But am not able to locate the LDAP section that normally looks like:

LDAP Support    enabled
RCS Version     $Id: ldap.c,v 1.130.2.11 2005/01/19 00:28:49 bigtoy Exp $
Total Links     0/unlimited
API Version     2004
Vendor Name     OpenLDAP
Vendor Version  20025

As such, when running a script that uses any LDAP functions, I will get error 
msgs like:
Fatal error: Call to undefined function: ldap_connect() ...

Any idea how I can go about solving this issue? Please advise. TIA

--
roger



---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------

--- End Message ---

Reply via email to