php-general Digest 5 Oct 2005 21:16:40 -0000 Issue 3721
php-general Digest 5 Oct 2005 21:16:40 - Issue 3721 Topics (messages 223638 through 223664): query regerding copying files using php 223638 by: Suresh Pandian 223643 by: Jochem Maas Re: Session object destruction failed 223639 by: Dan Rossi 223640 by: Dan Rossi 223644 by: Dan Rossi Re: php.ini magic quotes 223641 by: Jochem Maas Re: possibly buffer problem, including a bit of code this time 223642 by: Jochem Maas Global unavailable? 223645 by: Marcus Bointon 223647 by: Jochem Maas 223649 by: Marcus Bointon 223650 by: Jochem Maas is_subclass_of() weird behaviour with APC 223646 by: ogrange.gmail.com 223648 by: Jochem Maas 223662 by: ogrange.gmail.com Re: Handling competing edits in a wiki engine? 223651 by: Skippy 223658 by: Niels Ganser 223659 by: Jochem Maas caching parsed XML files as DOM objects in memory 223652 by: Petr Smith Php is not writing errors in logfile 223653 by: Jacob Friis Saxberg 223654 by: Skippy 223655 by: Jacob Friis Saxberg 223656 by: Jacob Friis Saxberg 223657 by: Jacob Friis Saxberg sessions 223660 by: blackwater dev 223661 by: Jochem Maas Possible bug in array_diff() php v4.4.0 or at least some odd behavior 223663 by: Edward Vermillion Scripts not working outside of Zend Studio 223664 by: Steve Harp 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: php-general@lists.php.net -- ---BeginMessage--- hello friends, i have a query in writng the content of one file to another. i attempted it. it only writes the html codings.it could not write the php scripts inside the file. i use the following code to accomplish my problem... ## if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } $source = file_get_contents('-.php'); $tokens = token_get_all($source); foreach ($tokens as $token) { if (is_string($token)) { // simple 1-character token $ourFileName = /home/itempla1/public_html/links/.$pwd..php; $ourFileHandle = fopen($ourFileName, 'w') or die(can't open file); echo $token; fwrite($ourFileHandle, $token); fclose($ourFileHandle); } else { // token array list($id, $text) = $token; switch ($id) { case T_COMMENT: case T_ML_COMMENT: // we've defined this case T_DOC_COMMENT: // and this // no action on comments break; default: // anything else - output as is $ourFileName = /home/itempla1/public_html/links/.$pwd..php; $ourFileHandle = fopen($ourFileName, 'a') or die(can't open file); echo $text; fwrite($ourFileHandle, $text); fclose($ourFileHandle); break; } } } ? please give me some valuable tips to write the content of the php file to another newly created php file. Thanks, Suresh.P - Yahoo! India Matrimony: Find your partner online.---End Message--- ---BeginMessage--- Suresh Pandian wrote: hello friends, i have a query in writng the content of one file to another. i attempted it. it only writes the html codings.it could not write the php scripts inside the file. Suresh - it helps if you desribe what you are trying to achieve _and_ why, this is because there maybe completely other ways to do what you want, which people can only suggest if they have an idea of why you aer trying to do something. anyway it looks like you are trying to strip comments from your php files i use the following code to accomplish my problem... ## if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } $source = file_get_contents('-.php'); funny filename. $tokens = token_get_all($source); foreach ($tokens as $token) { if (is_string($token)) { // simple 1-character token $ourFileName = /home/itempla1/public_html/links/.$pwd..php; $ourFileHandle = fopen($ourFileName, 'w') or die(can't open file); I have a sneaking suspicion that if you changed the above line to: $ourFileHandle = fopen($ourFileName, 'a') or die(can't open file); things will start to work as you expect them. (notice your currently opening it as 'write only' which truncates the file to zero bytes) also it seems a bit wasteful to keep opening/closing this file handle
[PHP] session_destroy(): Session object destruction failed
hi there, i had asked this one a while ago but no replies. I am having this issue calling session_destroy on a non cookie session before creating a cookie based one. Here is the code @session_destroy(); ini_set('session.use_cookies', 1); session_name('thename'); session_cache_limiter('no_cache'); session_cache_expire(172800); session_set_cookie_params (172800, '/', 'thedomain',0); session_start(); ini_set('session.gc_maxlifetime',172800); lemme know thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_destroy(): Session object destruction failed
:| The php compile error was the subject thats what keeps being triggered and i get emails from my system about. Session object destruction failed. I have googled about this yes it was something to do with the session_set_cookie after session destroy which triggers this but no fix. On 05/10/2005, at 5:14 PM, [EMAIL PROTECTED] wrote: hi there, i had asked this one a while ago but no replies. I am having this issue calling session_destroy on a non cookie session before creating a cookie based one. Here is the code @session_destroy(); ini_set('session.use_cookies', 1); session_name('thename'); session_cache_limiter('no_cache'); session_cache_expire(172800); session_set_cookie_params (172800, '/', 'thedomain',0); session_start(); ini_set('session.gc_maxlifetime',172800); lemme know thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi there! What is the question / problem? /G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: php.ini magic quotes
hey Jay, did you figure out your ini/quotes problem? Jochem Maas wrote: Jay Blanchard wrote: Everyday I scratch my head. In php.ini in the C:\WINNT it is said; ; Magic quotes for incoming GET/POST/Cookie data. magic_quotes_gpc = Off ; Magic quotes for runtime-generated data, e.g. data from SQL, from exec(), etc. magic_quotes_runtime = Off In phpinfo() it is said; where does it say it read the ini file from? is there a .htaccess equivelant setting somewhere in the ISS server [your new job in a windows shop] turning magic_quotes_gpc on (for the given 'vhost')? (I use apache terminology - I trust your savvy enough to translate them to ISSspeak :-) magic_quotes_gpc On On magic_quotes_runtime Off Off [note the disparity] and get_magic_quotes_gpc() returns a 1 (for 'on') I am having a helluva time escaping single quotes for use with MSSQL because it throws the following error SELECT EPC, Owner, Location, Application, Process, Product, Purchased, Comments FROM intranet.dbo.CustomerRelations WHERE Purchased = '1990\'\'s' ORDER BY EPC DESC Filter=PurchasedFilterKey=1990\'\'s --$_SERVER['QUERY_STRING'] 1 --get_magic_quotes_gpc Warning: odbc_exec(): SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'., SQL state 37000 in SQLExecDirect in E:\fubar\iamscrewed\windowsblows\index.php on line 51 [Microsoft][ODBC SQL Server Driver][SQL Server]Line 1: Incorrect syntax near '\'. Slashes are being inserted during the post, but i cannot get them to go can you so a hack with 'magic_quotes_sybase' ini setting? (turn it on) see here: http://nl2.php.net/sybase away...stripslashes doesn;t work.can anyone help me get rid of the what exactly isn't working? something like this does do it for you?: /** * array_stripslashes() * * stripsslashes from each value found in the given array, * and recurses if a value is itself an array. * this function is used to 'transform' request superglobals into * 'form' that is consistent regardless of server settings. (magic quotes, etc) * * @return array() */ function array_stripslashes($array) { if(!is_array($array)); while (list($key) = @each($array)) { if (is_array($array[$key])) { array_stripslashes($array[$key]); } else { $array[$key] = stripslashes($array[$key]); } } } /* setup the env the way we like it. */ set_magic_quotes_runtime(0);// Disable magic_quotes_runtime if (get_magic_quotes_gpc()) { // stripslashes if they were auto added array_stripslashes( $_POST ); array_stripslashes( $_GET ); array_stripslashes( $_REQUEST ); array_stripslashes( $_COOKIES ); array_stripslashes( $_HTTP_POST_VARS); array_stripslashes( $_HTTP_GET_VARS ); array_stripslashes( $_HTTP_COOKIES_VARS ); } slashes? Or should I just go for a nice motorcycle ride in the Hill Country? If you have hills I'd say take an mtb. :-) I like mtb'ing - but I live in a country -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] possibly buffer problem, including a bit of code this time
matt VanDeWalle wrote: oops, sorry about the lack of any code with my last problem message. ok this is a start, still your descriptions assume too much - remember no on this list knows you or your code - you must be very explicit (the more you are the better the help people can give) I am still having the same buffer problem where after asking for a password, it doesn't stop and wait, just falling through to the next prompt. here is basically what the new_user function looks like. I am using php 4.3.10 on slackware 10.1 /* the new user function */ function new_user($sock, $username) { global $cdata; /* shorthand of socket_write is now send_single */ now this is not my area of 'expertise' ... just thinking out loud really: so send_single() is a function written by you? as a wrapper to socket_write()? do all 3 prompts (as sent by send_single()) show up on the screen when you connect? at what point do they appear exactly. I assume you have used copious ammounts of the following functions in order to try to determine the problem?: socket_last_error() socket_strerror() also have you tried using: http://nl2.php.net/manual/en/function.socket-recv.php instead of socket_read()? send_single($sock, please type the username you would like to go by ); $username = socket_read($sock, 1024, PHP_NORMAL_READ); /* i had to change to PHP_NORMAL_READ or else windows users couldnt get on with more than 1 char */ $username = trim($username); /* now comes the problem as far as i'm seeing it program execution-wise */ send_single($sock, please choose a password); $pwd = socket_read($sock, 1024, PHP_NORMAL_READ); $passwd = trim($pwd); send_single($sock, email address to send your signup info); $email = socket_read($sock, 1024, PHP_NORMAL_READ); $email = trim($email); /* do rest of function like fill array and write userfile etc */ .. } ok: as far as i can tell, it asks for the password, skips that, and goes right onto the prompt that asks for the email address (totally skips that as well), and proceeds to fill the array and write the file and then log the user on, so of course half of the array variables seem to be blank and the file doesn't contain the password or email) obviously I'm doing something wrong but what? matt ps, hope that is enough of the code to tell -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] query regerding copying files using php
Suresh Pandian wrote: hello friends, i have a query in writng the content of one file to another. i attempted it. it only writes the html codings.it could not write the php scripts inside the file. Suresh - it helps if you desribe what you are trying to achieve _and_ why, this is because there maybe completely other ways to do what you want, which people can only suggest if they have an idea of why you aer trying to do something. anyway it looks like you are trying to strip comments from your php files i use the following code to accomplish my problem... ## if (!defined('T_ML_COMMENT')) { define('T_ML_COMMENT', T_COMMENT); } else { define('T_DOC_COMMENT', T_ML_COMMENT); } $source = file_get_contents('-.php'); funny filename. $tokens = token_get_all($source); foreach ($tokens as $token) { if (is_string($token)) { // simple 1-character token $ourFileName = /home/itempla1/public_html/links/.$pwd..php; $ourFileHandle = fopen($ourFileName, 'w') or die(can't open file); I have a sneaking suspicion that if you changed the above line to: $ourFileHandle = fopen($ourFileName, 'a') or die(can't open file); things will start to work as you expect them. (notice your currently opening it as 'write only' which truncates the file to zero bytes) also it seems a bit wasteful to keep opening/closing this file handle everytime you want to write something. myabe you should consider to open/close the file just once (outside the loop) echo $token; fwrite($ourFileHandle, $token); fclose($ourFileHandle); } else { // token array list($id, $text) = $token; switch ($id) { case T_COMMENT: case T_ML_COMMENT: // we've defined this case T_DOC_COMMENT: // and this // no action on comments break; default: // anything else - output as is $ourFileName = /home/itempla1/public_html/links/.$pwd..php; $ourFileHandle = fopen($ourFileName, 'a') or die(can't open file); echo $text; fwrite($ourFileHandle, $text); fclose($ourFileHandle); break; } } } ? please give me some valuable tips to write the content of the php file to another newly created php file. Thanks, Suresh.P - Yahoo! India Matrimony: Find your partner online. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_destroy(): Session object destruction failed
All standard apache/php4 stuff. The first session is a non cookie session ini_set('session.use_cookies', 0); session_name('sID'); session_start(); ini_set('session.gc_maxlifetime', 14440); ill attempt the sleep(1) i guess On 05/10/2005, at 6:36 PM, [EMAIL PROTECTED] wrote: Hi there! Are you running IIS? It seems to be a IIS-specific program when googling... Here is My thoughts: Can the problem be that session_use_cookies initate before all sessions are totally destroyed? Does the code work with only session_destroy() ? I would try to set a sleep - statement after session_destroy() and see if it is any difference.. /G :| The php compile error was the subject thats what keeps being triggered and i get emails from my system about. Session object destruction failed. I have googled about this yes it was something to do with the session_set_cookie after session destroy which triggers this but no fix. On 05/10/2005, at 5:14 PM, [EMAIL PROTECTED] wrote: hi there, i had asked this one a while ago but no replies. I am having this issue calling session_destroy on a non cookie session before creating a cookie based one. Here is the code @session_destroy(); ini_set('session.use_cookies', 1); session_name('thename'); session_cache_limiter('no_cache'); session_cache_expire(172800); session_set_cookie_params (172800, '/', 'thedomain',0); session_start(); ini_set('session.gc_maxlifetime',172800); lemme know thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Hi there! What is the question / problem? /G -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Global unavailable?
I have a simple situation: in a.inc.php: $a = 1; in b.class.php require 'a.inc.php'; class b { function test() { global $a; echo $a; } } With this pattern, $a is NOT visible within class b, even though it is declared in the global scope and I'm using the global keyword! I can work around it two ways; by changing the original declaration (which just seems wrong - it's already in the global scope at this point): global $a; $a = 1; or by requiring the inc file inside each function of b (much less efficient): class b { function test() { require 'a.inc.php'; global $a; echo $a; } } Is this just how it is, or am I doing something wrong? Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] is_subclass_of() weird behaviour with APC
Hello, I posted to pecl-dev but got no reply. I'm sorry if you already read this message on pecl-dev. I'm experiencing strange behaviour with APC. We use the famous trick to simulate an abstract class in PHP 4 using is_subclass_of(), as in : class Object { // properties... function Object() { if (!is_subclass_of($this, Object)) { die(Cannot instantiate Object); } // etc } // methods... } and then : require_once('Object.php'); class User extends Object { // more properties... function User () { Object::Object(); // etc } // more methods... } This works fine without APC. However, with APC, in some cases, is_subclass_of($this, Object)) returns false, instead of true. We experienced it with two different (not sharing code) applications. Ironically, I haven't been able to reproduce the bug on the first application, which is also the simplest, but I can reproduce it in the second one (which is pretty large). Context : Redhat 7.3 + all Fedora Legacy patches (2.4.20-43.7.legacy) Apache 1.3.33 PHP : 4.4.0 as a DSO APC : 3.0.8 gcc version 2.96 2731 (Red Hat Linux 7.3 2.96-113) APC was installed with export PATH=/path/to/apache/bin/ ; pear install APC and enabled with extension = ./apc.so in php.ini, no apc.* directives were added. I accepted default choices during the installation so it uses mmap. I get the same bug with APC pulled from CVS. While investigating, I added in Object constructor some code to log more information : var_dump($this) and get_class($this) correctly showed $this was of class user and at the same time is_subclass_of($this, 'Object') returned false, which is incoherent. I wish I could reproduce the problem with a small amount of code so that I could open a real bug report but I failed to do so for now and have the bad feeling I could spend days on this, eventually with no success 8-( Has anyone experienced similar problems ? I couldn't find any information. Thanks a lot, Olivier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global unavailable?
Marcus Bointon wrote: I have a simple situation: in a.inc.php: $a = 1; in b.class.php require 'a.inc.php'; class b { function test() { global $a; echo $a; } } With this pattern, $a is NOT visible within class b, even though it is declared in the global scope and I'm using the global keyword! I can work around it two ways; by changing the original declaration (which just seems wrong - it's already in the global scope at this point): global $a; $a = 1; if changing the declaration in a.inc.php fixes it then you must NOT be including b.inc.php form the global scope. which means $a will not be in the global scope unless you tell php to put it there, instead $a is probably part of a function scope. e.g. you have a function like so: function getNewBee() { require_once('b.inc.php'); $b = new b; return $b; } in the above $a lives in the scope of the function call to getNewBee() and NOT in the global scope. or by requiring the inc file inside each function of b (much less efficient): class b { function test() { require 'a.inc.php'; doing it like this means you don't need to specify $a as 'global' - its already in the scope of the current function (method), specifying it as 'global' will make it available everywhere though. global $a; echo $a; } } Is this just how it is, or am I doing something wrong? Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_subclass_of() weird behaviour with APC
[EMAIL PROTECTED] wrote: Hello, I posted to pecl-dev but got no reply. I'm sorry if you already read this message on pecl-dev. I'm experiencing strange behaviour with APC. We use the famous trick to simulate an abstract class in PHP 4 using is_subclass_of(), as in : class Object { // properties... function Object() { if (!is_subclass_of($this, Object)) { could it be a case-sensitivity problem (within APC) so that maybe this does work?: if (!is_subclass_of($this, object)) die(Cannot instantiate Object); } // etc } // methods... } and then : require_once('Object.php'); class User extends Object { // more properties... function User () { Object::Object(); // etc } // more methods... } This works fine without APC. However, with APC, in some cases, is_subclass_of($this, Object)) returns false, instead of true. We experienced it with two different (not sharing code) applications. Ironically, I haven't been able to reproduce the bug on the first application, which is also the simplest, but I can reproduce it in the second one (which is pretty large). Context : Redhat 7.3 + all Fedora Legacy patches (2.4.20-43.7.legacy) Apache 1.3.33 PHP : 4.4.0 as a DSO APC : 3.0.8 gcc version 2.96 2731 (Red Hat Linux 7.3 2.96-113) APC was installed with export PATH=/path/to/apache/bin/ ; pear install APC and enabled with extension = ./apc.so in php.ini, no apc.* directives were added. I accepted default choices during the installation so it uses mmap. I get the same bug with APC pulled from CVS. While investigating, I added in Object constructor some code to log more information : var_dump($this) and get_class($this) correctly showed $this was of class user and at the same time is_subclass_of($this, 'Object') returned false, which is incoherent. I wish I could reproduce the problem with a small amount of code so that I could open a real bug report but I failed to do so for now and have the bad feeling I could spend days on this, eventually with no success 8-( Has anyone experienced similar problems ? I couldn't find any information. Thanks a lot, Olivier -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global unavailable?
On 5 Oct 2005, at 13:37, Jochem Maas wrote: if changing the declaration in a.inc.php fixes it then you must NOT be including b.inc.php form the global scope. Well, that's what I thought, but it just isn't! The include really is in the global scope outside any class or function definition. The original definition is directly inside the included file, and not itself inside a function or class. I should have mentioned that I'm using PHP 5.1-dev, so it could just be bug... Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Global unavailable?
Marcus Bointon wrote: On 5 Oct 2005, at 13:37, Jochem Maas wrote: if changing the declaration in a.inc.php fixes it then you must NOT be including b.inc.php form the global scope. Well, that's what I thought, but it just isn't! The include really is in the global scope outside any class or function definition. The original definition is directly inside the included file, and not itself inside a function or class. I should have mentioned that I'm using PHP 5.1-dev, so it could just be bug... if its not what I said it might be then you may very well be looking at a bug - personally I'd wait with 5.1 until its been hammered some more and has stabilized a bit more (still plenty going on there!) can you verify that 5.0.4 displays the same behaviour? Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling competing edits in a wiki engine?
Quoting Silvio Porcellana [EMAIL PROTECTED]: Ok, I don't know if this makes much sense, but you end up with a script that gets executed (without user interaction) every 'n' microseconds, so your session data is always up to date (at maximum, with a delay of 'n' * 2 microseconds). You'd have to take into account the round-trip to the server and back. I'd say that on average we're talking seconds here, not microseconds. Besides, a ping every few minutes or so is quite enough. The real downside I see it having to rely on JavaScript, but that's that. -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] caching parsed XML files as DOM objects in memory
Hi, is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets. I need something similar with PHP, can it be done? Thanks for any ideas, Petr ps. I found this project http://www.vl-srm.net/ which maybe can do something I need, but it looks dead. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Php is not writing errors in logfile
I have asked Php to log errors in a file but it doesn't. error_reporting = E_ALL display_errors = Off log_errors = On error_log = /var/log/php-errors.log Any idea what's wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php is not writing errors in logfile
Quoting Jacob Friis Saxberg [EMAIL PROTECTED]: I have asked Php to log errors in a file but it doesn't. error_reporting = E_ALL display_errors = Off log_errors = On error_log = /var/log/php-errors.log Any idea what's wrong? Maybe that's not the right php.ini. Look at phpinfo(). Or the user that the webserver runs as doesn't have the right to access the logfile. -- Romanian Web Developers - http://ROWD.ORG -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php is not writing errors in logfile
On 10/5/05, Stephen Leaf [EMAIL PROTECTED] wrote: On Wednesday 05 October 2005 08:16 am, Jacob Friis Saxberg wrote: I have asked Php to log errors in a file but it doesn't. error_reporting = E_ALL display_errors = Off log_errors = On error_log = /var/log/php-errors.log sure PHP has write permissions to this file? No, I guess Php have the same rights as apache, and if I put the logfile in /var/log/httpd/php-errors.log it still doesn't work. Any idea what's wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Php is not writing errors in logfile
On 10/5/05, Skippy [EMAIL PROTECTED] wrote: Quoting Jacob Friis Saxberg [EMAIL PROTECTED]: I have asked Php to log errors in a file but it doesn't. error_reporting = E_ALL display_errors = Off log_errors = On error_log = /var/log/php-errors.log Any idea what's wrong? Maybe that's not the right php.ini. Look at phpinfo(). Or the user that the webserver runs as doesn't have the right to access the logfile. According to phpinfo I am using the right php.ini How can I check that the webserver have prober rights? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Php is not writing errors in logfile
On 10/5/05, Jacob Friis Saxberg [EMAIL PROTECTED] wrote: I have asked Php to log errors in a file but it doesn't. error_reporting = E_ALL display_errors = Off log_errors = On error_log = /var/log/php-errors.log Any idea what's wrong? Sorry, this solved my problem: error_log = /var/log/httpd/php-error.log touch /var/log/httpd/php-error.log chown apache:apache /var/log/httpd/php-error.log Thanks for your time. Jacob -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling competing edits in a wiki engine?
Skippy: The real downside I see it having to rely on JavaScript, but that's that. The real downside - if I understand the concept correctly - ist that an open browser window isn't equal to an 'active' session. I.e. the famous lunch break still breaks the application as the ping is sent to the server without an user actually sitting in front of the page and editing it. All those session based systems are at best suboptimal anyway. Besides the timeout-problem there are other issues to consider such as editing outside of the page (in a client based editor) an then just copy 'n' paste the changes back into the page. So I'd say the mediawiki approach as outlined by Jasper is the best possible in the context of a stateless protocol such as HTTP. Regards, Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Handling competing edits in a wiki engine?
Niels Ganser wrote: Skippy: The real downside I see it having to rely on JavaScript, but that's that. The real downside - if I understand the concept correctly - ist that an open browser window isn't equal to an 'active' session. I.e. the famous lunch break still breaks the application as the ping is sent to the server without an user actually sitting in front of the page and editing it. you could incoporate a check for mousemovement and keystrokes (within the browser) to mitigate this somewhat. a given period of inactivity could trigger the pinging to stop? just a random thought :-) All those session based systems are at best suboptimal anyway. Besides the timeout-problem there are other issues to consider such as editing outside of the page (in a client based editor) an then just copy 'n' paste the changes back into the page. So I'd say the mediawiki approach as outlined by Jasper is the best possible in the context of a stateless protocol such as HTTP. Regards, Niels -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] sessions
I have an old site which uses this code on login: //it does a query then if ($affected_rows0){ session_start(mysite); session_register('admin'); $wardadmin = yes; header(location: admin.php); } and in the top of admin.php: session_start(mysite); if (@$admin != yes) { header(location: login.php); exit; } The host recently upgraded to php 4.4 and now the login doesn't work. I do notice when I login that the page goes to admin the right back to login. Why doesn't admin see the session var? Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sessions
blackwater dev wrote: I have an old site which uses this code on login: //it does a query then if ($affected_rows0){ session_start(mysite); is 'mysite' a constant? if not then that line should be: session_start('mysite'); session_register('admin'); $wardadmin = yes; notice that you register 'admin' and then set $wardadmin to 'yes' ... maybe that is the problem. header(location: admin.php); } and in the top of admin.php: session_start(mysite); if (@$admin != yes) { header(location: login.php); exit; } The host recently upgraded to php 4.4 and now the login doesn't work. I do notice when I login that the page goes to admin the right back to login. Why doesn't admin see the session var? probably because register_globals has been turned off. also the use of session_register() is depreciated in favour of the $_SESSION superglobal... so: ? // start the session before this bit. if ($login_is_admin) { // !-- psuedo var $_SESSION['admin'] = 'yes'; } else { $_SESSION['admin'] = 'no'; } // and if ('yes' == @$_SESSION['admin']) { // your an admin } Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] is_subclass_of() weird behaviour with APC
2005/10/5, Jochem Maas [EMAIL PROTECTED]: ... function Object() { if (!is_subclass_of($this, Object)) { could it be a case-sensitivity problem (within APC) so that maybe this does work?: if (!is_subclass_of($this, object)) ... It behaves the same. I get the same error, due to is_subclass_of() returning false instead of true, only with APC is enabled. Thank you -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Possible bug in array_diff() php v4.4.0 or at least some odd behavior
I have two arrays: $faqDataPost: array 1 = array 'faq_order' = '1' 'faq_question' = 'What is the air speed of a fully laden swallow?' 'show_question' = '1' 'faq_answer' = 'African or European?' 3 = array 'faq_order' = '2' 'faq_question' = 'Where is our shrubbery?' 'show_question' = '1' 'faq_answer' = 'Nee! Nee!' 4 = array 'faq_order' = '3' 'faq_question' = 'Where is Lancelot?' 'show_question' = '1' 'faq_answer' = 'We eat and drink and dance a lot.' $faqDataDB: array 1 = array 'faq_data_id' = '1' 'faq_question' = 'What is the air speed of a fully laden swallow?' 'faq_answer' = 'African or European?' 'faq_order' = '1' 'show_question' = '0' 3 = array 'faq_data_id' = '3' 'faq_question' = 'Where is our shrubbery?' 'faq_answer' = 'Nee! Nee!' 'faq_order' = '2' 'show_question' = '0' 4 = array 'faq_data_id' = '4' 'faq_question' = 'Where is Lancelot?' 'faq_answer' = 'We eat and drink and dance a lot.' 'faq_order' = '3' 'show_question' = '0' // and this code(sorry the wrap is a bit off): print'br /$faqDataPost:br /';var_dump($faqDataPost); print'br /$faqDataDB:br /';var_dump($faqDataDB); // Get the changed data... // foreach($faqDataPost as $key = $r) { unset($faqDataDB[$key]['faq_data_id']); $r['show_question'] = isset($r['show_question']) ? $r['show_question'] : 0; print'br /$rbr /';var_dump($r); print'br /DBbr /';var_dump($faqDataDB[$key]); if((string)$r['show_question'] !== (string)$faqDataDB[$key]['show_question']) { print br /Does Not Match. Should show up in diff/br /; } $faqDataInsert[$key] = array_diff($r, $faqDataDB[$key]); print'br /diffbr/pre';print_r($faqDataInsert[$key]);print'/pre'; } // and these results: $r array 'faq_order' = '1' 'faq_question' = 'What is the air speed of a fully laiden swallow?' 'show_question' = '1' 'faq_answer' = 'African or European?' DB array 'faq_question' = 'What is the air speed of a fully laiden swallow?' 'faq_answer' = 'African or European?' 'faq_order' = '1' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( ) $r array 'faq_order' = '2' 'faq_question' = 'Where is our shrubbery?' 'show_question' = '1' 'faq_answer' = 'Nee! Nee!' DB array 'faq_question' = 'Where is our shrubbery?' 'faq_answer' = 'Nee! Nee!' 'faq_order' = '2' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( [show_question] = 1 ) $r array 'faq_order' = '3' 'faq_question' = 'Where is Lancealot?' 'show_question' = '1' 'faq_answer' = 'We eat and drink and dance a lot.' DB array 'faq_question' = 'Where is Lancealot?' 'faq_answer' = 'We eat and drink and dance a lot.' 'faq_order' = '3' 'show_question' = '0' Does Not Match. Should show up in diff diff Array ( [show_question] = 1 ) /**/ The problem is that in the first loop through the arrays, array_diff() doesn't pick up that ['show_question'] is different, although it does pick it up in the following loops. The interesting bit is that arra_diff_assoc() DOES pick up the difference in the first loop. Both arrays are built in foreach() statements and I can't see any difference between the first sub array and subsequent sub arrays that would cause array_diff() to miss the diference in the first one. If I change any of the other values in the first sub array, array_diff() will pick those up fine, just not the ['show_question'] part. I'm going to use array_diff_assoc(0 for this right now because it works and that what matters, but does anyone know why I'm having this problem with array_diff()? Can you see something that I'm missing? Thanks! Ed -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Scripts not working outside of Zend Studio
Hi All, I'm testing a session management script which seems to work fine in the Zend Studio debugger. However, when I load the script directly into a browser (http://localhost/my_test.php), it displays a blank screen and the only code in the browser's view source is htmlbody/body/html. I can right click the Debug Output in Zend Studio and select Show In Browser and it loads the page into the browser and displays correctly. I've got the php.ini set to throw errors: error_reporting = E_ALL E_NOTICE E_STRICT display_errors = On I've tried this in IE and Firefox and the page won't display or throw an error in either one. What could be going on here? I've been chasing this for hours. Thanks for any help, Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Scripts not working outside of Zend Studio
On 10/5/05, Steve Harp [EMAIL PROTECTED] wrote: I've got the php.ini set to throw errors: error_reporting = E_ALL E_NOTICE E_STRICT display_errors = On But which php.ini on your system is your web server using? Many newer Linux distros for example ship with multiple php.ini files, one for the cli PHP, one for the mod_php. I'd cut out the middle man and add a call to error_reporting() at the top of the script. -- Greg Donald Zend Certified Engineer MySQL Core Certification http://destiney.com/
Re: [PHP] Scripts not working outside of Zend Studio
On Wed, 5 Oct 2005 16:25:03 -0500, [EMAIL PROTECTED] (Greg Donald) wrote: error_reporting( Well that now gives me errors. Thanks very much... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP and XML
My company recently installed google's search appliance and I am working on some scripts to display the search results on our various websites. The problem I'm having is using the XML parsing functions I've used on other pages is not working because the returned XML has invalid xml characters in it. For example, the data between the xml tags include html tags that are supposed to be displayed. But when I parse the xml, the parse sees these tags as new start tags. Is there a way to work around this or a different way to parse this document? I've heard a little about XSLT really don't know anything about it and am wondering if that is the way to deal with it? Here is a part of the XML returned by the google appliance: GSP VER=3.2 TM0.008398/TM Qinformation services/Q PARAM name=q value=information services original_value=information+services/ PARAM name=site value=shpolicy original_value=shpolicy/ PARAM name=client value=shpolicy original_value=shpolicy/ PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/ PARAM name=btnG value=Google_Search original_value=Google+Search/ PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/ PARAM name=access value=p original_value=p/ - RES SN=1 EN=10 M86/M FI/ - NB - NU /search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient=shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU /NB - R N=1 MIME=application/pdf - U http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U - UE http://shpolicy.shservices.org/administrative/InformationServices/housewideapplicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.pdf /UE - T bInformation/b bServices/b Software Purchasing /T RK5/RK FS NAME=date VALUE=2005-09-07/ - S b.../b Administrative Housewide Policy bInformation/b bServices/b Software Purchasing Applicablebr Campus: Salem and West Valley Hospitals Department Name: bInformation/b b.../b /S - HAS L/ C SZ= CID=4_wracnOVC8:/ /HAS /R I can send the parsing code but it's fairly straight forward and I didn't want to needlessly fill up the email. Any suggestions? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form not submitting when I change action from PHP_SELF to thanks page
I have a form that submits and returns on the same page and works fine. I know want to change the submission action from {$_SERVER['PHP_SELF']} to an external thanks page so the form method would change to: form action=thanks.php method=POST now I need to know what else I have to change in the form below to change to get the thanks page to submit the info. other than the obvius which is to get rid of the echo thank-you msg. at the end of the form. Here is the current code: ?php $form_block=END_FORM form method=post action={$_SERVER['PHP_SELF']} class=info_request fieldset class=left legend title=About YouAbout You/legend plabel for=firstnamespan class=red*/span First Name: /labelbr / input id=firstname name=firstname type=text value={$_POST['firstname']} //p plabel for=lastnamespan class=red*/span Last Name:/labelbr / input id=lastname name=lastname type=text value={$_POST['lastname']} //p plabel for=companyspan class=red*/span Company: /labelbr / input id=company name=company type=text value={$_POST['company']} //p plabel for=phonespan class=red*/span Phone: /labelbr / input id=phone name=phone type=text value={$_POST['phone']} //p plabel for=emailspan class=red*/span e-mail: /labelbr / input id=email name=email type=text value={$_POST['email']} //p plabel for=email2span class=red*/span re-enter e-mail: /labelbr / input id=email2 name=email2 type=text value={$_POST['email2']} //p /fieldset fieldset legend title=More Info.More Info./legend plabel for=URLspan class=red*/span URL:/labelbr / input id=URL type=text name=URL value={$_POST['URL']}/ /p plabel for=Contact_Preferencespan class=red*/span Best way to reach:/labelbr / select name=Contact_Preference id=Contact_Preference option value=emailemail/option option value=phonephone/option option value=snail_mailsnail mail/option /select /p plabel for=Contact_Timespan class=red*/span Best time to contact:/labelbr / select name=Contact_Time id=Contact_Time option value=morningmorning/option option value=eveningevening/option option value=anytimeanytime/option /select/p input type=hidden name=op value=ds / textarea name=message id=message rows= cols= Send us a detailed message specifying what you wish to accomplish with your web site. /textarea input class=submit src=/images/submit.gif alt=Submit type=image name=submit / /fieldset /form /div pspan class=red*/span indicates a required field (all fields are required)./p END_FORM; if ($_POST['op']!='ds') { echo $form_block; } else if ($_POST[op] == ds) { //Function saves time and space by eliminating unneccesary code function check($fieldname) { global $err_msg; if($_POST[$fieldname] == ) { if ( !isset($err_msg)) { $err_msg = span class='red'You haven't entered your .$fieldname.!/spanbr /; } elseif ( isset($err_msg)) { $err_msg=span class='red'You haven't entered your .$fieldname.!/spanbr /; } } return $err_msg; } // ///Function execution/ // check('firstname'); check('lastname'); check('company'); check('phone'); check('email'); check('email2'); check('URL'); check('Contact_Preference'); check('Contact_Time'); check('message'); //Validating Email Address if ($_POST['email'] != $_POST['email2']) { $email_err = \nspan class='red'e-mail address fields do not match!/span; } if (isset($err_msg) || isset($email_err)) { echo $err_msg.$email_err.\n\n.$form_block; } else { //it's ok to send, so build the mail $msg = E-mail sent from www.inspired-evolution.com\n; $msg .=Sender's first name:{$_POST['firstname']}\n; $msg .=Sender's last name:{$_POST['lastname']}\n; $msg .=Company name:{$_POST['company']}\n; $msg .=Senders Phone number:{$_POST['phone']}\n; $msg .=Senders email address:{$_POST['email']}\n; $msg .=Senders email address (re-typed):{$_POST['email2']}\n; $msg .=The website is :{$_POST['URL']}\n; $msg .=I prefer to be contacted via: {$_POST['Contact_Preference']}\n; $msg .=The Best time to contact is: {$_POST['Contact_Time']}\n; $msg .=Message:{$_POST['message']}\n\n; $to =[EMAIL PROTECTED]; $subject =There has been a disturbance in the force; $mailheaders =From: Inspired-Evolution.com http://www.inspired-evolution.com\n; $mailheaders .=Reply-To: {$_POST['email']}\n; //send the mail mail ($to, $subject, $msg, $mailheaders); //display information to user echo pHola, strong$firstname/strong!.br /br / We have received your request for a web site review , and will respond shortly.br / Thanks for visiting inspired-evolution.com and have a wonderful day!br /br / Regards,br /br / strongInspired Evolution/strong/p; } } ? any assistance is greatly appreciated -- PHP General Mailing List
Re: [PHP] form not submitting when I change action from PHP_SELF to thanks page
On Wed, 2005-10-05 at 20:44, Bruce Gilbert wrote: I have a form that submits and returns on the same page and works fine. I know want to change the submission action from {$_SERVER['PHP_SELF']} to an external thanks page so the form method would change to: form action=thanks.php method=POST Why not just redirect to the thanks.php page when the submission is complete? That will require the addition of one line to your form page: header( 'Location: thanks.php' ); 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. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: form not submitting when I change action from PHP_SELF to thanks page
thanks for the reply. and where on the page would that need to go? Within the head tags? and would it need to be within ?php ? ??? On 10/5/05, Robert Cummings [EMAIL PROTECTED] wrote: On Wed, 2005-10-05 at 20:44, Bruce Gilbert wrote: I have a form that submits and returns on the same page and works fine. I know want to change the submission action from {$_SERVER['PHP_SELF']} to an external thanks page so the form method would change to: form action=thanks.php method=POST Why not just redirect to the thanks.php page when the submission is complete? That will require the addition of one line to your form page: header( 'Location: thanks.php' ); 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. | `' -- ::Bruce:: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] caching parsed XML files as DOM objects in memory
Sadly I thought of doing the same thing only to have my face crapped on by this extreme lameness: http://www.php.net/manual/en/ref.session.php Some types of data can not be serialized thus stored in sessions. It includes resource variables or objects with circular references (i.e. objects which passes a reference to itself to another object). If you figure out a way, please let me/us know... *sigh* -Original Message- From: Petr Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 05, 2005 6:11 AM To: php-general@lists.php.net Subject: [PHP] caching parsed XML files as DOM objects in memory Hi, is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets. I need something similar with PHP, can it be done? Thanks for any ideas, Petr ps. I found this project http://www.vl-srm.net/ which maybe can do something I need, but it looks dead. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP5 OOP how do I get the list of all classes dynamically?
I have a class class XMLRule { ... } And many of these: class is_username extends XMLRule { } class is_device extends XMLRule { } Is there a way in PHP5 to get a list of all the 'extends' classes I have 'defined' in my .php file? I'm sure this is a long shot, but thought maybe through the Reflection class or something? I really don't want to manually maintain an array if I don't have to. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] caching parsed XML files as DOM objects in memory
Petr Smith wrote: is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets. I need something similar with PHP, can it be done? This question seems to come up every other week on this list. Have a look at APC[1]; you can cache objects with its apc_store() and apc_fetch() functions. [1] http://php.net/apc -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: form not submitting when I change action from PHP_SELF to thanks page
On Wed, 2005-10-05 at 21:15, Bruce Gilbert wrote: thanks for the reply. and where on the page would that need to go? Within the head tags? and would it need to be within ?php ? Right after this line: mail ($to, $subject, $msg, $mailheaders); And you will already be within PHP interpretation. 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. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and XML
On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote: My company recently installed google's search appliance and I am working on some scripts to display the search results on our various websites. The problem I'm having is using the XML parsing functions I've used on other pages is not working because the returned XML has invalid xml characters in it. For example, the data between the xml tags include html tags that are supposed to be displayed. But when I parse the xml, the parse sees these tags as new start tags. Is there a way to work around this or a different way to parse this document? I've heard a little about XSLT really don't know anything about it and am wondering if that is the way to deal with it? XSL can display the contents using a xsl:copy-of select=node/ bear in mind tho that it also copies the node name. example: nodecopied stuffbr//node copying only the inner content can be achieved by doing a select=. however you'll need to have the current node be the one that you want copied. this can be done by using a xsl:for-each select=node xsl:copy-of select=./ /xsl:for-each If anyone else knows of a better way _please_ let me know :) When working with XML and going to HTML .. IMO XSL is the best way to accomplish it. Here is a part of the XML returned by the google appliance: GSP VER=3.2 TM0.008398/TM Qinformation services/Q PARAM name=q value=information services original_value=information+services/ PARAM name=site value=shpolicy original_value=shpolicy/ PARAM name=client value=shpolicy original_value=shpolicy/ PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/ PARAM name=btnG value=Google_Search original_value=Google+Search/ PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/ PARAM name=access value=p original_value=p/ - RES SN=1 EN=10 M86/M FI/ - NB - NU /search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient =shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU /NB - R N=1 MIME=application/pdf - U http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U - UE http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy.p df /UE - T bInformation/b bServices/b Software Purchasing /T RK5/RK FS NAME=date VALUE=2005-09-07/ - S b.../b Administrative Housewide Policy bInformation/b bServices/b Software Purchasing Applicablebr Campus: Salem and West Valley Hospitals Department Name: bInformation/b b.../b /S - HAS L/ C SZ= CID=4_wracnOVC8:/ /HAS /R I can send the parsing code but it's fairly straight forward and I didn't want to needlessly fill up the email. Any suggestions? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and XML
Thanks, I'm investigating XSL and it looks pretty good. We use an RPM based installation of PHP version 5.0.4. I see on PHP.net's website that XSL comes standard with PHP 5 and you need to enable it by adding the argument --with-xsl to the configure line. How do I do this when we did not build PHP from source? Is there another way to get XSL activated? Thanks for your help Robbert -Original Message- From: Stephen Leaf [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 05, 2005 7:39 PM To: php-general@lists.php.net Subject: Re: [PHP] PHP and XML On Wednesday 05 October 2005 06:20 pm, [EMAIL PROTECTED] wrote: My company recently installed google's search appliance and I am working on some scripts to display the search results on our various websites. The problem I'm having is using the XML parsing functions I've used on other pages is not working because the returned XML has invalid xml characters in it. For example, the data between the xml tags include html tags that are supposed to be displayed. But when I parse the xml, the parse sees these tags as new start tags. Is there a way to work around this or a different way to parse this document? I've heard a little about XSLT really don't know anything about it and am wondering if that is the way to deal with it? XSL can display the contents using a xsl:copy-of select=node/ bear in mind tho that it also copies the node name. example: nodecopied stuffbr//node copying only the inner content can be achieved by doing a select=. however you'll need to have the current node be the one that you want copied. this can be done by using a xsl:for-each select=node xsl:copy-of select=./ /xsl:for-each If anyone else knows of a better way _please_ let me know :) When working with XML and going to HTML .. IMO XSL is the best way to accomplish it. Here is a part of the XML returned by the google appliance: GSP VER=3.2 TM0.008398/TM Qinformation services/Q PARAM name=q value=information services original_value=information+services/ PARAM name=site value=shpolicy original_value=shpolicy/ PARAM name=client value=shpolicy original_value=shpolicy/ PARAM name=output value=xml_no_dtd original_value=xml_no_dtd/ PARAM name=btnG value=Google_Search original_value=Google+Search/ PARAM name=ip value=10.2.4.44 original_value=10.2.4.44/ PARAM name=access value=p original_value=p/ - RES SN=1 EN=10 M86/M FI/ - NB - NU /search?q=information+servicessite=shpolicyhl=enoutput=xml_no_dtdclient =shpolicyaccess=psort=date:D:L:d1start=10sa=N /NU /NB - R N=1 MIME=application/pdf - U http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%20Services%20Software%20Purchasing%20Policy.pdf /U - UE http://shpolicy.shservices.org/administrative/InformationServices/housewide applicable/Information%2520Services%2520Software%2520Purchasing%2520Policy. p df /UE - T bInformation/b bServices/b Software Purchasing /T RK5/RK FS NAME=date VALUE=2005-09-07/ - S b.../b Administrative Housewide Policy bInformation/b bServices/b Software Purchasing Applicablebr Campus: Salem and West Valley Hospitals Department Name: bInformation/b b.../b /S - HAS L/ C SZ= CID=4_wracnOVC8:/ /HAS /R I can send the parsing code but it's fairly straight forward and I didn't want to needlessly fill up the email. Any suggestions? Thanks, Robbert van Andel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP5 OOP how do I get the list of all classes dynamically?
You can get an array of all declared classes with http://de.php.net/manual/en/function.get-declared-classes.php If you need more context (e.g. only subclasses of X) you should definitely have a close look at the reflection api. AllOLLi Being lectured by the President on fiscal responsibility is like Tony Soprano talking to me about law and order [Sen. John Kerry, 3rd debate] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mail() with port authentication
Do I need to use Pear to specify port 587 and authentication when sending mail? I could not find any way to do it using mail(). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and XML
On Wednesday 05 October 2005 09:46 pm, Robbert van Andel wrote: Thanks, I'm investigating XSL and it looks pretty good. We use an RPM based installation of PHP version 5.0.4. I see on PHP.net's website that XSL comes standard with PHP 5 and you need to enable it by adding the argument --with-xsl to the configure line. How do I do this when we did not build PHP from source? Is there another way to get XSL activated? Compiling it from source will be your best choice. If you have a test server compile it there and create the rpm. then install on the production server. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] caching parsed XML files as DOM objects in memory
Jasper Bryant-Greene wrote: Petr Smith wrote: is it possible to cache parsed XML files somehow? I'm writing template library based on XML. But it's not very efficient to create new DomDocument, load XML template, process it and show on every page hit. XML parsing is not very fast, and because I'm parsing XHTML with entities, all DTD's are parsed too. I thought about something similar to java - there I can have servlet which lives all the time the server lives. It can load XML and parse it only for the first time and send DOM objects to another servlets. I need something similar with PHP, can it be done? This question seems to come up every other week on this list. Have a look at APC[1]; you can cache objects with its apc_store() and apc_fetch() functions. [1] http://php.net/apc Thanks, looks usable.. I hope it can synchronize successfully between different calls on heave load. I'll try it, I don't know why I missed it when browsing documentation. Petr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php