Re: [PHP] kadm5 Library

2009-02-05 Thread Tim Gustafson
 Did you try to install krb5-devel. Try yum search krb5 to
 see all the available packages that CentOS includes. In
 case your yum doesn't find something you may add more
 repos like Dag's:

I did.  The krb5-devel package is the one that installed krb5/krb5.h, but as I 
mentioned that seems to be a different version than the one that the PECL 
library expects.  I've used Dag's repository before, but as you pointed out, it 
doesn't contain this package.

 What you need is to find a kerberos rpm to include development
 header in order to compile it your self.

I thought about grabbing the header from another OS, but I'm concerned about 
incompatibilities.  For now, I'm just using the expect library and running 
kadmin.local via sudo as needed.  It's clunky, but it's working.  :)

Thanks for all your help!

Tim Gustafson
BSOE Webmaster
UC Santa Cruz
t...@soe.ucsc.edu
831-459-5354

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



Re: [PHP] kadm5 Library

2009-01-30 Thread Tim Gustafson
Sorry, I could have been a little clearer:

I can't recompile PHP.  It's against our general policy to use custom compiled 
software on the grounds that there are too many sysadmins managing a lot of 
these machines and if some software is custom compiled and others not, it gets 
too confusing when it comes to keeping the machines updated and patched.  We're 
talking a dozen sysadmins and hundreds of machines here.  :)

I did try to compile the PECL library by specifying the path to the Kerberos 
libraries as you suggested, but it turns out that the normal version of 
Kerberos seems to have, among other things, a krb5/admin.h header file, and 
the one that comes with CentOS has krb5/krb5.h instead, and even when I 
change the source code to use krb5/krb5.h, it still throws about 50 errors 
talking about missing functions and re-defined functions and so on.

I'm thinking that the problem is that the PECL module was designed to work with 
one version of the Kerberos library and CentOS provides a different version.  I 
guess I was really asking if anyone had any diffs or anything I could apply to 
the PECL module to make it compile on a CentOS machine.  Or perhaps is there a 
Yum repository somewhere that I could use to get a version of the PECL module 
precompiled for CentOS?

I should point out that the Perl Kerberos module did install and compile 
successfully on this machine, so I'm fairly sure that Kerberos is itself 
working.

Tim Gustafson
BSOE Webmaster
UC Santa Cruz
t...@soe.ucsc.edu
831-459-5354

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



[PHP] kadm5 Library

2009-01-29 Thread Tim Gustafson
Hi,

