php-general Digest 16 May 2007 15:38:38 -0000 Issue 4794

Topics (messages 255003 through 255019):

Re: problem with string & floats in PHP
        255003 by: Andrei

Re: Cannot connect to an MySQL database using Named Pipes (resolved)
        255004 by: John Comerford

Re: PHP debugger
        255005 by: Arno Kuhl
        255013 by: Miles Thompson

Remove domain: What do think of this approach?
        255006 by: Micky Hulse
        255007 by: Micky Hulse
        255008 by: Robin Vickery
        255009 by: Micky Hulse

Re: Bounty
        255010 by: Tijnema !
        255011 by: Jay Blanchard

using preg_match
        255012 by: Ed Curtis
        255014 by: Christian Haensel
        255015 by: Ed Curtis
        255016 by: Al
        255017 by: Rob Desbois

Re: Bounty, NOW!
        255018 by: Michelle Konzack

Large amount of data over SOAP / MTOM
        255019 by: Gal

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 ---
    If you need precision with floats or doubles you can use BCMath
Arbitrary Precision Mathematics Functions.

http://www.php.net/manual/en/ref.bc.php

    Andy

Pablo Luque wrote:
> Hello, Im designing a website in which I have to read some data
> (numbers) from a txt file and then send this data to a function which
> prints a graphic with them. When I read the data I save it in an array
> and the numbers are in this format: 5.812E-08. I have read the php
> documentation about it, and I have use the example given there to
> check which type is the data saved in the array. The response I got is
> $vectorIc[1]== 5.812E-08 type is string
>
> I dont understand why. In the documentation it is clear that this kind
> of data should be considerer float, or thats what I understood. I cant
> continue with my web designing if I dont get to turn the vector
> elements into float numbers, because the function that prints the
> graphic gives errors when recieving strings. I would be very thankful
> if you could help me trying to solve this. In using PHP 4.4.7 and
> Apache 2.0.59.
>
> Thank you very much!
>
> _________________________________________________________________
> Descubre la descarga digital con MSN Music. Más de un millón de
> canciones. http://music.msn.es/
>

--- End Message ---
--- Begin Message --- I got as reply on another forum which resolved this issue. The command should be:

$mysqli = new mysqli(".", $username,$password, $database,null,"/tmp/mysql.sock");

NB. host is a dot

John Comerford wrote:
Hi Folks,

I have a database running on Window XP, that I want to disable network connections to and enable 'named pipes'. I am running MySQL 5.0.27 and my.ini looks like...

[client]
#password    = your_password
port        = 3306
socket        = /tmp/mysql.sock

[mysqld]
#port        = 3306
socket        = /tmp/mysql.sock
#Allow connections via named pipes (Windows NT+ only). Note: you can specify a pipe name on the advanced network page, if required.
enable-named-pipe
#Don't allow connections via TCP/IP.
skip-networking



I can connect to the DB using the MySQL GUI tools if I set my pipe name to '/tmp/mysql.sock' using the login dialog box. However when I try and connect using PHP I get an error. I have tried several variants of the connect command and I get various errors but all are along the lines of:
Unknown MySQL server host '/tmp/mysql.sock' (11004)  or
Can't connect to MySQL server on 'localhost' (10061)

I have tried
$mysqli = new mysqli(null, $username,$password, $database);
$mysqli = new mysqli("localhost:/tmp/mysql.sock", $username,$password, $database); $mysqli = new mysqli("localhost", $username,$password, $database,3306,"/tmp/mysql.sock"); $mysqli = new mysqli("localhost", $username,$password, $database,"/tmp/mysql.sock");
$mysqli = new mysqli("/tmp/mysql.sock", $username,$password, $database);

I have also tried the above commands using mysqli_connect ? I have done a few searches of the web but seem to always come up with something like the above? Anybody have any ideas why it won't connect in PHP ?

TIA,
JC



--

1^st Floor, 184 -186 Glenferrie Road, Malvern VIC 3144

