php-general Digest 21 Aug 2005 10:34:42 -0000 Issue 3637

Topics (messages 221016 through 221036):

Re: preg_match
        221016 by: Edin Kadibašić
        221017 by: Edin Kadibašić

[suspicious - maybe spam] $BM_5aITK~$J1|MM$r%O%a%F8+$^$;$s$+(B
        221018 by: info.g-muta.com

exec ping
        221019 by: Juan Pablo Herrera
        221020 by: Jasper Bryant-Greene
        221021 by: Juan Pablo Herrera
        221023 by: Jasper Bryant-Greene
        221025 by: Juan Pablo Herrera

Re: apache sessions
        221022 by: Chris Shiflett

SUPPORT FOR INTERACTION WITH A DATABASE
        221024 by: Fernando Garza

PHP and Prolog database interaction
        221026 by: Fernando Garza

PHP and Prolog
        221027 by: Fernando Garza

support for database interaction
        221028 by: Fernando Garza
        221030 by: Jasper Bryant-Greene
        221032 by: Robert Cummings

how to know when a php library is installed
        221029 by: Lizet Pena de Sola
        221031 by: Jasper Bryant-Greene
        221034 by: Lizet Pena de Sola

VERY SORRY, explanation
        221033 by: Fernando Garza

Problem between php4.4 and mysql
        221035 by: Alex Scott
        221036 by: Burhan Khalid

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 ---
Richard Lynch wrote:
> But Perl isn't going to *SEE* \\s !!!
> 
> PHP is going to *EAT* \\ and make \ out of it.
> 
> That's why \ is an escape character in PHP.
> 
> It's also an escape character in Perl/PCRE.
> 
> Some days I think PHP's escape character should have been | or
> something, just so this topic wouldn't come up every damn month.

All true, except you would then end up having problems with regexs like
(this|or|that) :)

Edin

--- End Message ---
--- Begin Message ---
Jasper Bryant-Greene wrote:
> John Nichel wrote:
> 
>> Personally, I have never used \\ in PCRE when looking for things like
>> spaces (\s), word boundraries (\b), etc. and it's all worked out fine.
> 
> 
> It will work fine, but only because those (\s and \b) just happen to not
> be special characters in PHP *at this time*.
> 
> It's sloppy programming because the backslash is known to be a special
> character, and \s or \b could conceivably become special characters at
> some time in the future. It's unlikely, but possible.
> 
> Not only that, but it makes it more likely that you'll forget and put \n
> when you meant \\n, \r when you meant \\r, \t when you meant \\t, and so
> on...

Also people thinking that PHP's single-quoted strings don't have any
escape sequences run into trouble when they have backslash as the last
character of the string:

$path = 'c:\';

This will give you parse error because the parser would think that you
wanted literal ' character and looks in vain for the string end. The
correct line should be:

$path = 'c:\\';

Edin

