php-general Digest 20 Sep 2006 06:35:02 -0000 Issue 4357

Topics (messages 241950 through 241964):

Resource problem affecting Curl functions
        241950 by: Mark Krenz
        241964 by: Google Kreme

Re: Frustrated trying to get help from your site
        241951 by: Jürgen Wind

Magic method __set won't be called for protected variables
        241952 by: Satyam

Re: Problem with loadXML(), createProcessingInstruction()
        241953 by: Chris Boget

[Solved] Re: [PHP] DOM: Problem with loadXML(), createProcessingInstruction()
        241954 by: Chris Boget

Re: how to get page count when uploading files
        241955 by: Richard Lynch
        241957 by: Børge Holen

Re: chown(), chgrp()
        241956 by: Rahul S. Johari
        241960 by: Børge Holen

Re: FTP Copy
        241958 by: Chris

preg_replace (again)
        241959 by: Peter Lauri

Re: preg_replace (again) [solved]
        241961 by: Peter Lauri

Latest PHP distribution?
        241962 by: Willem Herbst
        241963 by: Chris

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 ---
  I run a shared webserver with a few hundred vhost containers in
Apache's config.  Recently I got to a point where I added enough vhosts
to cause a problem with curl functions in PHP.  Basically, when PHP
tries to make the curl call to get the webpage, it just hangs the HTTP
request to my webserver.  If I remove a few vhost containers, the
problem stops, if I add them back, the problem starts again.

  I've tried turning up several ulimit values in the apache init script,
but none of those fixed the problem.  I know that its not a problem with
the number of file handles that apache can open because I also had to do

ulimit -n 32768

in the apache init script recently in order to allow more logfiles to be
opened.

  Anyone have any ideas as to what might be causing the curl problem?


This is running on:

Apache 2.0.51
PHP 4.3.10
Linux 2.6.13


/proc/sys/fs/file-max is set to 524288

lsof | wc -l  returns 33497 


Thanks,

Mark

ps. I am well aware that I need to upgrade my software so there is no
need to tell me to do that. I'm working on it.

--- End Message ---
--- Begin Message ---
On 19 Sep 2006, at 12:12 , Mark Krenz wrote:
  I run a shared webserver with a few hundred vhost containers in
Apache's config.

Are these vhosts all contained in httpd.conf, or are they separate files?

Does it make a difference?

--
...when you're no longer searching for beauty or love, just some kind of life with the edges taken off. When you can't even define what it is that you're frightened of; this song will be here.
--- End Message ---
--- Begin Message ---


Jon Anderson wrote:
> 
> Jay Blanchard wrote:
>> So let me send a rant to other users, in fact a general list of users,
>> because I cannot read. If I could I would know that I subscribed to a
>> list where questions are asked to other users rather than me trying to
>> send an e-mail to the president of PHP (a hat worn proudly). The entire
>> sire is documentation and anywhere from one to five minutes of even the
>> lightest reason would have spelled that out, not to mention that the
>> second link across the top of the page says in very vague terms,
>> 'documentation'. Is this a run on paragraph? I am asking because English
>> is incredibly frustrating and difficult to use.
>>
>> Department of Technology indeed.
>>   
> As an aside, I think that the online and offline (downloadable) PHP 
> documentation is probably the clearest, best organized and complete set 
> of documentation for any programming language I've run into online.
> 
> I honestly think that the PHP coders/documentors deserve a lot of 
> gratitude for the immense effort that must have gone into documenting 
> the immense list of built-in stuff that PHP has.
> 
> jon
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 
> 
FULL ACK!
-- 
View this message in context: 
http://www.nabble.com/Frustrated-trying-to-get-help-from-your-site-tf2292725.html#a6394118
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message --- I have a series of properties set as protected in my class which I meant to have them accessed externally through __set and __get. Unfortunately, it seems that since the properties do exist, the magic methods don't get called, but then I get an error "Cannot access protected property xxxxx", which I didn't meant to access directly, that's what I put the __set and __get magic methods there.

There is no problem if the variable has another name than the external property, if I use $obj->something and the variable is declared protected $_something, the magic methods are called, but then I have different 'external' names than the 'internal' ones, something which I wanted to avoid.

Since I want to have them with the same name, I might declare the variables public, but I wanted to use the magic methods to validate the values assigned to these variables.