PH:    *(03) 9500 1466*
FX :    *(03) 9500 1469*
Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>
Web:  www.styleman.com.au <http://www.styleman.com.au>

The information in this e-mail is confidential and is intended solely for the addressee. Any views or opinions presented are solely those of the author and do not necessarily represent those of Option Systems Pty Ltd. If you are not the intended recipient, please delete this message and contact the sender.
--- End Message ---
--- Begin Message ---
If you don't see any change in phpinfo then maybe it's not picking up the
dbg extension in your php.ini. Presumably you've also put the other debugger
directives in your ini?

You can also try download the trial version of PHPEd from Nusphere, install
that, and check how it configures the debugger. The trial lasts a month I
think, so maybe you'll sort out your problems in that time anyway. Just be
sure to completely uninstall it afterwards because I think the free dbg
version is not the same as the version integrated in PHPEd. Any version
differences cause the extension to not load, though in that case it should
report an error. You can't use the dbg integrated in PHPEd after uninstall
because it doesn't work without PHPEd.

Arno


-----Original Message-----
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 15 May 2007 08:21
To: PHP List
Subject: [PHP] PHP debugger


I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.

The debugger which I am trying to set up is the free, pre-compiled
Linux version of dbg ( DBG 2.15.5 dbg modules), from
http://dd.cron.ru/dbg/, and all of the instructions have been followed
as posted on the NuSphere site.

Yes, Apache has been stopped and restarted!!

There is no difference in the output from phpinfo(). The line
"with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
does not appear.

PHP is compiled without debugging, but I did consider that was for the
purpose of debugging PHP itself, not scripts.

Suggestions will be most welcome. Also, I'm not married to this, so if
anyone thinks there is a better debugger, please jump in.

Regards - Miles Thompson

PS Why are we doing this? Because we are getting tired of debugging
with Javascript alert()  boxes. /mt

PPS And we are using those because of Joomla!  Some things are buried
so deeply we cannot use print() or echo(). /mt

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

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


-----Original Message-----
From: Miles Thompson [mailto:[EMAIL PROTECTED]
Sent: 15 May 2007 08:21
To: PHP List
Subject: [PHP] PHP debugger


I am trying to load a PHP debugger in our most recent build of PHP 5.2.1.

The debugger which I am trying to set up is the free, pre-compiled
Linux version of dbg ( DBG 2.15.5 dbg modules), from
http://dd.cron.ru/dbg/, and all of the instructions have been followed
as posted on the NuSphere site.

Yes, Apache has been stopped and restarted!!

There is no difference in the output from phpinfo(). The line
"with DBG v2.11.30, (C) 2000,2004 by Dmitri Dmitrienko, http://dd.cron.ru";
does not appear.

PHP is compiled without debugging, but I did consider that was for the
purpose of debugging PHP itself, not scripts.

Suggestions will be most welcome. Also, I'm not married to this, so if
anyone thinks there is a better debugger, please jump in.

Regards - Miles Thompson
< snipped some trivial comments>


On 5/16/07, Arno Kuhl <[EMAIL PROTECTED]> wrote:
If you don't see any change in phpinfo then maybe it's not picking up the
dbg extension in your php.ini. Presumably you've also put the other debugger
directives in your ini?

You can also try download the trial version of PHPEd from Nusphere, install
that, and check how it configures the debugger. The trial lasts a month I
think, so maybe you'll sort out your problems in that time anyway. Just be
sure to completely uninstall it afterwards because I think the free dbg
version is not the same as the version integrated in PHPEd. Any version
differences cause the extension to not load, though in that case it should
report an error. You can't use the dbg integrated in PHPEd after uninstall
because it doesn't work without PHPEd.

Arno

From my php.ini ....
; added debug extension "dbg.so-5.2.x" and
; see [debugger] section of this file -  20050515 - mthompson
;
extension=dbg.so  ;dbg.so-5.2.x

and the [debugger] section ...
; Added [debugger] section 20050515 - mthompson
; Note:  DBG versions 2.15 (free) does not support debugger.hosts_allow,
; debugger.hosts_deny or debugger.ports settings.
;
[debugger]
debugger.enabled=on
debugger.profiler_enabled=on
debugger.hosts_allow= <<inserted domain and IP number here>>
debugger.hosts_deny=ALL
debugger.ports=7869, 10000/16
; end [debugger] section

Couple of notes:
1. Tried this with extension pointing to both dbg.so and dbg.so-5.2.x.
(The latter is what the instructions specified, but that did not seem
correct.)

2. Also tried it, in combination with above, with  debugger.hosts_allow,
debugger.hosts_deny and debugger.ports all commented out.

3. PHP version is 5.2.1, compiled from source on a Ubuntu Edgy Eft server.

I'm wondering it I should download the source and compile it. That
might be a better way home than assuming the binary is correct.

Arno, your suggestion to install the NuSphere editor is a good one.
I'm just reluctant to add more junk to my Windows box and to allow
something other than atp-get / dselect to mess with server
configuration. (Although it is a development box, so errors are not
terminal!)

Thanks to everyone for suggestions.

Regards - Miles

--- End Message ---
--- Begin Message ---
Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid possible open_basedir restrictions.) Here is what I got so far:

# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '', http://www.site.com/folder/foo);
echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the answer will be no.... Or, anyone have any tips/improvements?

Thanks!
Cheers,
Micky


--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
Micky Hulse wrote:
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

Ooops, typed that wrong, example output should be:

/web1/httpd/htdocs/folder/foo

--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
On 16/05/07, Micky Hulse <[EMAIL PROTECTED]> wrote:
Hi folks, I hope everyone is having a good week. :)

Let me cut to the chase... Basically, I need to get this:

http://www.site.com/folder/foo

To work like this:

$_SERVER['DOCUMENT_ROOT'].'folder/foo/file.ext';

For use with getimagesize() and a few other functions (trying to avoid
possible open_basedir restrictions.) Here is what I got so far:

# Determine http type:
$http_s = ($_SERVER['HTTPS'] == on) ? 'https://' : 'http://';
# Get root path:
$from_root = str_replace($http_s.$_SERVER['SERVER_NAME'], '',
http://www.site.com/folder/foo);
echo
$_SERVER['DOCUMENT_ROOT'].$from_root;
/*
** Output:
** /web1/httpd/htdocs/blogs/images/uploads
*/

So, do you think I can rely upon the above script? I have a feeling the
answer will be no.... Or, anyone have any tips/improvements?

use parse_url()

http://www.php.net/parse_url

then append the 'path' part to document root ?

--- End Message ---
--- Begin Message ---
Robin Vickery wrote:
use parse_url()
http://www.php.net/parse_url
then append the 'path' part to document root ?

OMG, that looks like it will do the trick!

Jeez, how did I miss that. I feel like a dufus.

Are list members allowed at least one "RTFM" question per month? :D

Thanks Robin! I appreciate the help.

Have a great day/night.
Cheers,
Micky



--
Wishlists: <http://snipurl.com/1gqpj>
   Switch: <http://browsehappy.com/>
     BCC?: <http://snipurl.com/w6f8>
       My: <http://del.icio.us/mhulse>

--- End Message ---
--- Begin Message ---
On 5/15/07, Brad Sumrall <[EMAIL PROTECTED]> wrote:
Ok, maybe most of my fun will come from schmucks!



Hehehehe

75.34.61.72 from Baltimore is already giving it a whack!!!





Hehehehehe

Ok, this may be a fun night!


Where are the list administrators to ban this guy??

--- End Message ---
--- Begin Message ---
[snip]
Where are the list administrators to ban this guy??
[/snip]

This is an un-moderated list, so that makes us the police of our own
list. 

--- End Message ---
--- Begin Message ---
I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable named '$path'.

I know '/' is used as a container within the command itself. How do I escape it to find the string '/realtors'?

Thanks,

Ed

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

did you try the backslash as escape character?

<?
$path = "testing/realtors/userdata/";
if(preg_match("/\/realtors/", $path)) {
echo 'Success';
}
?>

Works for me :o)

