[PHP] error_append_string and error_log

2009-07-15 Thread Javier Ruiz
Hi!

I'm trying to append some extra info to my php errors. It works well when
I'm displaying errors on screen, but it doesn't work to log the extra info
into an error file (log_errors and  error_log). I mean, if I use this:

?php
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', './ERRORS');
ini_set('error_append_string',  -- SomeStuff!);
require 'test.php';   // this file contains syntax errors...


When I issue this using a web browser, I get a syntax error shown in the
browser and it contains the SomeStuff text, but in the ERRORS file I just
get the php error without the SomeStuff text...

Is there any way to get this working?

Thanks!
Regards,

JaviRuiz.


Re: [PHP] error_append_string and error_log

2009-07-15 Thread Javier Ruiz
Hi, thanks for your reply.

The thing is, I need to set it in runtime (ini_set) since I want to append
the URI that generated the error, so I'll need to use some $_SERVER
variables.

Regards

JaviRuiz.



On Wed, Jul 15, 2009 at 2:25 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 On Wednesday 15 July 2009 12:44:21 Javier Ruiz wrote:
  Hi!
 
  I'm trying to append some extra info to my php errors. It works well when
  I'm displaying errors on screen, but it doesn't work to log the extra
 info
  into an error file (log_errors and  error_log). I mean, if I use this:
 
  ?php
  ini_set('display_errors', 1);
  ini_set('log_errors', 1);
  ini_set('error_log', './ERRORS');
  ini_set('error_append_string',  -- SomeStuff!);
  require 'test.php';   // this file contains syntax errors...
 
 
  When I issue this using a web browser, I get a syntax error shown in the
  browser and it contains the SomeStuff text, but in the ERRORS file I
 just
  get the php error without the SomeStuff text...
 
  Is there any way to get this working?
 
  Thanks!
  Regards,
 
  JaviRuiz.

 Try setting this in your php.ini rather than PHP and see if that does the
 trick

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



Fwd: [PHP] pdo-oracle + nls_lang environment variable...

2007-05-17 Thread Javier Ruiz

sorry, forgot to CC to the list...

-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: May 17, 2007 9:46 AM
Subject: Re: [PHP] pdo-oracle + nls_lang environment variable...
To: Miguel J. Jiménez [EMAIL PROTECTED]

Thanks for the answer.

Nah I checked and apache has support for both latin1 and utf8 charsets, I
tried anyway forcing the output of apache to iso8859-1 and to utf8 but no
luck...

I'm almost convinced it's something about php reading the NLS_LANG
environment variable because if I just unset this variable php-cli (and even
oracle's sqlplus directly) behaves the same way as php-apache does (displays
special characters as question marks).

gracias miguel :-D


On 5/17/07, Miguel J. Jiménez [EMAIL PROTECTED]  wrote:


Javier Ruiz escribió:
 Hi,

 I'm using pdo-oci on php-5.2.2 against an oracle-10g server, using
 oracle-instantclient (compiled oracle with
 '--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib').

 The problem...:
 I make a simple php script that makes a select from a table. The table
 contains spanish characters so I set the enviroment variable NLS_LANG to
 SPANISH_SPAIN.AL32UTF8 before running apache (also tried other values
 that
 use iso8859-1...). If I run the script in console (using the CLI
 version of
 php) the returned data is in the desired collation, so I can see the
 spanish
 special characters like ñ, ó and so on... The problem is that
running
 exactly the same script via HTTP (apache2) I always get question marks
 replacing the special characters...

 I tried many things... I export the enviroment variable as root and as
 the
 user running the apache daemon, I modified the apache init script to
 export
 the variables just before starting apache, I tried using the putenv
 function
 in php code and no luck at all...

 I realized about something that maybe is related... a php script
 running in
 CLI can access any environmental variable, but no any env-var running in
 apache... for example the following code: ?php echo getenv(LC_ALL);
?
 will return my locale setting in CLI but returns nothing via http...
 is it
 normal?

 TIA!



Maybe you have the AddDefaultCharset directive from Apache2 set to
ISO-8859-15 instead of UTF-8 (or even off)? I have worked with php-oci8
and php5.2 without any collation problem this far (using ñ € ans so on...)

