php-general Digest 17 Dec 2009 15:58:27 -0000 Issue 6493

Topics (messages 300555 through 300575):

A strange question about mysql_close()
        300555 by: ÌÆ¼ÒÐË
        300561 by: Richard Quadling
        300562 by: Richard Quadling

Tracking the progress of download
        300556 by: Sam
        300565 by: Angelo Zanetti

A PHP-driven script to determine if the environment is configured correctly 
(checklist)
        300557 by: AmirBehzad Eslami
        300558 by: Sam
        300567 by: Ashley Sheridan

Re: [PHP-WEBMASTER] Class "COM" not found
        300559 by: Hannes Magnusson
        300560 by: Dinesh

Open source project management tool - PHP
        300563 by: Angelo Zanetti
        300564 by: Devendra Jadhav
        300566 by: Daniel González
        300568 by: Ashley Sheridan
        300569 by: Joseph Masoud
        300570 by: Angelo Zanetti
        300572 by: Phpster

RE:bcompiler.so fails to load
        300571 by: Vincent Tumwijukye

Fixe Point Decimal Data type
        300573 by: Raymond Irving
        300574 by: Floyd Resler
        300575 by: LinuxManMikeC

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 want to ask a strange question.

As we know, if we connect a mysql database in the same host twice with the
same username, we won't get two new link, but two handle to only one link.
Then, if I close one of them, whether the other one will be closed together?

I wrote two pieces of code. The first is like this
<?php
$db1 = mysql_connect($host, $username, $pwd);
$db2 = mysql_connect($host, $username, $pwd);
$sql = 'show databases';
mysql_close($db1);
$res = mysql_query($sql, $db2);
$a = mysql_fetch_row($res);
print_r($a);
?>
Then the output of the $db2 is correct. So the $db2 isn't closed together
with the $db1.

But when I add a line among the code, the result is different
<?php
$db1 = mysql_connect($host, $username, $pwd);
$db2 = mysql_connect($host, $username, $pwd);
$sql = 'show databases';
mysql_close($db1);
$db1 = true; //a new line
$res = mysql_query($sql, $db2);
$a = mysql_fetch_row($res);
print_r($a);
?>
Then the output is wrong. The PHP tell me that the link is not a valid one.
I don't know how an assignment operation for the $db1 can close the $db2.
Could someone help me.
I'll appreciate your help.

--- End Message ---
--- Begin Message ---
2009/12/17 唐家兴 <[email protected]>:
> I want to ask a strange question.
>
> As we know, if we connect a mysql database in the same host twice with the
> same username, we won't get two new link, but two handle to only one link.
> Then, if I close one of them, whether the other one will be closed together?
>
> I wrote two pieces of code. The first is like this
> <?php
> $db1 = mysql_connect($host, $username, $pwd);
> $db2 = mysql_connect($host, $username, $pwd);
> $sql = 'show databases';
> mysql_close($db1);
> $res = mysql_query($sql, $db2);
> $a = mysql_fetch_row($res);
> print_r($a);
> ?>
> Then the output of the $db2 is correct. So the $db2 isn't closed together
> with the $db1.
>
> But when I add a line among the code, the result is different
> <?php
> $db1 = mysql_connect($host, $username, $pwd);
> $db2 = mysql_connect($host, $username, $pwd);
> $sql = 'show databases';
> mysql_close($db1);
> $db1 = true; //a new line
> $res = mysql_query($sql, $db2);
> $a = mysql_fetch_row($res);
> print_r($a);
> ?>
> Then the output is wrong. The PHP tell me that the link is not a valid one.
> I don't know how an assignment operation for the $db1 can close the $db2.
> Could someone help me.
> I'll appreciate your help.
>

When you xxx_connect() with the same parameters, internally, you are
sharing the connection. It seems that killing one of the references
kills all the references.

The solution is to a use the fourth parameter on mysql_connect(). The
"new_link" param.

So ...