Any ideas?

Thanks

Satyam

--- End Message ---
--- Begin Message --- Apparently, loadXML() overwrites the existing structure of the document when called. The problem is that when I try to add a PI (namely a stylesheet), it adds it to the end of the document thus making so that the XML is not transformed by the client.

To get around this, I thought I could just import my XML string into a DOMNode, but I do not see any method for that class analogous to the loadXML(). I looked at the possiblity of adding children to the document at specific positions (such that I could add the PI as the first child) but I do not see a DOMDocument method that allows it. appendChild() merely adds the child to the end of the document.

Has anyone found a workaround for this; a workaround the fact that loadXML() completely replaces the existing document structure?

thnx,
Chris
--- End Message ---
--- Begin Message ---
Has anyone found a workaround for this; a workaround the fact that loadXML() completely replaces the existing document structure?

It's amazing what you find out after you've already made yourself look foolish.

$xmlStr = '<root><child_element>blah</child_element></root>';

$doc = new DOMDocument( '1.0', 'UTF-8' );
$docFragment = $doc->createDocumentFragment();
$docFragment->appendXML( $xmlStr ); // Why this isn't called also loadXML()
// I have no idea. It would make sense // that it would be so as to maintain // consistency in names of methods // where it relates to functionality, // particularly when that functionality is // similar across classes.
$doc->appendChild( $doc->createProcessingInstruction( 'blah', 'blah' );
$doc->appendChild( $docFragment );
echo $doc->saveXML();
--- End Message ---
--- Begin Message ---
On Mon, September 18, 2006 3:18 pm, Børge Holen wrote:
> Would php at all take precaution of the px size of the letters, if any
> of the
> above issues were to be resolved? That would be at document level for
> starters, and probably should be resolved in the first place?

The RTF parser may or may not attempt to account for font sizes...

You're kind of asking a question like:

Does the hammer take account of the size of the nail?

Well, yeah, sort of, if you have the right hammer to match up with the
nail you are trying to use...

PHP is a general programming language, a hardware store full of
hammers, not a specific hammer, and does not directly address fontsize
in a Word document in and of itself.

Individual RTF parsers or Word document handling software might, and
might be written in PHP.  Or they might be written in some other
language, and you could use PHP to run those programs to figure out
the page count within the documents and report that back to PHP.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On Tuesday 19 September 2006 18:22, Richard Lynch wrote:
> On Mon, September 18, 2006 3:18 pm, Børge Holen wrote:
> > Would php at all take precaution of the px size of the letters, if any
> > of the
> > above issues were to be resolved? That would be at document level for
> > starters, and probably should be resolved in the first place?
>
> The RTF parser may or may not attempt to account for font sizes...
>
> You're kind of asking a question like:
>
> Does the hammer take account of the size of the nail?
>
> Well, yeah, sort of, if you have the right hammer to match up with the
> nail you are trying to use...
>
> PHP is a general programming language, a hardware store full of
> hammers, not a specific hammer, and does not directly address fontsize
> in a Word document in and of itself.
>
> Individual RTF parsers or Word document handling software might, and
> might be written in PHP.  Or they might be written in some other
> language, and you could use PHP to run those programs to figure out
> the page count within the documents and report that back to PHP.

Yes, it was more of a comment to ther previous comments here rather than a 
factual question for my part, but then again you never know.

Nice comparison btw 

>
> --
> Like Music?
> http://l-i-e.com/artists.htm

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---
Ok, my code follows. Basically I'm printing ...
my Owner/Group, the existing Owner/Group of the file, the Owner/Group of the
file After trying to change it.

The most interesting thing is... I get absolutely no errors, no warnings,
and everything prints out as if everything worked... Except that its' not
actually changing anything at all!!

The fact that it's not changing anything is a secondary issue... What
surprises me is that chown,chgrp or chmod doesn't give any error or warning
for the fact that it's not doing anything. Except the is_writeable() which
actually prints "Is not writeable".... The if(chown) etcetera continue
printing as if they changed the Owner/Group/Perms.... Even though they
didn't.

code: 

        if (!is_writable("/home/folder/documents/path/osmd.dbf")) {
                echo "Is not writeable<BR><BR>";
        }

        $fileowneruidb=fileowner("/home/folder/documents/path/osmd.dbf");
        echo $fileowneruidb;
        $fileownerarrayb=posix_getpwuid($fileowneruidb);
        $fileownerb=$fileownerarrayb['name'];
        echo "<BR>Owner is $fileownerb<BR><BR>";
        
        echo "My owner :".getmyuid()."<BR>";
        if(chown("/home/folder/documents/path/osmd.dbf", getmyuid())) {
        $fileowneruida=fileowner("/home/folder/documents/path/osmd.dbf");
        echo $fileowneruida;
        $fileownerarraya=posix_getpwuid($fileowneruida);
        $fileownera=$fileownerarraya['name'];
        echo "<BR>Owner changed to $fileownera<BR><BR>";
        }
        
        $filegrpb=filegroup("/home/folder/documents/path/osmd.dbf");
        echo $filegrpb;
        $filegrparrayb=posix_getgrgid($filegrpb);
        $filegrpb=$filegrparrayb['name'];
        echo "<BR>Group is $filegrpb<BR><BR>";
        
        echo "My owner :".getmygid()."<BR>";
        if(chgrp("/home/folder/documents/path/osmd.dbf", getmygid())) {
        $filegrpa=filegroup("/home/folder/documents/path/osmd.dbf");
        echo $filegrpa;
        $filegrparraya=posix_getgrgid($filegrpa);
        $filegrpa=$filegrparraya['name'];
        echo "<BR>Group changed to $filegrpa<BR><BR>";
         }
        
        if (chmod("/home/folder/documents/path/osmd.dbf", 0755)) {
                echo "Mode changed to 0755<BR><BR>";
        }    



On 9/19/06 12:09 PM, "Steve Edberg" <[EMAIL PROTECTED]> wrote:

> fileperms() perhaps?
> 
> http://php.he.net/manual/en/function.fileperms.php
> 
> You'd have to compare the return value against the uid/gid the
> webserver runs as, which can be obtained via getmyuid()/getmygid():
> 
> http://php.he.net/manual/en/function.getmyuid.php
> 
> Alternatively, you could check if the file exists, then attempt to
> chown/chgrp it. If the chown()/chgrp() returns false, you probably
> don't have permission.
> 
> steve

--- End Message ---
--- Begin Message ---
On Tuesday 19 September 2006 22:22, Rahul S. Johari wrote:
> Ok, my code follows. Basically I'm printing ...
> my Owner/Group, the existing Owner/Group of the file, the Owner/Group of
> the file After trying to change it.

Does apache have write access to write to yer file, that goes for either o+r 
or that group or user is apache.

>
> The most interesting thing is... I get absolutely no errors, no warnings,
> and everything prints out as if everything worked... Except that its' not
> actually changing anything at all!!
>
> The fact that it's not changing anything is a secondary issue... What
> surprises me is that chown,chgrp or chmod doesn't give any error or warning
> for the fact that it's not doing anything. Except the is_writeable() which
> actually prints "Is not writeable".... The if(chown) etcetera continue
> printing as if they changed the Owner/Group/Perms.... Even though they
> didn't.
>
> code:
>
>         if (!is_writable("/home/folder/documents/path/osmd.dbf")) {
>                 echo "Is not writeable<BR><BR>";
>         }
>
>         $fileowneruidb=fileowner("/home/folder/documents/path/osmd.dbf");
>         echo $fileowneruidb;
>         $fileownerarrayb=posix_getpwuid($fileowneruidb);
>         $fileownerb=$fileownerarrayb['name'];
>         echo "<BR>Owner is $fileownerb<BR><BR>";
>
>         echo "My owner :".getmyuid()."<BR>";
>         if(chown("/home/folder/documents/path/osmd.dbf", getmyuid())) {
>         $fileowneruida=fileowner("/home/folder/documents/path/osmd.dbf");
>         echo $fileowneruida;
>         $fileownerarraya=posix_getpwuid($fileowneruida);
>         $fileownera=$fileownerarraya['name'];
>         echo "<BR>Owner changed to $fileownera<BR><BR>";
>         }
>
>         $filegrpb=filegroup("/home/folder/documents/path/osmd.dbf");
>         echo $filegrpb;
>         $filegrparrayb=posix_getgrgid($filegrpb);
>         $filegrpb=$filegrparrayb['name'];
>         echo "<BR>Group is $filegrpb<BR><BR>";
>
>         echo "My owner :".getmygid()."<BR>";
>         if(chgrp("/home/folder/documents/path/osmd.dbf", getmygid())) {
>         $filegrpa=filegroup("/home/folder/documents/path/osmd.dbf");
>         echo $filegrpa;
>         $filegrparraya=posix_getgrgid($filegrpa);
>         $filegrpa=$filegrparraya['name'];
>         echo "<BR>Group changed to $filegrpa<BR><BR>";
>          }
>
>         if (chmod("/home/folder/documents/path/osmd.dbf", 0755)) {
>                 echo "Mode changed to 0755<BR><BR>";
>         }
>
> On 9/19/06 12:09 PM, "Steve Edberg" <[EMAIL PROTECTED]> wrote:
> > fileperms() perhaps?
> >
> > http://php.he.net/manual/en/function.fileperms.php
> >
> > You'd have to compare the return value against the uid/gid the
> > webserver runs as, which can be obtained via getmyuid()/getmygid():
> >
> > http://php.he.net/manual/en/function.getmyuid.php
> >
> > Alternatively, you could check if the file exists, then attempt to
> > chown/chgrp it. If the chown()/chgrp() returns false, you probably
> > don't have permission.
> >
> > steve

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--- End Message ---
--- Begin Message ---
Matt Palermo wrote:
I've been looking on php.net, but can't find anything that covers this... Basically, I am using PHP FTP to connect to an FTP server and run some functions. I want to copy a directory on the FTP server to another directory on the FTP server. Since there isn't an ftp_copy() function, I have to use ftp_get() to bring the file to the local webserver temp folder, then use ftp_put() to place it into a different folder on the FTP server. This is quite a big pain, since the webserver is not on the same network as the remote FTP server, so it must download the file and then upload it to a different place (takes a long time). Is there an FTP that will just copy the file/folder from the FTP server without the need to download/upload it somewhere else?

You can't do this through ftp itself so I think you're out of luck.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Hi group,

 

I know I am a little bit stupid when it comes to actually figuring out how
to use the preg_match and preg_replace. This is what I am facing:

 

A string like this: This is some _color:pink_ colored text _color_ that I
want to transfer

 

Should convert to: This is some <font color="pink">colored text</font> that
I want to transfer

 

Anyone who see a simple solution to this? Right now I have created an ugly
script that do the same thing, but I want to start to learn and use
preg_match.

 

Thanks.

 

/Peter

 

www.lauri.se <http://www.lauri.se/>  - Personal web site

www.dwsasia.com <http://www.dwsasia.com/>  - Company web site 

 

 

 


--- End Message ---
--- Begin Message ---
Just to share my solution:

preg_replace('/_color:(.*?)_(.*?)_color_/i', '<font color="$1">$2</font>',
$html);

/Peter

-----Original Message-----
From: Peter Lauri [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 20, 2006 9:42 AM
To: 'PHP General'
Subject: [PHP] preg_replace (again)

Hi group,

 

I know I am a little bit stupid when it comes to actually figuring out how
to use the preg_match and preg_replace. This is what I am facing:

 

A string like this: This is some _color:pink_ colored text _color_ that I
want to transfer

 

Should convert to: This is some <font color="pink">colored text</font> that
I want to transfer

 

Anyone who see a simple solution to this? Right now I have created an ugly
script that do the same thing, but I want to start to learn and use
preg_match.

 

Thanks.

 

/Peter

 

www.lauri.se <http://www.lauri.se/>  - Personal web site

www.dwsasia.com <http://www.dwsasia.com/>  - Company web site 

 

 

 

--- End Message ---
--- Begin Message ---
I have PHP 4.4 installed running on a Open SUSE 10 box, can someone
please tell me where I find the latest version for OPEN SUSE?

--- End Message ---
--- Begin Message ---
Willem Herbst wrote:
I have PHP 4.4 installed running on a Open SUSE 10 box, can someone
please tell me where I find the latest version for OPEN SUSE?

http://www.php.net/

Or do you mean rpms (or whatever opensuse uses)? STW?

Better off asking your opensuse mailing list, php.net doesn't build any distributions rpms or packages, that's up to the distributions themselves.

--
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---

Reply via email to