OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
php-general Digest 4 Oct 2005 17:30:30 -0000 Issue 3719

php-general-digest-helplists.php.net
Date: Tue Oct 04 2005 - 12:30:30 CDT


php-general Digest 4 Oct 2005 17:30:30 -0000 Issue 3719

Topics (messages 223590 through 223614):

Re: chown function
        223590 by: Jasper Bryant-Greene
        223595 by: Keith Spiller

Re: Handling competing edits in a wiki engine?
        223591 by: Terence
        223596 by: Murray . PlanetThoughtful

Re: PHP and Active Directory
        223592 by: Rory Browne

domit and XML
        223593 by: Erik Barba
        223601 by: Stephen Leaf
        223606 by: Torgny Bjers

Re: array_shift not working?
        223594 by: Rory Browne

Re: hello
        223597 by: andrei.ispi.net

Postgres auto-commit
        223598 by: Skippy
        223600 by: Skippy

Missing pear executable
        223599 by: Reuben D. Budiardja
        223602 by: Reuben D. Budiardja
        223603 by: tg-php.gryffyndevelopment.com

Re: buffer problem having a mind of its own
        223604 by: Jochem Maas

Re: Server Time Out
        223605 by: Dan Baker
        223612 by: cc

PHP5 Webhost
        223607 by: Michael Crute
        223608 by: Greg Donald
        223609 by: Torgny Bjers

PROGRESS SQL_CUR_USE_ODBC
        223610 by: cybermalandro cybermalandro

displaying image from blog
        223611 by: blackwater dev
        223613 by: blackwater dev
        223614 by: blackwater dev

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscribelists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscribelists.php.net

To post to the list, e-mail:
        php-generallists.php.net

----------------------------------------------------------------------

attached mail follows:


Keith Spiller wrote:
> I'm using:
>
> chown("$endpath", "admin");
>
> to try to change the owner of directories after using mkdir()
> to create them. It continues to fail on my remote Fedora server.

With what error message? Have you tried logging in with SSH or similar
and trying the same command?