Maybe try http://de3.php.net/manual/en/function.preg-match.php too see some examples.

Good luck

Chris

----- Original Message ----- From: "Ed Curtis" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2007 2:12 PM
Subject: [PHP] using preg_match


I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable named '$path'.

I know '/' is used as a container within the command itself. How do I escape it to find the string '/realtors'?

Thanks,

Ed

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



--- End Message ---
--- Begin Message ---
Christian Haensel wrote:
Hi Ed,

did you try the backslash as escape character?

<?
$path = "testing/realtors/userdata/";
if(preg_match("/\/realtors/", $path)) {
echo 'Success';
}
?>

That's what did it. I was thinking the \ was the escape for the command but wanted to make sure.

Thanks!

--- End Message ---
--- Begin Message --- The "container", as you called it, are delimiters. They can be about any character you choose; but, stay away from preg control characters. Personally, I use "%" most of the time.

It's a good habit to use delimiter characters that you can be certain will not be included in your strings. Then, you don't need to worry about escaping them in your string.

Ed Curtis wrote:
I'm trying to use preg_match to find a string in a system path.

What I need to do is see if the string '/realtors' exists in a variable named '$path'.

I know '/' is used as a container within the command itself. How do I escape it to find the string '/realtors'?

Thanks,

Ed

--- End Message ---
--- Begin Message ---
[re-sending, forgot to include list :-|]
If you're matching a string and not a pattern then it is far more efficient
to use strpos:

if (strpos($path, '/realtors') !== FALSE) {
  echo 'Success';
}

rob

On 5/16/07, Al <[EMAIL PROTECTED]> wrote:

The "container", as you called it, are delimiters.  They can be about any
character you choose; but, stay away from preg
control characters. Personally, I use "%" most of the time.

It's a good habit to use delimiter characters that you can be certain will
not be included in your strings. Then, you
don't need to worry about escaping them in your string.

Ed Curtis wrote:
> I'm trying to use preg_match to find a string in a system path.
>
> What I need to do is see if the string '/realtors' exists in a variable
> named '$path'.
>
> I know '/' is used as a container within the command itself. How do I
> escape it to find the string '/realtors'?
>
> Thanks,
>
> Ed

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




--
Rob Desbois
Eml: [EMAIL PROTECTED]
Tel: 01452 760631
Mob: 07946 705987
"There's a whale there's a whale there's a whale fish" he cried, and the
whale was in full view.
...Then ooh welcome. Ahhh. Ooh mug welcome.

--- End Message ---
--- Begin Message ---
Am 2007-05-15 02:51:17, schrieb Brad Sumrall:
> Yes, I do still need legit help. But obviously I needed to make a point to
> all the script kiddies out there that you are playing with fire if you even
> attempt to miss use an admin password or access a server that does not
> belong to you.
> As a prior USMC Network Admin and DoD network security specialist.
> Back off Big brother is watching!
> 
> I come to the list as a legit person seeking intelligent minds.
> Not games.
> 
> So yes, respond to me as a professional or an up and coming and let's talk
> business!
> 
> Brad
------------------------- END OF REPLIED MESSAGE -------------------------

Maybe you should contact <http://www.getacoder.com/>?

Greetings
    Michelle Konzack
    Systemadministrator
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
                   50, rue de Soultz         MSN LinuxMichi
0033/6/61925193    67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---
--- Begin Message ---
Hello,

I'll appreciate your answer to the following questions:

1) What standard modules in PHP (5.x) enable to move large amount of
data over
a SOAP response  (I know about DIME support)?
2) Is there a plan to support MTOM in PHP (if you're involved with
php/pear development)?

Thank you in advance,
Gal

--- End Message ---

Reply via email to