--
Miguel J. Jiménez
Programador Senior
Área de Internet/XSL/PHP
[EMAIL PROTECTED]



ISOTROL
Edificio BLUENET, Avda. Isaac Newton nº3, 4ª planta.
Parque Tecnológico Cartuja '93, 41092 Sevilla (ESP).
Teléfono: +34 955 036 800 - Fax: +34 955 036 849
http://www.isotrol.com

You let a political fight  come between you and your best friend you have
in all the world. Do you realize how foolish that is? How ominous? How can
this country survive if friends can't rise above the quarrel.
Constance Hazard, North  South (book I)





[PHP] pdo-oracle + nls_lang environment variable...

2007-05-16 Thread Javier Ruiz

Hi,

I'm using pdo-oci on php-5.2.2 against an oracle-10g server, using
oracle-instantclient (compiled oracle with
'--with-oci8=instantclient,/usr/lib/oracle/10.2.0.3/client/lib').

The problem...:
I make a simple php script that makes a select from a table. The table
contains spanish characters so I set the enviroment variable NLS_LANG to
SPANISH_SPAIN.AL32UTF8 before running apache (also tried other values that
use iso8859-1...). If I run the script in console (using the CLI version of
php) the returned data is in the desired collation, so I can see the spanish
special characters like ñ, ó and so on... The problem is that running
exactly the same script via HTTP (apache2) I always get question marks
replacing the special characters...

I tried many things... I export the enviroment variable as root and as the
user running the apache daemon, I modified the apache init script to export
the variables just before starting apache, I tried using the putenv function
in php code and no luck at all...

I realized about something that maybe is related... a php script running in
CLI can access any environmental variable, but no any env-var running in
apache... for example the following code:  ?php echo getenv(LC_ALL); ?
will return my locale setting in CLI but returns nothing via http... is it
normal?

TIA!


[PHP] php + db2

2007-04-26 Thread Javier Ruiz

Hi

I'm trying to install php-5.2.1 using ibm-db2. I made this a couple times
already without any problem, but in this concrete machine I cannot pass the
configure script...

My problem is with the db2 enviroment. Before issuing configure with all the
options, I sourced the db2profile file as always, I checked and I have the
enviromental variables:

# env | grep -i db2
DB2INSTANCE=db2inst2
LD_LIBRARY_PATH=/home/db2inst2/sqllib/lib
LIBPATH=/home/db2inst2/sqllib/lib
PATH=/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/home/db2inst2/sqllib/bin:/home/db2inst2/sqllib/adm:/home/db2inst2/sqllib/misc
VWSPATH=/home/db2inst2/sqllib
CLASSPATH=/home/db2inst2/sqllib/java/db2java.zip:/home/db2inst2/sqllib/java/db2jcc.jar:/home/db2inst2/sqllib/java/sqlj.zip:/home/db2inst2/sqllib/function:/home/db2inst2/sqllib/java/db2jcc_license_cisuz.jar:/home/db2inst2/sqllib/java/db2jcc_license_cu.jar:.


but after this, when I issue the configure command I still get

...
checking for IBM DB2 support... no
configure: error:
build test failed. Please check the config.log for details.
You need to source your DB2 environment before running PHP configure:
# . $IBM_DB2/db2profile


can anybody help me here please?

TIA!


[PHP] Fwd: php + db2

2007-04-26 Thread Javier Ruiz

Ok, I've seen something... I'm trying to compile php with db2 support but
also with oracle support using oracle-instantclient.

If I remove the oracle options (with-oci8 and with-pdo-oci), configure
passes the ibm-db2 tests, but using oracle-instantclient + db2 seems to be
problematic...

Anybody?


-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Apr 26, 2007 10:39 AM
Subject: php + db2
To: php-general@lists.php.net

Hi

I'm trying to install php-5.2.1 using ibm-db2. I made this a couple times
already without any problem, but in this concrete machine I cannot pass the
configure script...

My problem is with the db2 enviroment. Before issuing configure with all the
options, I sourced the db2profile file as always, I checked and I have the
enviromental variables:

# env | grep -i db2
DB2INSTANCE=db2inst2
LD_LIBRARY_PATH=/home/db2inst2/sqllib/lib
LIBPATH=/home/db2inst2/sqllib/lib
PATH=/usr/sbin:/bin:/usr/bin:/sbin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin:/home/db2inst2/sqllib/bin:/home/db2inst2/sqllib/adm:/home/db2inst2/sqllib/misc

VWSPATH=/home/db2inst2/sqllib
CLASSPATH=/home/db2inst2/sqllib/java/db2java.zip:/home/db2inst2/sqllib/java/db2jcc.jar:/home/db2inst2/sqllib/java/sqlj.zip:/home/db2inst2/sqllib/function:/home/db2inst2/sqllib/java/db2jcc_license_cisuz.jar:/home/db2inst2/sqllib/java/db2jcc_license_cu.jar:.



but after this, when I issue the configure command I still get

...
checking for IBM DB2 support... no
configure: error:
build test failed. Please check the config.log for details.
You need to source your DB2 environment before running PHP configure:
# . $IBM_DB2/db2profile


can anybody help me here please?

TIA!


Fwd: [PHP] PDO mssql + multiple rowsets

2007-04-04 Thread Javier Ruiz

I've seen there's an open bug on the missing feature I pointed out in my
first email, but it's even not assigned and I cannot get an answer from the
developer... so... does anybody know if there is any plan to finish the
PDO-dblib driver?

TIA


-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Apr 2, 2007 9:54 AM
Subject: Re: [PHP] PDO mssql + multiple rowsets
To: Frank M. Kromann [EMAIL PROTECTED], php-general@lists.php.net

Hi again. Sorry I was out of my city during the weekend and had no
connection available...

So Frank, please lemme know, is the feature (multiple rowsets) planned to be
included in the pdo-dblib driver? I would like to know to include or not pdo
in my development needs against mssql.

Thanks, greetings!


On 3/29/07, Frank M. Kromann [EMAIL PROTECTED] wrote:


It Is doable. The native mssql/dblib extension does support that features.
I just have'nt had the time to code it for pdo_dblib.

