[PHP] Best method to detect Apache, IIS, or CLI?
Hi, what is the best method to detect if a php script is started into Apache, IIS or in a CLI script? I've found several issues, but I am not sure to be right. * CLI: - PHP_SELF='-' - var $argv, $argc exist - constant STDIN, STDOUT, STDERR exist * http server: - PHP_SELF != '-' for ever - $argv, $argc not found (in my apache install) - constant STDIN, STDOUT, STDERR not exist, but they can be defined by someone else * But I don't know between Apache and IIS. Thanks Jean-Pierre
[PHP] PhpMyAdmin and PHP4.2.* Too many I/Os
Hi, I have some troubles with PhpMyAdmin and PHP4.2.* I experimented these couples of installations: PhpMyAdmin / PHP 2.2.6 / 4.1.2 2.2.7pl1 / 4.1.2 2.3.0 / 4.1.2 2.2.6 / 4.2.1 2.2.7pl1 / 4.2.1 2.3.0 / 4.2.1 2.2.6 / 4.2.3 2.2.7pl1 / 4.2.3 2.3.0 / 4.2.3 with MySQL v3.23.49 on RedHat7.2 PhpMyAdmin works perfectly with PHP 4.1.2 but with 4.2.* one http request took more than 10 seconds and the linux box performed a lot of disk I/Os. PHP MySQL extension seems to be changed since v4.2.0 Where is the problem? I want to move to 4.2.3 :( Jean-Pierre ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] foreach, side effect or good behaviour?
Hi, $a=1; $b=&$a; foreach(array(2,3) as $b); echo "a=$a"; // Print a=3 Is it the behaviour expected in a foreach loop? JP ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] $a=1.2; // $a is rounded to 1 Why?
Hi, double variables are rounded as integer but GetType is 'double' $a=10.2; echo get_cfg_var('precision'); // print 14 echo ini_get('precision'); // print 14 echo GetType($a); // print double echo $a; // print 10 I use php 4.1.2 / apache 1.3.24 but I have tried to upgrade to 4.2.3 without success some weeks ago. Jean-Pierre ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Is the $this variable affectation authorized (clean enough)?
Hi, is the $this variable affectation authorized (clean enough)? It's works in 4.1.x, but next php versions... class X { function polymorph($class){ // Backup vars here $this=new $class(); // Restore vars here } } What is the usage? - A (MySQL) table - A class to manage the table - A class by record type $x=new X(); $x->read_record(12); switch($x->type){// Got by read_record case 'X1': case 'X2': $x->polymorph($x->type); break; default: exit(1); } $x->specific_method();// From X1 or X2 class ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_select_db doesn't change db on expected link, bug?
The function mysql_select_db set the db for one or for all link identifiers? The table my_table is in db1 but the active database seems to be test on link #8. Here the result with PHP 4.1.0 and MySQL 3.23.41-log: mysql_pconnect() id1=Resource id #8 mysql_select_db(db1,Resource id #8) mysql_pconnect() id2=Resource id #9 mysql_select_db(test,Resource id #9) mysql_query(select * from my_table,Resource id #8) failed: Table 'test.my_table' doesn't exist Here the source: $id1=mysql_pconnect($host,$user,$pass); if($id1==false){ die("mysql_pconnect() failed: ".mysql_error()); } echo "mysql_pconnect() id1=$id1"; $b=mysql_select_db($db1,$id1); if($b==false){ die("mysql_select_db($db1,$id1) failed: ".mysql_error()); } echo "mysql_select_db($db1,$id1)"; $id2=mysql_pconnect($host,$user,$pass); if($id2==false){ echo "mysql_pconnect() failed: ".mysql_error(); } echo "mysql_pconnect() id2=$id2"; $b=mysql_select_db($db2,$id2); if($b==false){ die("mysql_select_db($db2,$id2) failed: ".mysql_error()); } echo "mysql_select_db($db2,$id2)"; $sql='select * from my_table'; $result=mysql_query($sql,$id1); if($result==false){ die("mysql_query($sql,$id1) failed: ".mysql_error()); } ___ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Courrier : http://courrier.yahoo.fr -- 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] parent::mymethod() call $this->mymethod() bug?
Hi! something looks strange for me. Why the method Fils::x is called? MyConfig: RH7.1 PHP4.0.6 I found something similar in the bug database. http://bugs.php.net/index.php?id=12313 Open 4.0.6 Linux parent resolving and deep require's ## RESULT Fils::Fils called Pere::Pere called Fils::x called Pere::x called ## SOURCE class Pere { function Pere(){ echo "Pere::Pere called"; } function x(){ echo "Pere::x called"; } } class Fils extends Pere { function Fils(){ echo "Fils::Fils called"; $this->Pere(); } function x(){ echo "Fils::x called"; parent::x(); } function y(){ parent::x(); } } $f = new Fils(); $f->x(); ___ Do You Yahoo!? -- Un e-mail gratuit @yahoo.fr ! Yahoo! Courrier : http://fr.mail.yahoo.com -- 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] Why [?php while (true) { sleep(5); } ?] dies on CLI?
Hi! I'm stuck. I don't understand why the php CLI dies after 3 hours in my script. Any idea to solve? Thanks PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr 7 2009 20:06:36) Linux ubuntu 2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 GNU/Linux Conf [php.ini] max_execution_time=0
[PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?
Ashley Sheridan a écrit : On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote: Hi! I'm stuck. I don't understand why the php CLI dies after 3 hours in my script. Any idea to solve? Thanks PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr 7 2009 20:06:36) Linux ubuntu 2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 GNU/Linux Conf [php.ini] max_execution_time=0 The while loop will continue executing until its condition is false. As you've got a boolean true as the condition, it will never end. Thanks Ash www.ashleysheridan.co.uk I don't want to stop, but the process dies. I've tried the same loop with bash interpretor. Same result, it seems to be a ubuntu problem, not a php problem. Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: [Bulk] Re: [PHP] Re: [Bulk] Re: [PHP] Why [?php while (true) { sleep(5); } ?] dies on CLI?
Ashley Sheridan a écrit : On Thu, 2009-06-11 at 20:52 +0200, Jean-Pierre Arneodo wrote: Ashley Sheridan a écrit : On Thu, 2009-06-11 at 10:47 +, Jean-Pierre Arneodo wrote: Hi! I'm stuck. I don't understand why the php CLI dies after 3 hours in my script. Any idea to solve? Thanks PHP 5.2.9-0.dotdeb.2 with Suhosin-Patch 0.9.7 (cli) (built: Apr 7 2009 20:06:36) Linux ubuntu 2.6.24-19-server #1 SMP Wed Jun 18 14:44:47 UTC 2008 x86_64 GNU/Linux Conf [php.ini] max_execution_time=0 The while loop will continue executing until its condition is false. As you've got a boolean true as the condition, it will never end. Thanks Ash www.ashleysheridan.co.uk I don't want to stop, but the process dies. I've tried the same loop with bash interpretor. Same result, it seems to be a ubuntu problem, not a php problem. Thanks Why do you want the process to continue indefinitely? Is it for a daemon of some kind? Thanks Ash www.ashleysheridan.co.uk No, it isn't a daemon, but it does something and wait the end of processing by polling a daemon. # ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 38912 max locked memory (kbytes, -l) 32 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size(512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 8192 cpu time (seconds, -t) unlimited max user processes (-u) 38912 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php