<?php
$db1 = mysql_connect($host, $username, $pwd, True); // Make sure a new
link is created.
$db2 = mysql_connect($host, $username, $pwd, True); // Make sure a new
link is created.
$sql = 'show databases';
mysql_close($db1);
$db1 = true; //a new line
$res = mysql_query($sql, $db2);
$a = mysql_fetch_row($res);
print_r($a);
?>

should work.

-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
2009/12/17 Richard Quadling <[email protected]>:
> 2009/12/17 唐家兴 <[email protected]>:
>> I want to ask a strange question.
>>
>> As we know, if we connect a mysql database in the same host twice with the
>> same username, we won't get two new link, but two handle to only one link.
>> Then, if I close one of them, whether the other one will be closed together?
>>
>> I wrote two pieces of code. The first is like this
>> <?php
>> $db1 = mysql_connect($host, $username, $pwd);
>> $db2 = mysql_connect($host, $username, $pwd);
>> $sql = 'show databases';
>> mysql_close($db1);
>> $res = mysql_query($sql, $db2);
>> $a = mysql_fetch_row($res);
>> print_r($a);
>> ?>
>> Then the output of the $db2 is correct. So the $db2 isn't closed together
>> with the $db1.
>>
>> But when I add a line among the code, the result is different
>> <?php
>> $db1 = mysql_connect($host, $username, $pwd);
>> $db2 = mysql_connect($host, $username, $pwd);
>> $sql = 'show databases';
>> mysql_close($db1);
>> $db1 = true; //a new line
>> $res = mysql_query($sql, $db2);
>> $a = mysql_fetch_row($res);
>> print_r($a);
>> ?>
>> Then the output is wrong. The PHP tell me that the link is not a valid one.
>> I don't know how an assignment operation for the $db1 can close the $db2.
>> Could someone help me.
>> I'll appreciate your help.
>>
>
> When you xxx_connect() with the same parameters, internally, you are
> sharing the connection. It seems that killing one of the references
> kills all the references.
>
> The solution is to a use the fourth parameter on mysql_connect(). The
> "new_link" param.
>
> So ...
>
> <?php
> $db1 = mysql_connect($host, $username, $pwd, True); // Make sure a new
> link is created.
> $db2 = mysql_connect($host, $username, $pwd, True); // Make sure a new
> link is created.
> $sql = 'show databases';
> mysql_close($db1);
> $db1 = true; //a new line
> $res = mysql_query($sql, $db2);
> $a = mysql_fetch_row($res);
> print_r($a);
> ?>
>
> should work.
>

http://docs.php.net/mysql_connect


-- 
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

--- End Message ---
--- Begin Message ---
Hello to all!
Who  knows  how  to  track  the progress of the download using PHP and
JavaScript?  I  have  a  script  that  downloads  file from net to the
server,  and  I  want  to  the  process  including  the  speed  to the
clientside. How can I do that?

Best regards,
Sam


--- End Message ---
--- Begin Message ---
-----Original Message-----
From: Sam [mailto:[email protected]] 
Sent: 17 December 2009 08:13 AM
To: [email protected]
Subject: [PHP] Tracking the progress of download

Hello to all!
Who  knows  how  to  track  the progress of the download using PHP and
JavaScript?  I  have  a  script  that  downloads  file from net to the
server,  and  I  want  to  the  process  including  the  speed  to the
clientside. How can I do that?

Best regards,
Sam

Hi Sam, 

Not sure if its possible but I know that you can perhaps use Ajax to do the
upload then they have a percentage indicator. Just google.

Regards
Angelo

http://www.wapit.co.za
http://www.elemental.co.za


--- End Message ---
--- Begin Message ---
Dear list,
e-Greetings,

I've developed some PHP-driven web applications. These applications will be
installed on different
linux-based servers (typically Debian and Redhat). Usually, after I copy the
files to the
server, they DO NOT WORK, so I spend hours to debug the problem. Problems
are very funny,
for example, the program is giving strange errors, and it is not working
because "short_open_tags" are off !