- Frank

 I too have been having problems getting the PDO dblib for mssql to play
 well (getting the same error actually).  If you find a reason or work
 around for it I would appreciate hearing about it.  Thinking of going
 the odbc route myself if I can't get it to work.


 Respectfully,
 Ligaya Turmelle

 -Original Message-
 From: Javier Ruiz [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, March 28, 2007 8:21 PM
 To: php-general@lists.php.net
 Subject: [PHP] PDO mssql + multiple rowsets

 Hi!

 I want to use PDO in my apps for connecting to several RDBSs, one of
 them, sql server 2000 and 2005. I tried to use as DSN something like
 mssql:...
 (as I've seen in the php manual pages) but I get a PDOException with
the
 message Unable to open PDO connection [wrapped: could not find
 driver]. I can work well with the mssql built-in functions (like
 mssql_connect, mssql_query and so on...) and even I can almost work
 perfectly using in my dsn dblib:
 So first question: is the PDO's driver mssql deprecated or is it me
 doing something wrong in the PHP installation?
 BTW, I use php-5.2.1

 In case that the answer to the first question is that mssql is no
more
 used as a PDO driver, I have a problem... I have stored procedures in
 sql server that return multiple rowsets, I've seen that PDO offers
 functionability to manage this, but not for the dblib driver... if I
try
 to use the $stmt-nextRowSet() method, I get an exception like Driver
 does not support this function: driver does not support multiple
 rowsets
 What can I do then to work with my stored procs?

 Thanks in advance

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







Fwd: [PHP] PDO mssql + multiple rowsets

2007-04-04 Thread Javier Ruiz

btw... the bug: http://pecl.php.net/bugs/bug.php?id=10530

-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Apr 4, 2007 9:10 AM
Subject: Fwd: [PHP] PDO mssql + multiple rowsets
To: php-general@lists.php.net

I've seen there's an open bug on the missing feature I pointed out in my
first email, but it's even not assigned and I cannot get an answer from the
developer... so... does anybody know if there is any plan to finish the
PDO-dblib driver?

TIA


-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Apr 2, 2007 9:54 AM
Subject: Re: [PHP] PDO mssql + multiple rowsets
To: Frank M. Kromann [EMAIL PROTECTED],  php-general@lists.php.net

Hi again. Sorry I was out of my city during the weekend and had no
connection available...

So Frank, please lemme know, is the feature (multiple rowsets) planned to be
included in the pdo-dblib driver? I would like to know to include or not pdo
in my development needs against mssql.

Thanks, greetings!


On 3/29/07, Frank M. Kromann  [EMAIL PROTECTED] wrote:


It Is doable. The native mssql/dblib extension does support that features.
I just have'nt had the time to code it for pdo_dblib.

- Frank

 I too have been having problems getting the PDO dblib for mssql to play
 well (getting the same error actually).  If you find a reason or work
 around for it I would appreciate hearing about it.  Thinking of going
 the odbc route myself if I can't get it to work.


 Respectfully,
 Ligaya Turmelle

 -Original Message-
 From: Javier Ruiz [mailto: [EMAIL PROTECTED]
 Sent: Wednesday, March 28, 2007 8:21 PM
 To: php-general@lists.php.net
 Subject: [PHP] PDO mssql + multiple rowsets

 Hi!

 I want to use PDO in my apps for connecting to several RDBSs, one of
 them, sql server 2000 and 2005. I tried to use as DSN something like
 mssql:...
 (as I've seen in the php manual pages) but I get a PDOException with
the
 message Unable to open PDO connection [wrapped: could not find
 driver]. I can work well with the mssql built-in functions (like
 mssql_connect, mssql_query and so on...) and even I can almost work
 perfectly using in my dsn dblib:
 So first question: is the PDO's driver mssql deprecated or is it me
 doing something wrong in the PHP installation?
 BTW, I use php-5.2.1

 In case that the answer to the first question is that mssql is no
more
 used as a PDO driver, I have a problem... I have stored procedures in
 sql server that return multiple rowsets, I've seen that PDO offers
 functionability to manage this, but not for the dblib driver... if I
try
 to use the $stmt-nextRowSet() method, I get an exception like Driver
 does not support this function: driver does not support multiple
 rowsets
 What can I do then to work with my stored procs?

 Thanks in advance

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







[PHP] PDO mssql + multiple rowsets

2007-03-28 Thread Javier Ruiz

Hi!

I want to use PDO in my apps for connecting to several RDBSs, one of them,
sql server 2000 and 2005. I tried to use as DSN something like mssql:...
(as I've seen in the php manual pages) but I get a PDOException with the
message Unable to open PDO connection [wrapped: could not find driver]. I
can work well with the mssql built-in functions (like mssql_connect,
mssql_query and so on...) and even I can almost work perfectly using in my
dsn dblib:
So first question: is the PDO's driver mssql deprecated or is it me doing
something wrong in the PHP installation?
BTW, I use php-5.2.1

In case that the answer to the first question is that mssql is no more
used as a PDO driver, I have a problem... I have stored procedures in sql
server that return multiple rowsets, I've seen that PDO offers
functionability to manage this, but not for the dblib driver... if I try to
use the $stmt-nextRowSet() method, I get an exception like Driver does not
support this function: driver does not support multiple rowsets
What can I do then to work with my stored procs?

Thanks in advance


Fwd: [PHP] Problems with Zip+IE6

2006-12-18 Thread Javier Ruiz

Apologies... forgot to CC to the list...

-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Dec 18, 2006 11:25 AM
Subject: Re: [PHP] Problems with Zip+IE6
To: [EMAIL PROTECTED]

Hi,

Nah, the only thing I'm trying to do is to serve a regular zip file to the
user of the app I'm coding, I could just put the file in an accesible
folderand provide the link to the user (when I say accesible I mean inside
the docroot of apache), but I really want the files (those zip files) to be
available to the user ONLY if he's logged in and in a session with some
background stuff...

I did this a houndred times and really never realized about this problem
with IE, I'm a linux user (Gentoo :-D ) since years ago and always used
mozilla and/or firefox, but the users of the application I'm making now use
IE, so they reported the problem thinking that it is related to our code.

Ah! And it really doesn't matter what software you have to work with zip
files, the problem is before that software: The concrete problem I found
is that when you click on a zip file link in IE, it asks you to choose: open
it or save it, the only difference between both operations is that if you
say save it it will download the zip file to a temp folder and then move
it to the directory you specify; if you say open, it SHOULD download it to
the temp folder and then call the application you have for zip files
(winzip, winrar, whatever) with the location of the file in the temp
folder. I think all the browsers works more or less the same way. The
problem with IE is that saying open it just doesn't download the file, but
opens anyway the zip application with the temp file location, so the
application (and not IE) complains that the requested location is not
existing, in my case, WinRar...

Indeed it matters the content-type to use with files in webpages! and as I
mentioned before, I like your article because it's just pointing it, but I'm
just trying to find out if anybody, doing any trick (dirty trick even) got
the temporally download problem solved anyhow, and I'm trying whatever to
get it.

But unfortunatelly as much as I'm searching, I'm more realizing that this is
an unsolvable bug in IE and I'll have to ask my client to please, you will
have to always download the zip files before opening them, or change your
habits and use another browser. It's a recognised IE bug, it's not a PHP's
mistake, not a coding mistake (by me I mean) but sincerelly, and I'll say it
like it is... it's a pain in the ass!

I appreciate Richard for your efforts, thanks a lot.
Regards,

Javi Ruiz.


On 12/16/06, Richard Lynch  [EMAIL PROTECTED] wrote:


On Tue, December 12, 2006 4:34 am, Javier Ruiz wrote:
 damn! that's a pretty good article, thanks a lot.

 unfortunatelly, it's not mentioning about zip files concretely, I
 didn't
 find a solution for my problem with them.
 I tried playing a bit with the Content-type, but it seems that
 Internet
 Explorer doesn't really care about Content-type... it uses the
 extention
 of the file to determine the type (microsoft's way...) so it doesn't
 matter
 if I use application/octet-stream or even
 application/force-download or
 application/makethisdownload-or-ikillyou :-D as long as I name the
 file 
 whatever.zip, IE6 shows the open with dialog and if I use open
 with an
 application, it fails :(

It does matter on real browsers...

Use the correct content type for a download: application/octet-stream

 thanks again Richard for the answer and for the article :)

 anybody with a miracle for the ZIP+IE problem??

You're going to HAVE to open the Zip file with some kind of unzip
application such as WinZip, pkunzip, or, possibly, that goofball
Windows unzip thingie that lets you pretend zip archives are
directories, even though they aren't, but only up to a certain point,
as you can't do some things with files in the zip archive that you can
do with normal files, so it's just a very confusing Human Interface...
Sort of like Windows in a microcosm.

If you were hoping that somehow IE would magically unzip the item, and
then let you open the contents within the zip file with a chosen
application...  Even MS Windows isn't THAT stupid.  Yet.

What if there are 2 things in the zip archive?

For that matter, if there aren't 2 things, why is it even zipped?

 1 - To change the mimetype (when writting http headers) from
  application/zip that I used before to
 application/x-zip-compressed
 2 - To not use MOD_DEFLATE in apache2 (I was not using it
  really...)

I now am beginning to wonder if you are trying to send your HTML as
gzip'ed data for the browser to surf to your site, to save on
bandwidth... If so, none of the above has any bearing on this at
all...

--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




Re: [PHP] Problems with Zip+IE6

2006-12-12 Thread Javier Ruiz

damn! that's a pretty good article, thanks a lot.

unfortunatelly, it's not mentioning about zip files concretely, I didn't
find a solution for my problem with them.
I tried playing a bit with the Content-type, but it seems that Internet
Explorer doesn't really care about Content-type... it uses the extention
of the file to determine the type (microsoft's way...) so it doesn't matter
if I use application/octet-stream or even application/force-download or
application/makethisdownload-or-ikillyou :-D as long as I name the file 
whatever.zip, IE6 shows the open with dialog and if I use open with an
application, it fails :(

thanks again Richard for the answer and for the article :)

anybody with a miracle for the ZIP+IE problem??



On 12/5/06, Richard Lynch [EMAIL PROTECTED] wrote:


It's kinda long, but this will probably save you some grief:
http://richardlynch.blogspot.com

On Tue, December 5, 2006 2:07 am, Javier Ruiz wrote:
 Hi all!

 I have a problem with zip files and Internet Explorer 6. I try to send
 to
 the user a dinamically generated zip file writting the http headers
 and
 using file_put_contents for the zip content. It works fine when
 downloading
 the file with firefox, opera, etc... even it works well if I download
 the
 file with internet explorer and then open it with any zip tool. The
 problem
 comes when I try to directly open the file from the URL using IE6.

 I found this is a known bug of IE (several versions) in windows XP:
 http://support.microsoft.com/kb/308090

 Does anybody know any way to workaround this problem? I found a couple
 workarounds in forums over there and I tried them, but unfortunately
 they
 didn't work:
1 - To change the mimetype (when writting http headers) from
 application/zip that I used before to application/x-zip-compressed
2 - To not use MOD_DEFLATE in apache2 (I was not using it
 really...)



 Any idea??

 Thanks a lot!



--
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?




[PHP] Problems with Zip+IE6

2006-12-05 Thread Javier Ruiz

Hi all!

I have a problem with zip files and Internet Explorer 6. I try to send to
the user a dinamically generated zip file writting the http headers and
using file_put_contents for the zip content. It works fine when downloading
the file with firefox, opera, etc... even it works well if I download the
file with internet explorer and then open it with any zip tool. The problem
comes when I try to directly open the file from the URL using IE6.

I found this is a known bug of IE (several versions) in windows XP:
http://support.microsoft.com/kb/308090

Does anybody know any way to workaround this problem? I found a couple
workarounds in forums over there and I tried them, but unfortunately they
didn't work:
  1 - To change the mimetype (when writting http headers) from
application/zip that I used before to application/x-zip-compressed
  2 - To not use MOD_DEFLATE in apache2 (I was not using it really...)



Any idea??

Thanks a lot!


[PHP] Fwd: Problems with Zip+IE6

2006-12-05 Thread Javier Ruiz

BUMP!

-- Forwarded message --
From: Javier Ruiz [EMAIL PROTECTED]
Date: Dec 5, 2006 9:07 AM
Subject: Problems with Zip+IE6
To: php-general@lists.php.net

Hi all!

I have a problem with zip files and Internet Explorer 6. I try to send to
the user a dinamically generated zip file writting the http headers and
using file_put_contents for the zip content. It works fine when downloading
the file with firefox, opera, etc... even it works well if I download the
file with internet explorer and then open it with any zip tool. The problem
comes when I try to directly open the file from the URL using IE6.

I found this is a known bug of IE (several versions) in windows XP:
http://support.microsoft.com/kb/308090

Does anybody know any way to workaround this problem? I found a couple
workarounds in forums over there and I tried them, but unfortunately they
didn't work:
  1 - To change the mimetype (when writting http headers) from
application/zip that I used before to application/x-zip-compressed
  2 - To not use MOD_DEFLATE in apache2 (I was not using it really...)



Any idea??

Thanks a lot!


[PHP] guess documentroot

2006-10-05 Thread Javier Ruiz

Hey all!

Is it possible to get the path of a file relative to the document root of
the webserver using php?
For example...

if we have a script like
http://localhost/mydir/myseconddir/index.php

is there a way to get that it's runing on
/mydir/myseconddir/

??

something like getcwd() but webserver relative, not filesystem.

thanks a lot.
greetings!


Re: [PHP] guess documentroot

2006-10-05 Thread Javier Ruiz

Perfect!

got it using the following:

/* 1 - remove the query string just in case it contains a '/' in it
  2 - like Clive said, substr() and strrpos() 'clean' the path to provide
the directories only */

$aPath = str_replace($_REQUEST['QUERY_STRING'], '',
$_SERVER['SCRIPT_NAME']);
$aPath = substr($aRuta, 0, (strrpos($aRuta, '/') + 1));

Thanks a lot guys :)



On 10/5/06, clive [EMAIL PROTECTED] wrote:




 if we have a script like
 http://localhost/mydir/myseconddir/index.php

 is there a way to get that it's runing on
 /mydir/myseconddir/

use $_SERVER['[PHP_SELF'] or $_SERVER['SCRIPT_NAME']

and then simply  use strripos() to get the last forwarsd-slash and
substr() to get the value you want.




--
Regards,

Clive




Re: [PHP] Re: remove SimpleXML nodes

2006-09-01 Thread Javier Ruiz

Thanks a lot to all :)

Using DOM I can do what I need. Anyway I was trying the proposed solutions
with SimpleXML but none of them worked for me :(

I tried splitting $key and $value in the foreach command, but when I dump
the xml (with the asXML function) I still have the nodes that I supposed to
delete... And the same using references, cause I think using unset with
referenced variable names doesn't delete the referenced var, it just deletes
the link to the referenced var...

Concretely I tried:

TEST ONE:
foreach ($xmlDatabase as $key = $oneTable) if ($oneTable['name'] == 'one')
unset($xmlDatabase[$key]);
$sourceXML = $xmlDatabase-asXML(); // - node table name='one' is
still there

TEST TWO
foreach ($xmlDatabase as $key = $oneTable) if ($oneTable['name'] == 'one')
unset($oneTable);
$sourceXML = $xmlDatabase-asXML(); // - node table name='one' is
still there


If there's no luck with xml I will use of course DOM for this, but I'm
really curious now :P
Again, thanks a lot for the help.

Javi Ruiz.

On 9/1/06, Curt Zirzow [EMAIL PROTECTED] wrote:
On 8/31/06, Adam Zey [EMAIL PROTECTED] wrote:

Javier Ruiz wrote:
 Hi all,

 So I want to do...

 $xmlDatabase = new SimpleXMLElement($myXML);
 foreach ($xmlDatabase as $oneTable)
 {
   if ($oneTable['name'] == 'two')
   {
  ///   HERE I WANT TO DELETE THE $oneTable NODE
  unset($oneTable);   // -- and this doesn't work...
   }
 }


 any ideas?


The answer is simple, everybody else seems to have missed it. foreach()
makes a copy of the array before working on it. Changes made to
$oneTable would obviously never affect the original. You're just
unsetting a temporary variable that's going to be overwritten next time
through the loop anyhow.

You should have better luck with this code:

$xmlDatabase = new SimpleXMLElement($myXML);
foreach ($xmlDatabase as $key = $oneTable)


fwiw, In php5 you can do something like:

foreach ($xmlDatabase as $key = $oneTable)
//note the  --
 unset($oneTable);


[PHP] remove SimpleXML nodes

2006-08-31 Thread Javier Ruiz

Hi all,

Is there any way to remove a non-unique* *node using SimpleXML?
For example, let's say I have:

$myXML = ENDXML
database ...
 table name='one'
 ...
 /table
 table name='two'
 ...
 /table
 table name='three'
 ...
 /table
/database
ENDXML;


So I want to do...

$xmlDatabase = new SimpleXMLElement($myXML);
foreach ($xmlDatabase as $oneTable)
{
  if ($oneTable['name'] == 'two')
  {
 ///   HERE I WANT TO DELETE THE $oneTable NODE
 unset($oneTable);   // -- and this doesn't work...
  }
}


any ideas?


Re: [PHP] pear constants

2006-08-18 Thread Javier Ruiz

thank you for the link, I'm already subscribed to the pear general list and
I sent the same email to that list, but I got no any answer yet... I just
sent it to the PHP list in case anybody in this list has or had the same
problem...

I put here the problem I'm having:

I have a problem with some pear constants. I made a new installation of
php + pear + propel (http://propel.phpdb.org) and now in my scripts the
constant PEAR_INSTALL_DIR is not defined when in my previous
installation it used to be...

Other constants like the error ones (PEAR_ERROR_DIE,
PEAR_ERROR_RETURN ...) are defined correctly

Am I missing anything in the new installation?

thanks a lot!



On 8/17/06, Chris [EMAIL PROTECTED] wrote:


JRuiz wrote:
 Hi All,

 I have a problem with some pear constants.

The pear lists live here: http://pear.php.net/support/lists.php

--
Postgresql  php tutorials
http://www.designmagick.com/