More than likely the user apache is running as doesn't have permissions
to chown -- in fact I believe that in order to chown files one must be
root (at least that's the way it seems to work on my system).

You could use chmod instead to allow the "admin" user access to your files.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

attached mail follows:


Hi Jasper,

When using my Php script, I don't see any error messages.

I have logged in using SSH, but the directories created are
owned by 48 and not my ftp user and so I have to switch
to a super user to make any changes.

Also, even though I use:
mkdir("$endpath", 0777);
The resulting directories end up as 755.

Yeah I have a feeling that you are right, that apache on
my server does not have chown permissions.

Thank you very mych for your help.

Keith

----- Original Message -----
From: "Jasper Bryant-Greene" <jasperbryant-greene.name>
To: <php-generallists.php.net>
Sent: Monday, October 03, 2005 11:27 PM
Subject: Re: [PHP] chown function

> Keith Spiller wrote:
>> I'm using:
>>
>> chown("$endpath", "admin");
>>
>> to try to change the owner of directories after using mkdir()
>> to create them. It continues to fail on my remote Fedora server.
>
> With what error message? Have you tried logging in with SSH or similar and
> trying the same command?
>
> More than likely the user apache is running as doesn't have permissions to
> chown -- in fact I believe that in order to chown files one must be root
> (at least that's the way it seems to work on my system).
>
> You could use chmod instead to allow the "admin" user access to your
> files.
>
> --
> Jasper Bryant-Greene
> Freelance web developer
> http://jasper.bryant-greene.name/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

attached mail follows:


Murray PlanetThoughtful wrote:
> Hi All,
>
> I've recently been working on building my own wiki engine for my blog
> site. While the majority of the engine is complete, a remaining concern
> I have is how to handle competing edits (ie when two or more people are
> editing the same wiki page simultaneously).
>
> I'm wondering if anyone else on the list has given this some thought?
> How would / do you handle competing edits to the same entry in a wiki
> application?
>

We use a combination of locking the record using a simple boolean column
together with the user id who has locked the item and the timestamp.

The locking prevents another user from opening the form and happily
editing away without realising his changes will be lost when he presses
submit. The user id is to inform the second user who has opened the
document, and the timestemp is so that the first guy doesnt open the
document and go out for lunch leaving it locked. We default it to 5
minutes after which someone else can open the document and edit it.

attached mail follows:


Terence wrote:

>
>
> Murray PlanetThoughtful wrote:
>
>> Hi All,
>>
>> I've recently been working on building my own wiki engine for my blog
>> site. While the majority of the engine is complete, a remaining concern
>> I have is how to handle competing edits (ie when two or more people are
>> editing the same wiki page simultaneously).
>>
>> I'm wondering if anyone else on the list has given this some thought?
>> How would / do you handle competing edits to the same entry in a wiki
>> application?
>>
>
> We use a combination of locking the record using a simple boolean
> column together with the user id who has locked the item and the
> timestamp.
>
> The locking prevents another user from opening the form and happily
> editing away without realising his changes will be lost when he
> presses submit. The user id is to inform the second user who has
> opened the document, and the timestemp is so that the first guy doesnt
> open the document and go out for lunch leaving it locked. We default
> it to 5 minutes after which someone else can open the document and
> edit it.
>
I think I'm going to go with Jasper's suggestion, re: simply
timestamping the current edit from the preceding version and testing
that timestamp against the existence of more recent edits and throwing
back to the user a request to resolve their changes against the now
'current' version.

I had been thinking about a timed locking strategy (5 minutes seems
short, though, for content creation, and what do you currently do when
person A comes back from lunch, person B has made an edit in the same
entry after person A's lock timed out, and person A commits their now
aged edit? Do you basically throw an error anyway, and ask person A to
resolve?), and perhaps implementing a simple javascript countdown on the
page to alert the person editing the page when time for their edit is
running out, but in all honesty I think throwing back the error, and
perhaps presenting a diff of the newer version of the entry, and the
version the user has edited, might be the way to go.

Either way, gives me plenty to think about.

Out of curiosity, does anyone know if it's possible to tell whether an
individual session is still alive from PHP? I don't mean from within
code being run for a particular user, but in code that, for example,
might be executed by a cron job, which would examine a table in which
session ids have been recorded automatically for each visitor, and
determining which of those sessions are still theoretically alive? I
suspect this isn't possible, but I've also learned to never
underestimate the ingenuity of those faced with things that aren't possible.

Much warmth,

Murrray PlanetThoughftul
---
"A man, a canoe, and a dream to climb Mt Everest..."
http://www.planetthoughtful.org

attached mail follows:


Check out the user contributed notes on the manual page - www.php.net/ldap

A few of them refer to Active Directory.

If you installed PHP from source, then you need to install OpenLDAP or
some other ldap package to get the client libraries.

If you installed PHP from packages, then you need to install the
php-ldap package(assuming the functions do not currently work)

If someone else installed PHP, then you need to get them to install
the LDAP extensions to PHP.

On 9/29/05, Miretsky, Anya <anyamiretskybbg.org> wrote:
> Hi,
>
> How do I connect a php script running on linux with Active Directory on
> a windows machine? I would like to have my php script autmotatically
> read email addresses from the AD server. Can this be done? I've found a
> bunch of ldap functions for php but they seem to require ldap to be
> installed on linux. I'm confused. Thanks in advance for your help.
>
>
> Anya
>
>

attached mail follows:


hi im new in the list i dont know where to write the email so i did it here,
i am having a problem
 I have a xml file and im parsing with domit 1.0 but im from mexico, and we
use " "
the xml acept it but when the php show the code in html, i cant see the
letters

attached mail follows:


On Tuesday 04 October 2005 12:42 am, Erik Barba wrote:
> hi im new in the list i dont know where to write the email so i did it
> here, i am having a problem
> I have a xml file and im parsing with domit 1.0 but im from mexico, and we
> use " é í ó ú á ñ "
> the xml acept it but when the php show the code in html, i cant see the
> letters

Some characters are encoded. I've never used domit but I have used php5's DOM.
http://us2.php.net/manual/en/ref.dom.php

To get them back to the characters simple run it through
htmlspecialchars_decode
http://us2.php.net/manual/en/function.htmlspecialchars-decode.php

If your still using PHP4 use this instead.
function htmlspecialchars_decode_PHP4($uSTR)
{
 return strtr($uSTR, array_flip(get_html_translation_table(HTML_ENTITIES,
ENT_QUOTES)));
}

I've not personally tested it but it's found on that page.

attached mail follows:


Erik Barba wrote:

>hi im new in the list i dont know where to write the email so i did it here,
>i am having a problem
> I have a xml file and im parsing with domit 1.0 but im from mexico, and we
>use " "
>the xml acept it but when the php show the code in html, i cant see the
>letters
>
>

Erik,

The easiest way to make sure that all characters are represented
correctly is to specify the UTF-8 codepage on your HTML pages and making
sure that you edit and save your XML documents with an editor that is
capable of handling UTF-8, such as Windows Notepad (W2000 or later I
think) or Editplus from editplus.com, or one of the major editors, such
as Dreamweaver or Visual Studio or Zend Studio.

This ought to fix most problems.

Regards,
Torgny

attached mail follows:


[snip]
> How can i remove the 'count' from the array?

www.php.net/unset

> Regards,
> Frank
>
>

attached mail follows:


Your document is attached.

attached mail follows:


How can I disable auto-commit for a Postgres connection? Apparently
server-side autocommit was thrown out in Postgres 8.0, and clients have to
issue their own setting (which is sensible).

The default is on (which I don't want). psql is apparently able to set or
unset the AUTOCOMMIT option, but I found nothing similar for PHP.

There is no ini setting for it. There is no function for it. Perhaps the
"options" part of the connection string passed to pg_connect() might work, if
I only knew what it's supposed to contain... Can anybody shed some light on
this?

--
Romanian Web Developers - http://ROWD.ORG

attached mail follows:


Quoting Skippy <skippyzuavra.net>:
> How can I disable auto-commit for a Postgres connection? Apparently
> server-side autocommit was thrown out in Postgres 8.0, and clients have to
> issue their own setting (which is sensible).

Apparently this will work (or at least it will be accepted by pg_connect):

$conn = pg_connect("dbname=test host=localhost user=postgres options='-c
AUTOCOMMIT=true'");

Warning: it fails if you use values other than those that will set it to true
(true, on, 1). Apparently you can't use false, off, 0. But I've noticed you
can leave the value empty:

$conn = pg_connect("dbname=test host=localhost user=postgres options='-c
AUTOCOMMIT='");

Hopefully, this has the "off" effect. Will have to test more.

--
Romanian Web Developers - http://ROWD.ORG

attached mail follows:


Hello,
I've been installing php-4.4.0 and php-5.0.5, and it both cases I can't find
the "pear" executable in the install directory. For instance:
# ls /usr/local/php-5.0.5/bin/
php php-config phpize

IIRC, pear executable (ie. the package manager) used to be bundled with PHP.
In fact, I think a while a go I compiled from the daily snapshot and I got
the pear executable. My configure options have not changed since then (look
below). Any help ?

Thank you
Reuben D. B.

-- here is my configure line:

./configure \
--prefix=/usr/local/php-5.0.5 \
--with-config-file-path=/etc \
--with-config-file-scan-dir=/etc/php.d \
--enable-force-cgi-redirect \
--disable-debug --enable-pic \
--disable-rpath --enable-inline-optimization \
--with-bz2 \
--with-db4=/usr \
--with-curl \
--with-exec-dir=/usr/bin \
--with-freetype-dir=/usr \
--with-png-dir=/usr \
--with-gd=shared \
--enable-gd-native-ttf \
--without-gdbm \
--with-gettext \
--with-ncurses=shared \
--with-gmp \
--with-iconv \
--with-jpeg-dir=/usr \
--with-openssl \
--with-png \
--with-xml \
--with-expat-dir=/usr \
--with-dom=shared,/usr \
--with-dom-xslt=/usr \
--with-dom-exslt=/usr \
--with-xmlrpc=shared \
--with-pcre-regex=/usr \
--with-zlib \
--with-layout=GNU \
--enable-bcmath \
--enable-exif \
--enable-ftp \
--enable-magic-quotes \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-track-vars \
--enable-trans-sid \
--enable-yp \
--enable-wddx \
--with-pear=/usr/share/pear \
--with-kerberos \
--with-ldap=shared \
--with-pgsql=/usr/local/postgresql-7.4.8 \
--enable-ucd-snmp-hack \
--enable-memory-limit \
--enable-shmop \
--enable-calendar \
--enable-dbx \
--enable-dio \
--enable-mbstring=shared \
--enable-mbstr-enc-trans \
--enable-mbregex \
--with-mime-magic=/usr/share/file/magic.mime \
--with-apxs2=/usr/sbin/apxs \
--with-oci8-instant-client=/usr/local/oracle/instantclient_10_2 \
--enable-soap

attached mail follows:


tg-phpgryffyndevelopment.com wrote:

>Admittedly I've only dealt with PEAR a little bit, but the two times I installed it, it didn't seem to involve any 'executable'. PEAR appears to be totally PHP script based.
>
>I dont mean to give an "RTFM" type response here, but if you follow the instructions at the PEAR installation page, it should work fine no matter what OS you're running:
>
>http://pear.php.net/manual/en/installation.php
>
>
>
Hello,
What I meant by the "pear executable" is actually a shell based (which
then run php) script that acts as the pear "frontend / package manager".
Thanks for the link and summary on how to install that manually, but I
was just curious why it wasn't built automatically when I 'make install'
php, since as I mentioned, IIRC previous version of PHP gives you this.

Thanks.
RDB

attached mail follows:


I believe you're right, they used to include it with PHP. I believe the PEAR docs even say something about it being included. Maybe they don't anymore so you have to go to the PEAR site to get the latest installer. That way they don't get people using an older installer/package manager that may not be the latest update. *shrug*

Either way, the info I sent earlier should get you up and running in no time.

Good luck!

-TG

= = = Original message = = =

tg-phpgryffyndevelopment.com wrote:

>Admittedly I've only dealt with PEAR a little bit, but the two times I installed it, it didn't seem to involve any 'executable'. PEAR appears to be totally PHP script based.
>
>I dont mean to give an "RTFM" type response here, but if you follow the instructions at the PEAR installation page, it should work fine no matter what OS you're running:
>
>http://pear.php.net/manual/en/installation.php
>
>
>
Hello,
What I meant by the "pear executable" is actually a shell based (which
then run php) script that acts as the pear "frontend / package manager".
Thanks for the link and summary on how to install that manually, but I
was just curious why it wasn't built automatically when I 'make install'
php, since as I mentioned, IIRC previous version of PHP gives you this.

Thanks.
RDB

___________________________________________________________
Sent by ePrompter, the premier email notification software.
Free download at http://www.ePrompter.com.

attached mail follows:


could you imagine that somebody who has never seen your code,
has no idea how it is put together or even what platform it
requires (php4/php5?) might not have clue what your on about?

matt VanDeWalle wrote:
> hello again
> I was writing and rewriting my user function for my chat server trying
> to crush this bug but its beyond me whats going on. basically I have it
> so if a new user comes on, we know that if they type "new" at the prompt
> so it goes to the newuser function, asks for a username, accepts that
> alright, but when I ask for a password(echoed or not), even if i ask for
> anything else, just the second input of the function, it skips right
> threw that, prompts for it but apparently the buffer still has a \n in
> it so it is assuming that is the password and going right onto the 3rd
> signup prompt, i could stick with the default password being a random
> number and avoiding this whole problem, but i actually don't, the buffer
> is still full of whatever, and would ask the 3rd prompt but just drop
> right threw,
>
> I turned on implicit_flush in php.ini, just as a second measure, I call
> ob_implicit_flush() after reading from the socket each time, but the
> '\n' or whatever mysterious character, still seems to be there, also, I
> know too because before i started working on redoing the logon function,
> i would log on and i would automatically have a character sent but i
> didn't type anything so something is really screwy or am I just not
> clearing the buffers the right way?
> oh yes, as you may have assumed from what I wrote, or may not have,
> after the password or otherwise 2nd prompt, things work as expected with
> the other prompts,
> if this helps, I am using php 4.3.10 in command line interface
>

attached mail follows:


"Kevin Cloutier" <kcloutiemathworks.com> wrote in message
news:19.C5.54476.9A13D334pb1.pair.com...
> Hi,
>
> I'm new to this newsgroup and I'm psyched I found it. But, my newsreader
> (Thunderbird), keeps returning a "Connection to server news.php... has
> timed out" when ever I try to dload or refresh the messages.
>
> Anyone have a suggestions on what I can do? I'm assuming it's just a
> setting I need to change?

I use "gmane.comp.php.general" to access the lists. They require a valid
email address, but I haven't had any spam into this special email address I
created.

See: http://gmane.org/

DanB

attached mail follows:


did u set up a firewall?
maybe you want change the rule to let packets from port 119 go through.
or try add a new news account.

Good luck!

On 10/5/05, Dan Baker <dbefcfuriousgames.com> wrote:
> "Kevin Cloutier" <kcloutiemathworks.com> wrote in message
> news:19.C5.54476.9A13D334pb1.pair.com...
> > Hi,
> >
> > I'm new to this newsgroup and I'm psyched I found it. But, my newsreader
> > (Thunderbird), keeps returning a "Connection to server news.php... has
> > timed out" when ever I try to dload or refresh the messages.
> >
> > Anyone have a suggestions on what I can do? I'm assuming it's just a
> > setting I need to change?
>
> I use "gmane.comp.php.general" to access the lists. They require a valid
> email address, but I haven't had any spam into this special email address I
>
> created.
>
> See: http://gmane.org/
>
> DanB
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

attached mail follows:


Hi All,

I am in the process of looking for a webhost for the company I work
for. I must have PHP5 support as the CMS I am using only supports
PHP5. Does anyone know of any good quality hosts that also support
PHP5 and MySQL for less than $40/mo? Dedicated hosting is right out as
we obviously don't have the budget for that. Any thoughts/suggestions
would be very much appreciated. Thanks.

-Mike

--
________________________________
Michael E. Crute
Software Developer
SoftGroup Development Corporation

Linux, because reboots are for installing hardware.
"In a world without walls and fences, who needs windows and gates?"

attached mail follows:


On 10/4/05, Michael Crute <mcrutegmail.com> wrote:
> I am in the process of looking for a webhost for the company I work
> for. I must have PHP5 support as the CMS I am using only supports
> PHP5. Does anyone know of any good quality hosts that also support
> PHP5 and MySQL for less than $40/mo? Dedicated hosting is right out as
> we obviously don't have the budget for that. Any thoughts/suggestions
> would be very much appreciated. Thanks.

http://www.ocssolutions.com/

--
Greg Donald
Zend Certified Engineer
MySQL Core Certification
http://destiney.com/

attached mail follows:


Michael Crute wrote:

>Hi All,
>
>I am in the process of looking for a webhost for the company I work
>for. I must have PHP5 support as the CMS I am using only supports
>PHP5. Does anyone know of any good quality hosts that also support
>PHP5 and MySQL for less than $40/mo? Dedicated hosting is right out as
>we obviously don't have the budget for that. Any thoughts/suggestions
>would be very much appreciated. Thanks.
>
>

If Greg Donald can do it, so can I:
[shameless plug]
http://mu-host.com
[/shameless plug]

attached mail follows:


I am connecting to a PROGRESS DB through the MERANT ODBC driver, When I have
the 4th parameter SQL_CUR_USE_ODBC as shown, my queries return nothing but
if I have the 4th parameter as lower case it returns my query results but
with a PHP error complainning
*Notice*: Use of undefined constant sql_cur_use_odbc - assumed
'sql_cur_use_odbc'

Wtf? I don't get it, most of the documentation from people connecting to
PROGRESS do have the 4th parameter uppercase can someone help me out ?

Thanks!

attached mail follows:


I am querying a MSSQL db where an jpg image is stored as a blog.

I have this code:

<html>
<head>
<meta http-equiv="Content-Type" content="image/jpg">
</head>
<body>
<?
//Do the query
include_once("../includes.list.php");
  $ms_sql= new ms_db();
  $my_sql=new Database();
  $query="select photo from cars where id=22";
  $data=$ms_sql->query($query);
   while($obj = $ms_sql->objects('',$data)){
    echo $obj->photo;
   }
$data=$ms_sql->disconnect();
?>
</body>
</html>

But when viewed I just get all the junk code:

!1AQaq"2B'¡±Á #3RðbrÑ
$4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š'""•–—˜™š¢£¤¥¦§¨(c)ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øù

What is wrong?

Thanks!

attached mail follows:


Sorry, meant BLOB, not blog.

On 10/4/05, blackwater dev <blackwaterdevgmail.com> wrote:
> I am querying a MSSQL db where an jpg image is stored as a blog.
>
> I have this code:
>
> <html>
> <head>
> <meta http-equiv="Content-Type" content="image/jpg">
> </head>
> <body>
> <?
> //Do the query
> include_once("../includes.list.php");
> $ms_sql= new ms_db();
> $my_sql=new Database();
> $query="select photo from cars where id=22";
> $data=$ms_sql->query($query);
> while($obj = $ms_sql->objects('',$data)){
> echo $obj->photo;
> }
> $data=$ms_sql->disconnect();
> ?>
> </body>
> </html>
>
> But when viewed I just get all the junk code:
>
> !1AQaq"2B'¡±Á #3RðbrÑ
> $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š'""•–—˜™š¢£¤¥¦§¨(c)ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øù
>
> What is wrong?
>
> Thanks!
>

attached mail follows:


It doesn't appear that gd is installed by my host as that function
throws undefined function errors and I don't see gd when I do
phpinfo();

On 10/4/05, Michael Crute <mcrutegmail.com> wrote:
> On 10/4/05, blackwater dev <blackwaterdevgmail.com> wrote:
> > I am querying a MSSQL db where an jpg image is stored as a blog.
> >
> > I have this code:
> >
> > <html>
> > <head>
> > <meta http-equiv="Content-Type" content="image/jpg">
> > </head>
> > <body>
> > <?
> > //Do the query
> > include_once("../includes.list.php");
> > $ms_sql= new ms_db();
> > $my_sql=new Database();
> > $query="select photo from cars where id=22";
> > $data=$ms_sql->query($query);
> > while($obj = $ms_sql->objects('',$data)){
> > echo $obj->photo;
> > }
> > $data=$ms_sql->disconnect();
> > ?>
> > </body>
> > </html>
> >
> > But when viewed I just get all the junk code:
> >
> > !1AQaq"2B'¡±Á #3RðbrÑ
> > $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š'""•–—˜™š¢£¤¥¦§¨(c)ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖרÙÚâãäåæçèéêòóôõö÷øù
> >
> > What is wrong?
> >
> > Thanks!
> >
>
> Try passing the output from the BLOB into imagecreatefromstring (a GD
> function) and going that way.
>
> http://us2.php.net/manual/en/function.imagecreatefromstring.php
>
> -Mike
>
> --
> ________________________________
> Michael E. Crute
> Software Developer
> SoftGroup Development Corporation
>
> Linux, because reboots are for installing hardware.
> "In a world without walls and fences, who needs windows and gates?"
>