--- End Message ---
--- Begin Message ---
---------------------
$B5U!o8r:](B $B"v5U!o8r:](B
---------------------
[EMAIL PROTECTED],[EMAIL PROTECTED];~Be$O=*$j$^$7$?!#Ev%5%$%H$O5U!o4uK>[EMAIL 
PROTECTED],[EMAIL PROTECTED]<+M3$KA*$Y$k%7%9%F%`$r:NMQ$7$F$$$^$9!#(B

$B"[EMAIL PROTECTED](B $B!D(B [EMAIL 
PROTECTED]>D<!Bh$G$O%(%C%A$"$j(B+$B$*Ni$b$"$j(B
$B"[EMAIL PROTECTED](B $B!D(B [EMAIL PROTECTED]<+M3$K8r>D$7$F(BOK!!

[EMAIL PROTECTED]:$1$^$9$,!"[EMAIL 
PROTECTED]:$-$^$9!#$^$?!"$4?75,EPO?$K4X$7$^$7$F$O?3::@)$H$J$C$F$*$j$^$9!#(B

http://awg.webchu.com/deai/?meet

$B"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~(B
[EMAIL PROTECTED]@-$X$N%5%]!<%H!o$O$"$/$^$G$bK\?M<!Bh$G$9!#(B
[EMAIL PROTECTED]@-$X$N%5%]!<%H$O<+M38r>D$G$*4j$$$7$^$9!#(B 
$B"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~"!!~(B

[EMAIL PROTECTED]&6bA,[EMAIL PROTECTED](B 

$B$^$?!"[EMAIL PROTECTED]>[EMAIL 
PROTECTED],!"$*Aj<j$NG/Np!&MF;Q$OJ]>cCW$7$^$;$s!#(B
$B$G$b<B:]$K7]G=4X78!&2;[EMAIL PROTECTED]"$j$^$9!#(B
$B$I$s$J?M$K=P0)$($k$+$O!"B3$1$J$$$H$o$+$j$^$;$s$h$M!#(B
[EMAIL PROTECTED]"%k%P%$%H463P$G$*;n$72<$5$$!#(B  

http://awg.webchu.com/deai/?meet

$B!ZMxMQEPO?![(B
[EMAIL PROTECTED]"[EMAIL PROTECTED];YJ'$$(B
$B"-"-"-(B
$B!Z%a%C%;!<%88r49![(B
$B$"[EMAIL PROTECTED];d=qH"$r$4MxMQD:$1$^$9(B
$B!J%a!<%k%"%I%l%9!&EEOCHV9f$N8r49$b<+M3!K(B
$B"-"-"-(B
$B!Z8r>D![(B
$B6b3[!&9g$&2s?t!&%W%l%$FbMF$J$I(B
$B"-"-"-(B
$B!Z5U!o8r:]%9%?!<%H![(B
[EMAIL PROTECTED]'[EMAIL PROTECTED]>r7o$K9g$o$;$F8r:](B+$B%5%]!<%H(B
[EMAIL PROTECTED]':GDc(BSEX$B$r%5%]!<%H(B

$B"-6=L#$r;}$?$l$?J}$OAaB.EPO?"-(B  
         $B"-"-"-"-"-"-(B
http://awg.webchu.com/deai/?meet

--- End Message ---
--- Begin Message ---
Hi all!
I have following script:
$comando = system('ping 168.192.0.1', $nn);
echo $nn;
Well, i need that only show the first ten lines of the ping and kill
the process.
How can i make it?

Regards,
JP

--- End Message ---
--- Begin Message ---
Juan Pablo Herrera wrote:
Hi all!
I have following script:
$comando = system('ping 168.192.0.1', $nn);
echo $nn;
Well, i need that only show the first ten lines of the ping and kill
the process.
How can i make it?

If I understand your question correctly...

$comando = system('ping -c 10 168.192.0.1', $nn);

Jasper

--- End Message ---
--- Begin Message ---
On 8/21/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote:
> Juan Pablo Herrera wrote:
> > Hi all!
> > I have following script:
> > $comando = system('ping 168.192.0.1', $nn);
> > echo $nn;
> > Well, i need that only show the first ten lines of the ping and kill
> > the process.
> > How can i make it?
> 
> If I understand your question correctly...
> 
> $comando = system('ping -c 10 168.192.0.1', $nn);
> 
> Jasper
>

Thanks Jasper,
well, i need make a explode of results of the ping. The idea is check
a host and when the host don´ t response send a email.
I don't explode the result of the ping.

Thanks.,
JP

--- End Message ---
--- Begin Message ---
Juan Pablo Herrera wrote:
Thanks Jasper,
well, i need make a explode of results of the ping. The idea is check
a host and when the host don´ t response send a email.
I don't explode the result of the ping.

If it was me, I'd try opening a socket connection to the host instead, and check to see if you can connect or not. Whether or not that is suitable to your application I don't know...

Jasper

--- End Message ---
--- Begin Message ---
On 8/21/05, Jasper Bryant-Greene <[EMAIL PROTECTED]> wrote:
> Juan Pablo Herrera wrote:
> > Thanks Jasper,
> > well, i need make a explode of results of the ping. The idea is check
> > a host and when the host don´ t response send a email.
> > I don't explode the result of the ping.
> 
> If it was me, I'd try opening a socket connection to the host instead,
> and check to see if you can connect or not. Whether or not that is
> suitable to your application I don't know...
> 
> Jasper
> 

Hi!
I did following script:

<?php
// Exec a ping
exec('ping -c 5 192.168.236.3',$result);
// Take result from icmp seq = 2
$icmp = strpos($result[2], 'time=');

$icmp = $icmp + 5;

$fin = strpos($result[2], 'ms');
// This is my end
$fin = $fin - $icmp;
// I take only the ms time
$text = substr($result[2],$icmp,$fin);
// Strip whitespace
$ms = trim($text);

if (!is_numeric($ms)) {
  $a = '[EMAIL PROTECTED]';
  $asunto = "Servidor Caido";
  $mensaje = "Posible caida del servidor. No responde PING.";
  mail($a, $asunto, $mensaje);
}

?>

It's very simple, but i think that is working. I will add other options.

JP

--- End Message ---
--- Begin Message ---
Bawt T. Eggdrop wrote:
im trying to change my session backend for apache from files to mysql.
is there something php provides that allows a php script to execute
before each page gets loaded in apache. if not i have to edit hundreds
of php files...theres gotta be an easier way. thanks.

I may be misunderstanding your question, but if you're wanting to change the session data store that PHP uses, you can use session_set_save_handler() and write your own functions.

Apache handles incoming HTTP requests, so it doesn't make sense for a PHP script to execute before it has been requested.

Hope that helps.

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

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

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute some function that 
run an .EXE, passes values and receive values from the shell


any idea?

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

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute some function that 
run an .EXE, passes values and receive values from the shell


any idea?

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

I am creating a Shell in prolog language that interacts with a Visual Prolog 
database format in Win32, I would like to interact with this database with 
PHP, just like the interaction with MySQL database, can you give me some 
notion or the code that need to be executed to get this done? for example 
in:

mysql_connect 

or 

mysql_create_db

what code is executed behind this functions?


I think the functions to make this done should be execute a program with 
some function, passes values and receive values from the shell


any idea?

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

I am creating a 'Shell' in prolog language that interacts with a 'Visual 
Prolog' database format in 'Win32', I would like to interact with this 
database with 'PHP', just like the interaction with 'MySQL' database, can 
you give me some notion or the code that need to be executed to get this 
done? for example in:

'mysql_connect' 

or 

'mysql_create_db'

what code is executed behind this functions?


I think the functions to make this done should be execute a program with 
some function, passes values and receive values from the 'shell'


any idea?

--- End Message ---
--- Begin Message ---
Fernando Garza wrote:
Hi,

I am creating a 'Shell' in prolog language that interacts with a 'Visual Prolog' database format in 'Win32', I would like to interact with this database with 'PHP', just like the interaction with 'MySQL' database, can you give me some notion or the code that need to be executed to get this done? for example in:

'mysql_connect' or
'mysql_create_db'

what code is executed behind this functions?

Have a look at the PHP source code if you want to know what code is executed behind those functions.

And please refrain from spamming the list with 4 almost-identical messages.

Jasper

--- End Message ---
--- Begin Message ---
On Sun, 2005-08-21 at 02:58, Fernando Garza wrote:
> Hi,
> 
> I am creating a 'Shell' in prolog language that interacts with a 'Visual 
> Prolog' database format in 'Win32', I would like to interact with this 
> database with 'PHP', just like the interaction with 'MySQL' database, can 
> you give me some notion or the code that need to be executed to get this 
> done? for example in:
> 
> 'mysql_connect' 
> 
> or 
> 
> 'mysql_create_db'
> 
> what code is executed behind this functions?
> 
> 
> I think the functions to make this done should be execute a program with 
> some function, passes values and receive values from the 'shell'

Is there a reason you're spamming the list with multiple versions
(teency bit changed from one to the next) of the same question?

Cheers,
Rob.
-- 
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for       |
| creating re-usable components quickly and easily.          |
`------------------------------------------------------------'