I'm running PHP on a CentOS 5.2 box and I'd like to get the kadm5 library to 
work.  The documentation says that the package is both included by default and 
also available as a PECL module.  The functions are not available in my base 
install (I'm using the PHP package from the CentOS repository).  When I do a 
phpinfo() I do see that --with-kerberos was specified at compile time, but 
--with-kadm5 was not, so I'm not sure if that was a typo on the part of the 
person who did the compilation or if there is something else that 
--with-kerberos does.

Anyhow, I can't seem to get the PECL version to compile.  I have the 
krb5-devel Yum package installed, but it always breaks with an error message 
that says:

checking for kadm5 files in default path... not found
configure: error: Please reinstall the kadm5 distribution
ERROR: `/tmp/tmp7fT8eC/kadm5-0.2.3/configure' failed

It appears to be looking for krb5/admin.h which doesn't exist on CentOS even 
with the krb5-devel.  Instead, CentOS seems to have a krb5/krb5.h which 
does contain some valid Kerberos headers, but when I modify the PECL library to 
use that file instead of admin.h, I do get a bit further but then get two or 
three screens full of error: 'KRB5_KDB_DISALLOW_TGT_BASED' undeclared type 
errors.

So, I guess my question is has anyone had any luck getting this library to 
compile and function on CentOS 5.2?  Can anyone point me in the right direction 
as far as getting this library to work?

Thanks for your help!

Tim Gustafson
BSOE Webmaster
UC Santa Cruz
t...@soe.ucsc.edu
831-459-5354


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



RE: [PHP] Using DOM textContent Property

2008-09-10 Thread Tim Gustafson
Nathan,

Thanks for your help on this.

I actually need to do this a different way I think though.  The problem is
that I'm not just replacing a text entity with a link entity.  For example,
consider this paragraph:

pFor information, please contact [EMAIL PROTECTED]/p

In this case, I want [EMAIL PROTECTED] to be a link, but not the rest of
the paragraph.  That means that the p entity has to be split into three
separate entities - one DOMText for For information, please contact , one
DOMEntity node for [EMAIL PROTECTED], and one DOMText node for ..

This seems doable with the DOM modle, but complicated.  I'm thinking regular
expressions might be the way to go again.  :\

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354


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



RE: [PHP] Using DOM textContent Property

2008-09-05 Thread Tim Gustafson
Nathan,
 
Thanks for the suggestion, but it's still not working for me.  Here's my
code:

=== 
$HTML = new DOMDocument();
@$HTML-loadHTML($text);
$Elements = $HTML-getElementsByTagName(*);

for ($X = 0; $X  $Elements-length; $X++) {
  $Element =  $Elements-item($X);

  if ($Element-tagName == a) {
# SNIP - Do something with A tags here
  } else if ($Element instanceof DOMText) {
echo $Element-nodeValue; exit;
  }
}
=== 

This loop never executes the instanceof part of the code.  If I add:

  } else if ($Element instanceof DOMNode) {
echo foo!; exit;
  }

Then it echos foo! as expected.  It just seems that none of the nodes in
the tree are DOMText nodes.  In fact, get_class($Element) returns
DOMElement for every node in the tree.

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354



 




From: Nathan Nobbe [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 03, 2008 11:55 AM
To: Tim Gustafson
Cc: [EMAIL PROTECTED]; php-general@lists.php.net
Subject: Re: [PHP] Using DOM textContent Property


On Wed, Sep 3, 2008 at 10:03 AM, Tim Gustafson [EMAIL PROTECTED]
wrote:


 I think you might be better off using regexp on the text
 *before* sending it through the DOM parser. Send the
 user's text through a function that searches for URLs
 and email addresses, creating proper links as they're
 found, then use the output from that to move on to your
 DOM stuff. That way, you need not create new nodes in
 your nodelist.


I think that's the way I'm going to have to go, but I was
really hoping not
to.  Thanks for the suggestion!


i think i have what youre looking for Tim, take a look at this
script output

[EMAIL PROTECTED] ~ $ php testDom.php 
IN:
?xml version=1.0 standalone=yes?
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
http://www.w3.org/TR/REC-html40/loose.dtd;
htmlbodyTestbr/h2[EMAIL PROTECTED]a name=barstuff
inside the link/aFoo/h2pcare/ppyoyser/p/body/html

OUT: 
?xml version=1.0 standalone=yes?
!DOCTYPE html PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
http://www.w3.org/TR/REC-html40/loose.dtd;
htmlbodyTestbr/h2a
href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/aa
name=barstuff inside the
link/aFoo/h2pcare/ppyoyser/p/body/html

and heres the code using the DOM extension
you may have to tweak it to suit your needs, but currently i think
it does the trick ;)

?php
$doc = new DOMDocument();
$doc-loadHTML('htmlbodyTestbrh2[EMAIL PROTECTED]a
name=barstuff inside the
link/aFoo/h2pcare/ppyoyser/p/body/html');
echo 'IN:' . PHP_EOL . $doc-saveXML() . PHP_EOL;
findTextNodes($doc-getElementsByTagName('*'),
'convertToLinkIfNecc');
echo 'OUT: ' .  PHP_EOL . $doc-saveXML() . PHP_EOL;

/**
 * run through a DOMNodeList, looking for text nodes.  apply a
callback to
 * all such text nodes that are encountered
 */
function  findTextNodes(DOMNodeList $nodesToSearch, $callback) {
foreach($nodesToSearch as $curNode) {
if($curNode-hasChildNodes())
foreach($curNode-childNodes as $curChild)
if($curChild instanceof DOMText)
#echo TEXT NODE FOUND:  . $curChild-nodeValue
. PHP_EOL;
/// todo: allow use of hook here
call_user_func($callback, $curNode, $curChild);
}
}

/**
 * determine if a node should be modified, by chcking to see if a
child is a text node
 * and the text looks like an email address.
 * call a subordinate function to convert the text node into a
mailto anchor DOMElement
 */
function convertToLinkIfNecc(DomElement $textContainer, DOMText
$textNode) {
if( (strtolower($textContainer-nodeName) != 'a') 
(filter_var($textNode-nodeValue, FILTER_VALIDATE_EMAIL) !==
false) ) {
convertMailtoToAnchor($textContainer, $textNode);
}
}

/**
 * modify a DOMElement that has a DOMText node as a child; create a
DOMElement
 * that represents and a tag, and set the value and href attirbute,
so that it
 * acts as a 'mailto' link
 */
function convertMailtoToAnchor(DomElement $textContainer, DOMText
$textNode) {
$newNode = new DomElement('a', $textNode-nodeValue);
$textContainer-replaceChild($newNode, $textNode);
$newNode-setAttribute('href', mailto:{$textNode-nodeValue

RE: [PHP] Using DOM textContent Property

2008-09-03 Thread Tim Gustafson
 I think you might be better off using regexp on the text
 *before* sending it through the DOM parser. Send the
 user's text through a function that searches for URLs
 and email addresses, creating proper links as they're
 found, then use the output from that to move on to your 
 DOM stuff. That way, you need not create new nodes in
 your nodelist.

I think that's the way I'm going to have to go, but I was really hoping not
to.  Thanks for the suggestion!

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354




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



[PHP] Using DOM textContent Property

2008-09-02 Thread Tim Gustafson
Hello,

I am writing a filter in PHP that takes some HTML as input and goes through
the HTML and adjusts certain tag attributes as needed.  So, for example, if
a tag is missing the title attribute, this filter adds a title attribute
to the a tag.

I'm doing this all using PHP 5 and the DOM parsing library, and it's working
really well.

The one snafu I'm running in to is dealing with users who will just type an
e-mail address into an HTML document without actually making it a link - so,
they'll just put [EMAIL PROTECTED] rather than a
href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED]/a.  I'd like for these 
incorrectly
entered e-mail addresses to magically change into real clickable links, so
I'd like my filter to be able to grab those plain text e-mail addresses and
convert them to actual clickable links.

I tried iterating through all the elements on a page using something like
this:

$Elements = $HTML-getElementsByTagName(*);

for ($X = 0; $X  $Elements-length; $X++) {
  ... SNIP ...
}

And then I tried looking at the textContent property of each node, but it
seems that higher-level nodes include all the text of their children nodes
(which is what the DOM documents say it should).  But there doesn't appear
to be any way to know if the textContent you've got is for just one node, or
for a whole bunch of nodes.  Is there any way to figure that out, so that I
can adjust the textContent property of just the lowest-level nodes, rather
than mucking up the higher-level ones?

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354



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



RE: [PHP] Using DOM textContent Property

2008-09-02 Thread Tim Gustafson
 if a node has children, then its not a leaf, so i imagine
 you could continue to traverse until you reach the leaf
 that actually has the address needing magical conversion.

I tried that.  $Element-hasChildNodes() returns true for just about
everything except tags like br and img that have no corresponding /br
or /img because the content that appears between p and /p, for
example, apparently counts as a child node, even though they're not HTML
tags.  So, if you have:

pFoo!/p

when you look at $Element-hasChildNodes() for the p tag, you will get
true, and $Element-childNodes-length is equal to 1, even though Foo!
isn't an HTML tag.  Interestingly though, when you iterate through the tree,
you get the p tag as one of the elements, but you never get a text-only
element that has that p as a parentNode.  In fact, get_class($Element)
always returns DOMElement, even on the text-only nodes, which I would have
expected to be DOMText elements...but I guess not.  So I'm wondering why
$Element-hasChildNodes() would return true, but iterating through the DOM
tree returns no elements that have that $Element as a parentNode.

What's more, looking at $Element-childNodex-length isn't too helpful,
because, for example:

h2a name=bar/aFoo/h2

returns two child nodes, neither of which has Foo for its textContent.

Tim Gustafson
SOE Webmaster
UC Santa Cruz
[EMAIL PROTECTED]
831-459-5354



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



Re: [PHP] 4.1.1 Causes Signal 11 On FreeBSD 4.5 / Apache 1.3.22

2002-01-15 Thread Tim Gustafson

  I am experiencing a lot of Signal 11's when I compile PHP 4.1.1 into my
  Apache server on my FreeBSD 4.5-RC machine.  If I compile the -exact-
same
  Apache configuration with PHP 4.0.6, it works fine.  As soon as I switch
to
  4.1.1, it causes Signal 11's (and sometimes 10's) when I load certain
pages.
  It seems that it crashes when the pages have mySQL database access on
them
  and are fairly complex (I was thinking perhaps a memory problem?)

 You somtimes get 10's?  That's a SIGUSR1 and not something that will take
 down your server.  It would actually cause a graceful restart of Apache,
 but I don't see how anything we do in PHP could cause spurious sig10's.
 Get a backtrace of one of the sig11's.  Without that there isn't much hope
 of us tracking this down.

No, it doesn't take the server down.  It kills one of the child processes
off and apache starts a new one.  And yes, it's sig 10's and sig 11's
interchangeably.  I re-complied everything from scratch to make sure it's
not a glitch and I get the same results now.  How can you backtrace
something?  I'm not a C developer, so I don't really know what you're
talking about.

Tim




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP] 4.1.1 Causes Signal 11 On FreeBSD 4.5 / Apache 1.3.22

2002-01-13 Thread Tim Gustafson

Hello

I am experiencing a lot of Signal 11's when I compile PHP 4.1.1 into my
Apache server on my FreeBSD 4.5-RC machine.  If I compile the -exact- same
Apache configuration with PHP 4.0.6, it works fine.  As soon as I switch to
4.1.1, it causes Signal 11's (and sometimes 10's) when I load certain pages.
It seems that it crashes when the pages have mySQL database access on them
and are fairly complex (I was thinking perhaps a memory problem?)

The machine that it runs on is, hardware wise, very stable - it's been using
the same memory, processor, hard drive and motherboard for almost a year
with no problems, and no other daemons crash or cause any signals at all.

Has anyone else experienced this problem?  Any ideas on what may be the
cause?

Here's the line that I used to configure PHP (so you can see what modules
I'm installing):

./configure --with-apache=../apache_1.3.22 --enable-safe-mode --with-exec-di
r=/usr/local/bin --enable-bcmath --enable-calendar --with-jpeg-dir=/usr/loca
l --with-ftp --with-gd=/usr/local --with-png-dir=/usr/local --with-ttf=/usr/
local --with-mysql=/usr/local --with-curl=/usr/local --with-zlib-dir=/usr/lo
cal --with-freetype-dir=/usr/local --with-pear --with-mcrypt --with-dom=/usr
/local --with-pcre

Any help is greatly appreciated.

Thanks.

Tim



smime.p7s
Description: application/pkcs7-signature


[PHP] Problems Installing 4.1.1 on FreeBSD 4.4 STABLE

2002-01-05 Thread Tim Gustafson

Hello Everyone.

I just tried to upgrade my Apache 1.3.22 web server to us PHP 4.1.1.  I was
running PHP 4.0.6 without problems for months, but wanted to take advantage
of the bug fixes and new features.  The compile seemed to go OK, and the new
httpd runs fine.  However, I've encountered a strange bug when visitng my
web sites using Netscape 4.78.

Whenever you visit a page that uses PHP's mySQL capabilities extensively (in
my estimation, anything that has an update query, but I've only confirmed
this on a handfull of pages so it could be some other more subtle symptom),
the httpd process that handles that request gets a signal 10 or signal 11
(it switches back and fourth, but it's mostly a signal 11).  When you go to
these pages in IE or any other browser, it works fine with very few
exceptions - it has been found to sig10 or sig11 on a few requests from IE
or other versions of Netscape, but not with any regularity.  Netscape 4.78
causes it to crash every time.  It's important to not that it does not
happen with every request or on every site - most pages operate fine, even
with updates.  It just seems that the few that do cause it to crash have
several selects/updates on one page.

Has anyone else experienced this problem?

Here's a list of the versions of things that I'm running:

Apache 1.3.22
PHP 4.1.1 (4.0.6 works fine)
mySQL 3.23.46
mod_ssl 2.8.5
OpenSSL 0.9.6a

Any help would be greatly appreciated.

Thanks.

Tim



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]