I decided to write a PHP script to check if server's configuration meets my
requirements.
- checking whether some php extensions are loaded, eg. MCrypt.
- checking wheather short_open_tags is ON
- checking whether mod_rewrite is enabled
- etc.

Here's my question:

- How do you check if .htaccess is working, *** via php code *** ?
It's easy to check if .htaccess exists (@php: file_exists), but how to make
sure if .htaccess is working?!
- How do you check if AllowOverride is set to All in apache's configuration?

Please let me know what do you think. Thank you in advance.
-behzad

--- End Message ---
--- Begin Message ---
Здравствуйте, AmirBehzad.

Вы писали 17 декабря 2009 г., 17:46:59:

> Dear list,
> e-Greetings,

> I've developed some PHP-driven web applications. These applications will be
> installed on different
> linux-based servers (typically Debian and Redhat). Usually, after I copy the
> files to the
> server, they DO NOT WORK, so I spend hours to debug the problem. Problems
> are very funny,
> for example, the program is giving strange errors, and it is not working
> because "short_open_tags" are off !

> I decided to write a PHP script to check if server's configuration meets my
> requirements.
> - checking whether some php extensions are loaded, eg. MCrypt.
> - checking wheather short_open_tags is ON
> - checking whether mod_rewrite is enabled
> - etc.

> Here's my question:

> - How do you check if .htaccess is working, *** via php code *** ?
> It's easy to check if .htaccess exists (@php: file_exists), but how to make
> sure if .htaccess is working?!
> - How do you check if AllowOverride is set to All in apache's configuration?

> Please let me know what do you think. Thank you in advance.
> -behzad

Make sure that you did your scripts executable(chmod +x)
You can check .htaccess that way:
create  .htaccess  if folder with script, override some directive thru
it, like php's max execution time.
then    create    php    script,    get    php   value   that   you've
changed(max_execution_time),   compare   to  the  value  you  gave  in
.htaccess, if values are the same, .htaccess is working!


-- 
 Sam


--- End Message ---
--- Begin Message ---
On Thu, 2009-12-17 at 17:55 +1000, Sam wrote:

> Здравствуйте, AmirBehzad.
> 
> Вы писали 17 декабря 2009 г., 17:46:59:
> 
> > Dear list,
> > e-Greetings,
> 
> > I've developed some PHP-driven web applications. These applications will be
> > installed on different
> > linux-based servers (typically Debian and Redhat). Usually, after I copy the
> > files to the
> > server, they DO NOT WORK, so I spend hours to debug the problem. Problems
> > are very funny,
> > for example, the program is giving strange errors, and it is not working
> > because "short_open_tags" are off !
> 
> > I decided to write a PHP script to check if server's configuration meets my
> > requirements.
> > - checking whether some php extensions are loaded, eg. MCrypt.
> > - checking wheather short_open_tags is ON
> > - checking whether mod_rewrite is enabled
> > - etc.
> 
> > Here's my question:
> 
> > - How do you check if .htaccess is working, *** via php code *** ?
> > It's easy to check if .htaccess exists (@php: file_exists), but how to make
> > sure if .htaccess is working?!
> > - How do you check if AllowOverride is set to All in apache's configuration?
> 
> > Please let me know what do you think. Thank you in advance.
> > -behzad
> 
> Make sure that you did your scripts executable(chmod +x)
> You can check .htaccess that way:
> create  .htaccess  if folder with script, override some directive thru
> it, like php's max execution time.
> then    create    php    script,    get    php   value   that   you've
> changed(max_execution_time),   compare   to  the  value  you  gave  in
> .htaccess, if values are the same, .htaccess is working!
> 
> 
> -- 
>  Sam
> 
> 

I'd advise against using short PHP tags, as they cause all sorts of
problems with outputting XML-based code, and as you've seen, it's
doesn't make your code very portable. For the sake of a few keystrokes,
is it really worth it? Also, I believe they are being phased out as of
PHP6, so it might be time to think about updating your code a bit!

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message ---
(moving to [email protected], please reply-to-all if you have
more questions)

DBus would be the only extension that comes close to what the COM
extension does on windows.
See http://pecl.php.net/package/DBus