--- End Message ---
--- Begin Message ---
Hello all:
I need to test whether a library is installed with php or not. In this
case it's the tidy library I need for a project.
After getting a message from the hosting administrator that the tidy
library was installed and ready to use I ran a phpinfo() to find out
details:
There's nothing that looks like tidy in the Configure Command:

Configure Command        './configure' 'i386-redhat-linux'
'--prefix=/usr'
'--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin'
'--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include'
'--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var'
'--sharedstatedir=/usr/com' '--mandir=/usr/share/man'
'--infodir=/usr/share/info' '--prefix=/usr'
'--cache-file=../config.cache' '--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-db3' '--with-curl'
'--with-pear' '--with-dom=/usr' '--with-exec-dir=/usr/bin'
'--with-freetype-dir=/usr' '--with-png-dir=/usr' '--with-gd'
'--enable-gd-native-ttf' '--with-ttf' '--with-gdbm' '--with-gettext'
'--with-ncurses' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr'
'--with-openssl' '--with-png' '--with-pspell' '--with-regex=system'
'--with-xml' '--with-expat-dir=/usr' '--with-pcre=/usr' '--with-zlib'
'--with-layout=GNU' '--enable-bcmath' '--enable-exif' '--enable-ftp'
'--enable-magic-quotes' '--enable-safe-mode' '--enable-sockets'
'--enable-sysvsem' '--enable-sysvshm' '--enable-discard-path'
'--enable-track-vars' '--enable-trans-sid' '--enable-yp'
'--enable-wddx' '--without-oci8' '--with-pear=/usr/share/pear'
'--with-imap=shared' '--with-imap-ssl' '--with-kerberos'
'--with-ldap=shared' '--with-mysql=shared,/usr' '--with-pgsql'
'--with-snmp=shared,/usr' '--with-snmp=shared'
'--enable-ucd-snmp-hack' '--with-unixODBC=shared'
'--enable-memory-limit' '--enable-bcmath' '--enable-shmop'
'--enable-versioning' '--enable-calendar' '--enable-dbx'
'--enable-dio' '--enable-mcal' '--enable-mbstring'
'--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-cgi'


However there is a section in the phpinfo output that shows:
tidy
Tidy support    enabled
libTidy Build Date      1 July 2005

Directive       Local Value     Master Value
tidy.default_config     no value        no value

Tidy Configuration Directive    Value
indent-spaces   0
....


I've tried to run this php code to call tidy functions:
<?

$html = '


<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
<head><title>title</title></head>
<body>
<p>paragraph <bt />
text</p>
</body></html>
';
$tidy = new tidy;
$tidy->parseString($html);

$tidy->CleanRepair();

if ($tidy->errorBuffer) {
  echo "The following errors were detected:\n";
  echo $tidy->errorBuffer;
}

?>

And always get the error cannot instantiate nonexistent class.

Any input, comments are more than welcome,
Lizet

--- End Message ---
--- Begin Message ---
Lizet Pena de Sola wrote:
Hello all:
I need to test whether a library is installed with php or not. In this
case it's the tidy library I need for a project.

<?php
if(function_exists('tidy_get_output')) {
        // Tidy is installed
} else {
        // Tidy is not installed, contact your host
}
?>

Jasper

--- End Message ---
--- Begin Message ---
Contacting host, thanks :)

-----Original Message-----
From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] 
Sent: Sunday, August 21, 2005 1:20 AM
To: 'php'
Subject: Re: [PHP] how to know when a php library is installed

Lizet Pena de Sola wrote:
> Hello all:
> I need to test whether a library is installed with php or not. In this
> case it's the tidy library I need for a project.

<?php
if(function_exists('tidy_get_output')) {
        // Tidy is installed
} else {
        // Tidy is not installed, contact your host
}
?>

Jasper

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





--- End Message ---
--- Begin Message ---
very sorry for the "spam", I send the message many times because I received 
this message:*


Symantec Mail Security detected prohibited content in a message sent from 
your address 
(SYM:00367781894249647555)


*and I thinked that my message isn´t received, so I try to change the 
content


very thankful for the link

and sorry for the spamming

--- End Message ---
--- Begin Message ---
Hi there,

I discovered that our website was not working properly today (To my horror).
Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other php pages are working.

I restarted apache using the inetd script as well as mysql using the inetd script. However the problem exists. I can enter mysql through the shell and tables seem intact.
I have no relevant errors in my log file.

One thing I noticed was that when I went to restart Apache it said ( before restarting): [Sun Aug 21 10:39:08 2005] [warn] module php4_module is already loaded, skipping

Should I try to be loading that module, somehow?

Any suggestions in how to get PHP working with mysql again would be much appreciated as it is a busy sight, so slightly stressed.

Thanks Alex.

--- End Message ---
--- Begin Message ---
Alex Scott wrote:
Hi there,

I discovered that our website was not working properly today (To my horror).
Hosted on redhat enterprise 4.

I think that there is a problem with php 4.4 talking to Apache mysql 4.1
as the php pages which do not talk to the DB are working but other php pages are working.

This has been asked before, and answered (even by me).

You need http://php.net/mysqli or change your MySQL configuration so that it allows 'old style' passwords.

Google for the rest, or STFA :)

Regards,
Burhan

--- End Message ---

Reply via email to