There are currently no documentations (and apparently no releases?)
but you can check it out from SVN and compile it yourself.
There are lot of examples in the examples directory, and there have
been several presentations about the subject which you can search for.

-Hannes

On Thu, Dec 17, 2009 at 10:00, Dinesh <[email protected]> wrote:
> Ok. I got it that COM will work only in windows environment. What function
> needs to be called to access linux components?
>
> Regards
> Dinesh
>
> --------------------------------------------------
> From: "Hannes Magnusson" <[email protected]>
> Sent: Thursday, December 17, 2009 2:08 PM
> To: "Dinesh" <[email protected]>
> Cc: "php-webmaster" <[email protected]>
> Subject: Re: [PHP-WEBMASTER] Class "COM" not found
>
>> On Thu, Dec 17, 2009 at 08:31, Dinesh <[email protected]> wrote:
>>>
>>> Hi,
>>>
>>> I am getting the following error when I tried to run this code in PHP
>>> "$Obj = new COM("PDFTextStamp.PDFTextStampCom");" using CLI method
>>>
>>> "PHP Fatal error: Class 'COM' not found in /root/TAP3/taptest.php on line
>>> 2"
>>>
>>> Can you please help me in fixing this issue?
>>
>> http://no2.php.net/manual/en/com.requirements.php
>>
>> -Hannes
>>
>

--- End Message ---
--- Begin Message ---
Thanks. Will try using that.

Dinesh

--------------------------------------------------
From: "Hannes Magnusson" <[email protected]>
Sent: Thursday, December 17, 2009 2:44 PM
To: "Dinesh" <[email protected]>
Cc: "php-general" <[email protected]>
Subject: Re: [PHP-WEBMASTER] Class "COM" not found

(moving to [email protected], please reply-to-all if you have
more questions)

DBus would be the only extension that comes close to what the COM
extension does on windows.
See http://pecl.php.net/package/DBus

There are currently no documentations (and apparently no releases?)
but you can check it out from SVN and compile it yourself.
There are lot of examples in the examples directory, and there have
been several presentations about the subject which you can search for.

-Hannes

On Thu, Dec 17, 2009 at 10:00, Dinesh <[email protected]> wrote:
Ok. I got it that COM will work only in windows environment. What function
needs to be called to access linux components?

Regards
Dinesh

--------------------------------------------------
From: "Hannes Magnusson" <[email protected]>
Sent: Thursday, December 17, 2009 2:08 PM
To: "Dinesh" <[email protected]>
Cc: "php-webmaster" <[email protected]>
Subject: Re: [PHP-WEBMASTER] Class "COM" not found

On Thu, Dec 17, 2009 at 08:31, Dinesh <[email protected]> wrote:

Hi,

I am getting the following error when I tried to run this code in PHP
"$Obj = new COM("PDFTextStamp.PDFTextStampCom");" using CLI method

"PHP Fatal error: Class 'COM' not found in /root/TAP3/taptest.php on line
2"

Can you please help me in fixing this issue?

http://no2.php.net/manual/en/com.requirements.php

-Hannes




--- End Message ---
--- Begin Message ---
Hi guys 

I would like to know what open source project management tools you use for
your projects.

We are looking at installing one that is PHP based and is easy to use.

We have found: 

http://www.projectpier.org/

and

http://trac.edgewall.org/


Has anyone used the above and how did you find them? Also are there any
others you would recommend or not recommend and why?

Thanks in advance.

Regards
Angelo

http://www.wapit.co.za
http://www.elemental.co.za 




--- End Message ---
--- Begin Message ---
Mantis for bug tracking...

On Thu, Dec 17, 2009 at 3:54 PM, Angelo Zanetti <[email protected]>wrote:

> Hi guys
>
> I would like to know what open source project management tools you use for
> your projects.
>
> We are looking at installing one that is PHP based and is easy to use.
>
> We have found:
>
> http://www.projectpier.org/
>
> and
>
> http://trac.edgewall.org/
>
>
> Has anyone used the above and how did you find them? Also are there any
> others you would recommend or not recommend and why?
>
> Thanks in advance.
>
> Regards
> Angelo
>
> http://www.wapit.co.za
> http://www.elemental.co.za
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Devendra Jadhav
देवेंद्र जाधव

--- End Message ---
--- Begin Message ---
redmine!

2009/12/17 Devendra Jadhav <[email protected]>

> Mantis for bug tracking...
>
> On Thu, Dec 17, 2009 at 3:54 PM, Angelo Zanetti <[email protected]
> >wrote:
>
> > Hi guys
> >
> > I would like to know what open source project management tools you use
> for
> > your projects.
> >
> > We are looking at installing one that is PHP based and is easy to use.
> >
> > We have found:
> >
> > http://www.projectpier.org/
> >
> > and
> >
> > http://trac.edgewall.org/
> >
> >
> > Has anyone used the above and how did you find them? Also are there any
> > others you would recommend or not recommend and why?
> >
> > Thanks in advance.
> >
> > Regards
> > Angelo
> >
> > http://www.wapit.co.za
> > http://www.elemental.co.za
> >
> >
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Devendra Jadhav
> देवेंद्र जाधव
>



-- 
---------------------------------------------------------
Daniel González Cerviño
FreelanceMadrid.es
Mail : [email protected]
Tel (+34)  653 96 50 48
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
On Thu, 2009-12-17 at 12:24 +0200, Angelo Zanetti wrote:

> Hi guys 
> 
> I would like to know what open source project management tools you use for
> your projects.
> 
> We are looking at installing one that is PHP based and is easy to use.
> 
> We have found: 
> 
> http://www.projectpier.org/
> 
> and
> 
> http://trac.edgewall.org/
> 
> 
> Has anyone used the above and how did you find them? Also are there any
> others you would recommend or not recommend and why?
> 
> Thanks in advance.
> 
> Regards
> Angelo
> 
> http://www.wapit.co.za
> http://www.elemental.co.za 
> 
> 
> 
> 


If it's open source project management software you're looking for, then
I've found openproj and planner to be pretty good.

However, I noticed that the links you gave seem to be more focused on
task management, which is slightly different from project management.

Thanks,
Ash
http://www.ashleysheridan.co.uk



--- End Message ---
--- Begin Message --- On 17 Dec 2009, at 10:24, "Angelo Zanetti" <[email protected]> wrote:

Hi guys

I would like to know what open source project management tools you use for
your projects.

We are looking at installing one that is PHP based and is easy to use.

We have found:

http://www.projectpier.org/

and

http://trac.edgewall.org/


Has anyone used the above and how did you find them? Also are there any
others you would recommend or not recommend and why?

Thanks in advance.

Regards
Angelo

http://www.wapit.co.za
http://www.elemental.co.za




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

Trac is not actually PHP based, it is coded in Python. I used it for roughly 2 months before jumping ship. There was nothing wrong with it. I simply found a more suitable solution for my projects.

I use Eventum for bug tracking. It's the system the MySQL development team use. It uses PHP and MySQL as standard. Took me under 15 minutes to set it up (after reading the manual). I didn't have any set- up problems.

For source control, I recommend you consider implementing a continuous integration platform like cruise control for PHP.

For team communications, the non-technical staff were significantly happier using Elgg (an open source social networking platform) over the Trac wiki and MoinMoin wiki.
--- End Message ---
--- Begin Message ---

-----Original Message-----
From: Ashley Sheridan [mailto:[email protected]] 
Sent: 17 December 2009 02:03 PM
To: Angelo Zanetti
Cc: [email protected]
Subject: Re: [PHP] Open source project management tool - PHP

On Thu, 2009-12-17 at 12:24 +0200, Angelo Zanetti wrote:

> Hi guys 
> 
> I would like to know what open source project management tools you use for
> your projects.
> 
> We are looking at installing one that is PHP based and is easy to use.
> 
> We have found: 
> 
> http://www.projectpier.org/
> 
> and
> 
> http://trac.edgewall.org/
> 
> 
> Has anyone used the above and how did you find them? Also are there any
> others you would recommend or not recommend and why?
> 
> Thanks in advance.
> 
> Regards
> Angelo
> 
> http://www.wapit.co.za
> http://www.elemental.co.za 
> 
> 
> 
> 


If it's open source project management software you're looking for, then
I've found openproj and planner to be pretty good.

However, I noticed that the links you gave seem to be more focused on
task management, which is slightly different from project management.

Thanks,
Ash
http://www.ashleysheridan.co.uk

Thanks Ashley, 

Its not just project managing but I want non technical staff to use the
system so we can track progress of tasks and allocate issues / items to
people.

Anyways thanks for the info on open proj, will check it out.

Cheers
Angelo



--- End Message ---
--- Begin Message ---
Using projectpier and have no complaints yet.

Bastien

Sent from my iPod

On Dec 17, 2009, at 5:24 AM, "Angelo Zanetti" <[email protected]> wrote:

Hi guys

I would like to know what open source project management tools you use for
your projects.

We are looking at installing one that is PHP based and is easy to use.

We have found:

http://www.projectpier.org/

and

http://trac.edgewall.org/


Has anyone used the above and how did you find them? Also are there any
others you would recommend or not recommend and why?

Thanks in advance.

Regards
Angelo

http://www.wapit.co.za
http://www.elemental.co.za




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


--- End Message ---
--- Begin Message ---
Dear Team, I have successfully installed  bcompiler-0.9.1 from
http://pecl.php.net but apache fails to upload it. I am using PHP 5.3.0,
SUSE 11.2, apache2.2.13.

Below is the error message generated by apache
[
PHP Warning:  PHP Startup: Unable to load dynamic library
'/usr/lib/php5/extensions/bcompiler.so' -
/usr/lib/php5/extensions/bcompiler.so: undefined symbol: free_zend_constant
in Unknown on line 0

]

Could some one kindly give me a clue on how I could get around this?

-- 
Tumwijukye Vincent
Chief Executive Officer
Future Link Technologies
Plot 17 Bukoto Street,
P. O. BOX 14697,
KAMPALA - UGANDA
Tel: +256(0)774638790
Off:+256(0)41531274
Website: www.fl-t.com, www.savingsplus.info

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

Is there a way to represent numeric values as fixed point decimals in PHP? If 
not, why was this datatype not added?

I think is very important to have fixed point decimals when working with money 
values. This would make it much easy than having to use the BCMath functions. 

If PHP had support for operator overloading then we could have easily 
implemented this datatype as a class:

$a = new FixPoint(34.56, 2);
$b = new FixPoint(34.55, 2);

$c = $a-$b;
echo ($c);

$c+= 3;
echo $c;

--- End Message ---
--- Begin Message ---
I may be over-simplifying or not completely understanding fixed point decimals, 
but would number_format work?

Take care,
Floyd

On Dec 17, 2009, at 9:21 AM, Raymond Irving wrote:

> Hello,
> 
> Is there a way to represent numeric values as fixed point decimals in PHP? If 
> not, why was this datatype not added?
> 
> I think is very important to have fixed point decimals when working with 
> money values. This would make it much easy than having to use the BCMath 
> functions. 
> 
> If PHP had support for operator overloading then we could have easily 
> implemented this datatype as a class:
> 
> $a = new FixPoint(34.56, 2);
> $b = new FixPoint(34.55, 2);
> 
> $c = $a-$b;
> echo ($c);
> 
> $c+= 3;
> echo $c;


--- End Message ---
--- Begin Message ---
On Thu, Dec 17, 2009 at 7:49 AM, Floyd Resler <[email protected]> wrote:
> I may be over-simplifying or not completely understanding fixed point 
> decimals, but would number_format work?
>
> Take care,
> Floyd
>

Over-simplifying just a touch...
http://en.wikipedia.org/wiki/Floating_point_error#Accuracy_problems

--- End Message ---

Reply via email to