Re: [PHP] Persistent connections and transactions
Frank Joerdens wrote: > On Thu, Jan 25, 2001 at 05:10:54PM -0300, Martin A. Marques wrote: > [ . . . ] > >> OK, lets see if we can understand what each other is saying (maybe I'm not >> getting your point here). >> Lets say browser A connects to the apache server, to a page using php code. >> Lets say the code is OK (no bugs). Apache opens a persistent connection to >> the database and starts executing the queries. Now the connection between the >> apache server and the web browser doesn't close until the queries are all >> finished and the output is send back to the browser. >> Now, how about if browser B connects to the apache server just in the middle >> of the execution of the queries that browser A asked for? >> Well, the connection between Browser A and the web server is still opened, so >> another httpd child process answers the request. > > > I thought one of the points being raised (can't find the mail/thread I'm > referring to now) was that somehow confusion might ensue from a mix-up, > on the Apache/PHP level, regarding the client identity, thus corrupting a > transaction in progress. It seemed to make sense but now that we've > discussed it, I can't see anymore how it might happen. > > . . . [ goes away to search mail archives ] . . . > > Ah, here we go. A post from Rod Taylor on pgsql-hackers on Dec 27: > > -- begin quote -- > The *real* problem with persistent connections is: > > Script1: BEGIN; > Script1: UPDATE table set row = 'things'; > Script2: Insert into table (id) values ('bad data'); > Script1: COMMIT; > > Since script2 managed to do a BAD insert in the middle of script1's > transaction, the transaction in script1 fails. Obvious solution? Don't > do > connection sharing when a transaction is enabled. The whole persistent > connection thing is only valid for mysql as it's the only thing that > doesn't > really support transactions (and even thats partially changed). > > They need to look for stuff going through (keywords like BEGIN) and > 'lock' > that connection to the single entity that opened it. > > It's much easier to write your own. I wrote a few functions like: > > get_connection('DB PARMS'); > begin_transaction(); > > commit_transaction(); > close_connection(); > -- end quote -- > > [ . . . ] > >> My question would be, and seeing Adams thoughts, wouldn't it be the best >> optimization configuration of php.ini to have only one persistent conection? >> Wouldn't there be one per-child? Any way, you can't have two connections to >> the same httpd child. > > > Those where my thoughts too (or, rather, Adams thoughts ;)), and this is > what I am trying at the moment. > > Regards, Frank > hi, i ran across this transaction problem vs. persistent conn in pgsql some time ago. I found two workaround methods: - don't use persistent conn's :-) or; - start every conn with the usual pg_pconnect and then query a rollback to the server: $query="ROLLBACK work;" (this will kill any supposed transaction in ABORT STATE that some child had left). postgres don't support nested transactions (yet), but when it does maybe you should add multiple "ROLLBACK WORK;" queries :-) Regards, Nuno -- 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]
Re: [PHP] obtain IP from other site ( or domain name)
Hi, you can that a look at the REFERER header... but some browsers don't include it and is very easy to modify... If it isn't a problem for you, add the site id to the link: http://my.site.com/exchange?site=friend ...this tell's you the ID, but someone can enter it directly in the browser, too :) Search this months archive for REFERER and you'll find some solutions, but none is bullet proof, IMHO. Good luck :) Nuno Silva Jacky@lilst wrote: > Hi people > I have exchange link business program with other sites, basically I give a hyper >link to come to our store to them and when user click on the link on their site to >come to us, they will genrate income from it too. > The question is that how do I know that when a user click on the link to come to my >site that a user come from the link from their site , or from their IP or something. >So that I can tell where a user come from. > Is this something to do with http header? > Jack > [EMAIL PROTECTED] > "There is nothing more rewarding than reaching the goal you set for yourself" -- 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]
Re: [PHP] Close persistent db-Connection
Hi, you can't close it :) If the connection is persistent pg_close() instructions are ignored (this is also true for other persistent connections and their respective close() instructions). You can do it in the shell sending USR1 to httpd (killall -USR1 httpd) or by restarting apache (apachectl graceful). The above is true for apache, of course :) Regards, Nuno Carola Meyberg wrote: > I cannot find out how I can manually close a persistent > Postgres Database Connection that has been established by > pg_pconnect. > I believe pg_close only closes non-persistent connections. > > Does anyone know how to do this? > > attachment.txt > > Content-Type: > > text/plain -- 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]
Re: [PHP] PHP scripts
Hi, just ./configure make and you'll get a php binary rwxr-xr-x :) (do not pass --with-apache or --with-apxs to ./configure) Regards, Nuno Alexandre Hautequest wrote: > Hi all. > > How do i use php to build "shell scripts"? Please send me the compiler-time > options or the link to the page that instructs me to how to do this, i had look > at phpbuilder.com as mentioned before, but didn't find anything related. > > Thanks. > > -- > Alexandre Hautequest > hquest at fesppr.br > Fundação de Estudos Sociais do Paraná - http://www.fesppr.br/ > Centro de Administração de Redes - CAR > > "Ninguém é melhor do que todos nós juntos." > Equipe Zeus Competições > > - > Esta mensagem foi enviada pelo WebMail da FESP. > Conheça a FESP: http://www.fesppr.br/ -- 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]
Re: [PHP] Problems with multiple query
Hello, if the second query loops inside a _for_ statement and needs values from the first query you have two options: 1. save all the results from query one to some array and then loop inside the array within the _for_ statement executing new sql; 2. open two separate connections to the database and work with the two. like this: $conn1 = pg_connect(...); $conn2 = pg_connect(...); ... qry1 = pg_exec($conn1, $sql1); ... for ($i=.) { ... $qry2 = pg_exec($conn2, $sql2); ... } Hope this helps, Nuno Silva Luca Lazzeroni wrote: > Hi, > I've recently migrated a system with PHP 4.0.3pl1 and PostgreSQL 7.0.2 - > RedHat Linux 5.1 (yes 5) to a new one with PHP 4.0.4pl1 - PostgreSQL 7.0.2 - > RedHat Linux 7.0. > > All my database applications work fine except one which does strange things: > this is a piece of code: > > 8<--- CUT > >$conn = pg_connect("dbname= user=y password=xx"); > >$sql = "select * from table_a where condition_a"; >$qry1 = pg_exec ($conn,$sql); > >$obj1 = pg_fetchobject($qry1,0); > > // Until here everything works fine > >$sql2 = "select * from table_b where condition_b=".$obj1->value_a; >$qry2 = pg_exec ($conn,$sql2); > > 8<--- CUT > > The second query is nested in a for-loop running for every object in the > first query; for performance reason I need to maintain the two queries > independent. > > After executing (correctly) the first one, the system starts doing strange > things with the second one: > > Warning: Unable to jump to row 0 on PostgreSQL result index 23 in cerca.php3 > on line 467 > > and it fails to read data. > The strange thing is that the system does the same things for EVERY database > where I must use two consecutive queries ! > > Is there anyone who can help me ? > > Thanks in advance > > Luca Lazzeroni -- 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]
Re: [PHP] Problems with multiple query
Hi, please note: You can *not* fetch results that require earlier results using the pg_* functions. Explaination: when you submit a query the php script doesn't know about the content of all rows returned, instead the interface API makes use of pointers to fetch only the requested rows from the result. That said, if you make a second call to pg_exec() consider saving all the results somewhere else if you need the previous set of results. Regards, Nuno Silva Luca Lazzeroni wrote: > Thanks; in fact I've tryed the second solution and it works for me; but I > can't understand why the script stop working during the upgrade of system. > The most strange thing is that, after a deeper investigation on the code, > I've found the PHP engine does something like closing the connection after > the second pg_exec command. > In fact, by using persistent connections I've partially corrected the > problem and the codes doesn't complain about using an invalid (but not null) > connection descriptor; but it stills be unable to get results from > successive queries, also if result index are valid ! This sounds very > strange for me. > > Thank you for your help ! > > Luca Lazzeroni > > "Nuno Silva" <[EMAIL PROTECTED]> ha scritto nel messaggio > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > >> Hello, >> >> if the second query loops inside a _for_ statement and needs values from >> the first query you have two options: >> >> 1. save all the results from query one to some array and then loop >> inside the array within the _for_ statement executing new sql; >> 2. open two separate connections to the database and work with the two. >> like this: >> $conn1 = pg_connect(...); >> $conn2 = pg_connect(...); >> ... >> qry1 = pg_exec($conn1, $sql1); >> ... >> for ($i=.) { >> ... >> $qry2 = pg_exec($conn2, $sql2); >> ... >> } >> >> Hope this helps, >> Nuno Silva >> >> >> Luca Lazzeroni wrote: >> >> >>> Hi, >>> I've recently migrated a system with PHP 4.0.3pl1 and PostgreSQL 7.0.2 - >>> RedHat Linux 5.1 (yes 5) to a new one with PHP 4.0.4pl1 - PostgreSQL >> > 7.0.2 - > >>> RedHat Linux 7.0. >>> >>> All my database applications work fine except one which does strange >> > things: > >>> this is a piece of code: >>> >>> 8<--- CUT >>> >>>$conn = pg_connect("dbname= user=y password=xx"); >>> >>>$sql = "select * from table_a where condition_a"; >>>$qry1 = pg_exec ($conn,$sql); >>> >>>$obj1 = pg_fetchobject($qry1,0); >>> >>> // Until here everything works fine >>> >>>$sql2 = "select * from table_b where condition_b=".$obj1->value_a; >>>$qry2 = pg_exec ($conn,$sql2); >>> >>> 8<--- CUT >>> >>> The second query is nested in a for-loop running for every object in the >>> first query; for performance reason I need to maintain the two queries >>> independent. >>> >>> After executing (correctly) the first one, the system starts doing >> > strange > >>> things with the second one: >>> >>> Warning: Unable to jump to row 0 on PostgreSQL result index 23 in >> > cerca.php3 > >>> on line 467 >>> >>> and it fails to read data. >>> The strange thing is that the system does the same things for EVERY >> > database > >>> where I must use two consecutive queries ! >>> >>> Is there anyone who can help me ? >>> >>> Thanks in advance >>> >>> Luca Lazzeroni >> >> >> -- >> 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 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]
Re: [PHP] Cookies
Ola, utiliza um numero mui grande! :) ;) Nuno Francesc Lladó wrote: > > > Utilizo este código para depositar una cookie en el cliente, lo único > que me caduca al cabo de un tiempo, ¿alguién sabe qué es lo que tengo > que poner para que la cookie no caduque nunca? > > Gracias > > -- > Francesc Lladó i Dardet > [EMAIL PROTECTED] > > Interkonet Publishers s.l. > Atenes 22 > 08006 Barcelona > Tel. 932 530 866 > Fax. 932 530 866 > http://www.interkonet.com > [EMAIL PROTECTED] -- 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]
Re: [PHP] fsockopen question
Hi, the way i would do it looks like this: - setup stunnel (www.stunnel.org) to listen to port 10443 in the 127.0.0.1 interface and forward that to www.myprovider.com - the php script would connect to 127.0.0.1:10443 using plain text - that's it, easy and clean! :) stunnel will hapilly forward the 127.0.0.1:10443 to the destination encripted and you will have to deal with the easy part of it! ;) Regards, Nuno Silva Michael Conley wrote: > I am looking to process credit card transactions on my site. In order to do > this, I need to open a socket to a particular URL. I then submit an XML > string to them. They process the string and send me a response. > > I am going to a certain (secure) location on the site of my credit card > processor (https://www.myprovider.com/XMLSubmit/processtrans.asp) and then > submit the XML string. After I submit all of the XML, the processor will > give me a response as to whether or not the transaction is approved. > > How do I send the XML string to the above URL? When I use fsockopen, it > doesn't like anything other than an IP address or a host name (ie > www.myprovider.com). I don't even really see where to force this to go over > HTTPS. I set the port to 443, but need to be sure that the data going > across uses SSL. > > How do I send this XML string over HTTPS to > https://www.myprovider.com/XMLSubmit/processtrans.asp? > > > > attachment.txt > > Content-Type: > > text/plain -- 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]
Re: [PHP] mysql - SUBSTRING
hello, i would try this: SELECT SUBSTRING(field,pos,len) AS mystring, id, blah FROM mytable WHERE mystring LIKE '%ABC%'; regards, Nuno Silva andreas (@work) wrote: > hi, > > if i use SUBSTRING(field,pos,len) in a SELECT statement it works fine > > but i cant work it out how to use this function in the WHERE clause > > ... WHERE SUBSTRING(field,pos,len) LIKE "ABC" > ... WHERE SUBSTRING(field,pos,len) = 'ABC' > ... WHERE SUBSTRING(field,pos,len) LIKE 'ABC' > > none of them work > > is this not possible or whats wrong ? > > > thank you > > andreas > > > -- 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]
Re: [PHP] HTTP socket connection
Hi, install http://stunnel.org/ in localhost: and redirect it to remote_host:443 with stunnel ;) now you can talk "simple" http to localhost: and let stunnel do the dirty work. Hope this helps, Nuno Silva phpman wrote: > I've been working with curl as well. It allows a pretty easy method to > access https, however it is > limited as far as encrypting data and sending to an https server. So now i'm > experimenting with > snoopy to simulate a web client. I'm trying to link up with UPS online > tools, but the sob's only > know java. I've posted to this news group with questions pertaining to this > stuff, but nobody > seems to understand what I'm talking about. There has to something out > there, as I'm sure > somebody has to have done this before. > > -dave > > > ""Tolga "thorr" Orhon"" <[EMAIL PROTECTED]> wrote in message > 9e3no5$hld$[EMAIL PROTECTED]">news:9e3no5$hld$[EMAIL PROTECTED]... > >>As far as I know you cant do that with standard socket connection as SSL >>needs more than that. One solution that I am currently using is using Curl >>extensions of PHP which is working just fine. But you may need to >> > recompile > >>PHP with curl support. For more info: >> >>http://www.php.net/manual/en/ref.curl.php >>http://curl.haxx.se/ >> >>Tolga 'thorr' Orhon >> >>"Todd Cary" <[EMAIL PROTECTED]> wrote in message >>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]... >> >>>For my http socket connection, I am using >>> >>> "POST $abs_url HTTP/1.0\r\n". >>> "Accept-Language: en-us\r\n". >>> "Host: $host:$port\r\n". >>> "Connection: close\r\n". >>> "Content-type: application/x-www-form-urlencoded\r\n". >>> >>>which works great. >>> >>>What do I need to change for a SSL connection? >>> >>>Todd >>> >>>-- >>>Todd Cary >>>Ariste Software >>>[EMAIL PROTECTED] >>> >>> >>> >>>-- >>>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 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 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]
Re: [PHP] executables (.exe)
Hi, just make the cgi version of php and feed some script to it ;) in unix you can start the script with: #!/path/to/php -q good luck, Nuno Christian Dechery wrote: > Correct me if I'm completely out of my mind here (often I am). > > But I think, I read somewhere that u can compile .php files and make > executables of them to run in the command line like programs... is this > true? How can I get it to work? WHat do I need? > > . Christian Dechery (lemming) > . http://www.tanamesa.com.br > . Gaita-L Owner / Web Developer -- 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]
Re: [PHP] Very Easy Help Needed Quick!
Hi, point the link "save this..." to the same script with some trailling vars: ... and then, in the beginning of this_script.php modify the mime type if $HTTP_GET_VARS["save"] == 1 if ($HTTP_GET_VARS["save"] == 1) { header("Content-type: application/octect-stream"); } ...thats it! regards, Nuno Tony Daniels wrote: > Hello Everyone! > > We need something that is probably very simple. > > Here is what we are doing. > > We created a form that asks a series of questions about the product we > are looking at, such as : Name, Condition, Weight, etc. We then put all > of the information in a MySql database. Then sedn the variables to the > ad creation page. This page contains all the constant information > contained in each ad, along with all the new variables that we just > inputted. What we need to do is save this new source code to a html > file. We have been simply right clicking, viewing source, and then > saving it to our hard drive. > > What we want is a button below the ad that says, "Do you want to save > this ad?" or simply "Save?" When we click yes it will prompt us on the > name and the location we want for the file, and then it will save the ad > in html format. One important note is that we do not want this new > button included in the file we are creating. Anyone have a simple code > we can use to accomplish this. Remember, all we want is the ad saved, > not the new button. We want to view the ad before we save it, so the ad > must pop up like it does now. > > Please help soon. We appreciate your help. > > Tony -- 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]
Re: [PHP] Cookie problem
Hello, short: try removing the third parameter to setcookie and if the errors go away you know it's a cookie problem :) long: you're setting auth based in the (server's) time + 600sec. If the client (or even the server) has a clock skew... well bad luck :) removing the third parameter makes php create a "session cookie" that will stay there until the browser is closed (alll the windows). If this is not a problem, let it be. I love session cookies!! :) Anyway, the best method to get decent auth are sessions. Try php4's sessions or phplib or something. Regards, Nuno Martin Skjöldebrand wrote: > I'm experiencing all kinds of problems with, what we suppose is the cookie > setting. This is the code: > > if (isset($authentication)) { > setcookie("status", $status, time()+600); > setcookie("user", $user, time()+600); > setcookie("group", $group, time()+600); > setcookie("authentication", $authentication, time()+600); > setcookie("laston", $laston, time()+600); > } > else { > setcookie("status", "Logged In", time()+600); > setcookie("user", $txtUsername, time()+600); > setcookie("group", $row[4], time()+600); > setcookie("authentication", "YES", time()+600); > setcookie("laston", $row[6], time()+600); > } > > (I have not coded this). > > What seems to happen is that - with alarming regularity - people are > getting logged off when choosing item from a menu. Either they are thrown > out into the log on-screen or (as has happened to me recently) the app > simply states I'm not logged on even if I am in the middle of using it (and > must have logged on). > > I'm not at all familiar with cookies (yet) but suspect that the timing of > the critters could be a culprit. IS this correct? > How do I solve the problem? > > M. -- 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]
Re: [PHP] equivalent to PERL's qq
hi, try: i'd say it's even better than qq ;) regards, nuno Carsten Gehling wrote: > From: "Michael Hall" <[EMAIL PROTECTED]> > Sent: Monday, March 26, 2001 9:36 PM > > > >> Hi. I'm a converted Perl guy. While I generally like PHP better than > > Perl, > >> I do severely miss the Perl operator qq, which allowed statements (in my >> case, lengthy SQL statements) to be written on multiple lines. >> >> $this = qq|Select * >> From xsdfs >> Group by date >> Order by id >> |; >> >> Is there anything similar to this in PHP? I've been unable to find it if >> there is. > > > Check out this page: > > http://php.net/manual/en/language.types.string.php > > and read the paragraphs about the "here doc"´syntax. It might be what you're > looking for. > > - Carsten -- 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]
Re: [PHP] Question on manually instantiating a file download
hello, you could "start from the end" :) show the nice page saying "THANKS!!" or something and this page will call the download script itself with "meta refresh=..." in the ...can't remember the meta refresh syntax right now :) hope it works, Nuno Vikram Vaswani wrote: > Hello all, > > I am working on a script which locates a file on the system and then tells > the browser to pop open the "Save As" dialog box for download. In order to > do this, I am using the following code: > > $filename = $dataDir . $id . ".dat"; > header ("Content-Type: application/octet-stream"); > header ("Content-Disposition: attachment; filename=$filename"); > readfile($filename); > > This works fine - however, I would like to redirect the browser to another > page once the download is complete (or once it starts). I have tried adding a > > header("Location:next.php") > > line to the end of the script above, but it has no effect whatsoever (after > the download is complete, the browser displays an hourglass as though > waiting for something). Do I need to send some kind of "end-of-download" > header...or something else? > > Can anyone suggest some possible solutions to this problem? > > Please CC a copy of your response to > > [EMAIL PROTECTED] > > as well as the list (as I will be working on this @ home also and do not > have access to the full digest there) > > Any help will be much appreciated. TIA, > > Vikram Vaswani > -- > Sex is like air. It's only a big deal if you can't get any. -- 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]
Re: [PHP] Super User Script?
hi, the best way to do this from a webserver (apache module) is to make php write some script that crond later executes as root (or some other user). anyway, you should triple check everything for security bugs... and three times isn't enough :) regards, Nuno Silva Brandon Orther wrote: > Hello, > > Is there anyway I can have my script turn super user at the beginning when > it runs? > > Brandon -- 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]
Re: [PHP] Shell Programming with PHP, but where is the PHP?
:) yes, just ./configure (don't use --with-apache or --with-apxs) [other options] make cp php /usr/local/bin (or whatever) regards, Nuno Silva Brandon Orther wrote: > Hello, > > It is installed as a module, Is there a way I can keep it installed as a > module but install it so I can use it to shell script also? > > Thanks Ahead Of Time > Brandon > > -Original Message- > From: Renze Munnik [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 03, 2001 8:32 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Shell Programming with PHP, but where is the PHP? > > > Brandon Orther wrote: > >> Hello, >> >> I am looking for the path to my php so I can put it on the top of > > my php > >> script. Like this: #!/path/to/php >> >> All I can find that looks like this is libphp4.so Does anyone know where > > to > >> look for the binary? >> >> Thanks >> Brandon >> >> -- >> 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] > > > Try locate and/or whereis. > And you should make sure PHP isn't installed as module. > -- > > * R&zE: > > *** > ** Renze Munnik > ** > ** E: [EMAIL PROTECTED] > ** M: +31 6 218 111 43 > *** > > -- > 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 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]
Re: [PHP] Shell Programming with PHP, but where is the PHP?
Hi, full instructions follow: download the latest php tarball from: http://www.php.net/do_download.php?download_file=php-4.0.4pl1.tar.gz&source_site=www.php.net then extract it: tar xzf php*tar.gz then cd to it: cd php* then configure it: ./configure the compile it: make then install it (as root do:) make install this should give you a command line php in: /usr/local/bin please note that ./configure may need some options for database access and stuff, just don't use --with-apache or --with-apxs good luck, Nuno Silva Brandon Orther wrote: > When I type: make it does nothing??? What am I supposed to be typing? > > -Original Message- > From: Nuno Silva [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, April 03, 2001 9:19 AM > To: Brandon Orther > Cc: PHP User Group > Subject: Re: [PHP] Shell Programming with PHP, but where is the PHP? > > > > :) > yes, > > just > ./configure (don't use --with-apache or --with-apxs) [other options] > make > cp php /usr/local/bin (or whatever) > > regards, > Nuno Silva > > Brandon Orther wrote: > > >> Hello, >> >> It is installed as a module, Is there a way I can keep it installed as a >> module but install it so I can use it to shell script also? >> >> Thanks Ahead Of Time >> Brandon >> >> -Original Message- >> From: Renze Munnik [mailto:[EMAIL PROTECTED]] >> Sent: Tuesday, April 03, 2001 8:32 AM >> To: [EMAIL PROTECTED] >> Subject: Re: [PHP] Shell Programming with PHP, but where is the PHP? >> >> >> Brandon Orther wrote: >> >> >>> Hello, >>> >>> I am looking for the path to my php so I can put it on the top of >> >> my php >> >> >>> script. Like this: #!/path/to/php >>> >>> All I can find that looks like this is libphp4.so Does anyone know where >> >> to >> >> >>> look for the binary? >>> >>> Thanks >>> Brandon >>> >>> -- >>> 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] >> >> >> Try locate and/or whereis. >> And you should make sure PHP isn't installed as module. >> -- >> >> * R&zE: >> >> *** >> ** Renze Munnik >> ** >> ** E: [EMAIL PROTECTED] >> ** M: +31 6 218 111 43 >> *** >> >> -- >> 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 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 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]
Re: [PHP] Fastest way to encrypt database storage?
Hi, if you want *real* encryption it will never be as fast as XOR :) Anyway, take a look at: http://php.websolut.net/manual/en/ref.mcrypt.php There are some examples too. Regards, Nuno Silva Floyd Piedad wrote: > Hi, > > I want to store all data into mySQL database in encrypted format and > then show it only after decrypting it. What is the fastest way of doing > it? > > Floyd -- 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]
Re: [PHP] ftp_get: possible security hole?
hello, if the script is running as user X (without root privileges) then there is no way that the OS let user X chown file to user Y. recheck the userid the script is running as ;) if the script is running from the web server then it's userid will be www/www as you say. regards, nuno silva Chris Ralston wrote: > Hey, guys, > > Apologies if I should have sent this to the dev list instead. > > It seems to me that ftp_get() is a potential security hole, or maybe we've > just got it misconfigured on our system. When a script calls ftp_get() and > transfers a file, the new file on the local system (e.g. the box running php) > is owned by the webserver. Now this would make sense if the client to the > php script were doing an HTTP upload, but shouldn't an FTP transfer be > created as the user of the script? > > We're running PHP 4.0.4pl1 in "safe mode" under Apache 1.3.9. Apache is > running as www/www and the script is run as John Q. User. > > If this can be used to create arbitrary files as the webserver, it seems like > any legitimate user can create malicious scripts, ftp_get() them so that they > are owned by the webserver user, then run them just by surfing to the new > file. Even with safe mode and "php_admin_value docroot" set, it seems like > there'd be a variety of "attacks" a user could do, if s/he were so inclined. > > I'm not a hacker (so looking at php's source wouldn't help me), but I'm a > concerned sysadmin who's suddenly very scared of the --with-ftp configure > directive. > > -Chris -- 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]
Re: [PHP] postgres and php
hi there! the operators you want are ~ and ~* and !~ and !~*. select name from table where name ~* 'test'; to see all operators availlable type \do in psql's interactive mode ;) Regards, Nuno Silva Derek wrote: > anyone know how I force a case insensitive search through a postgres > database. > > I've got a search looking for 'something like '%something%' but this won't > find 'SOMETHING'...if you know what I mean!? > > Thanks in advance for any help > > Derek > > > > -- 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]
Re: [PHP] but mysql? (was: postgres and php)
hello, [EMAIL PROTECTED] wrote: > Hi Nuno! > On Sat, 14 Jul 2001, Nuno Silva wrote: > > >>hi there! >> >>the operators you want are ~ and ~* and !~ and !~*. >>select name from table where name ~* 'test'; >> > > any idea of something like this in MySQL? I was used to pg and I have no idea > of something equivalent in My. > these operators do regexp matches in postgresql. to do this in mysql you have the REGEXP operator: http://www.mysql.com/doc/R/e/Regexp.html Hope it helps, Nuno Silva >>to see all operators availlable type \do in psql's interactive mode ;) >> >>Regards, >>Nuno Silva >> >>Derek wrote: >> >> > -- teodor > > -- 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]
Re: [PHP] instalando o php
Viva, no ficheiro INSTALL da distribuição do php tens instruções passo-a-passo. Basta segui-las, mas para quem não tem prática pode parecer estranho. Aconselho a ler o ficheiro várias vezes ;) http://php.net/manual/pt_BR/installation.php é outra hipotese.. nem tudo está em português. Boa sorte, Nuno Silva Daniel Janzen wrote: > Instalei o servidor apache e agora estou configurando o php alguém sabe de algum >lugar que tenha a instalação passo-a-passo? > > Obrigado... > > -- 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]
Re: [PHP] Persistent connections and transactions
Frank Joerdens wrote: > On Fri, Jan 26, 2001 at 11:01:14AM +0000, Nuno Silva wrote: > [ . . . ] > >> i ran across this transaction problem vs. persistent conn in pgsql some time ago. >> >> I found two workaround methods: >> - don't use persistent conn's :-) or; >> - start every conn with the usual pg_pconnect and then query a rollback to the >server: >> $query="ROLLBACK work;" >> >> (this will kill any supposed transaction in ABORT STATE that some child had left). >> >> postgres don't support nested transactions (yet), but when it does maybe you should >add multiple "ROLLBACK WORK;" queries :-) > > > Ah. Very cool. What I _still_ don't quite understand, though, is _how_ > exactly this situation could come about. And what the worst case would > be. What if you don't kill the transaction in ABORT STATE? > > Ta, Frank > Hi, this happens because pg_pconnect don't know about transactions. If some transaction reach ABORT and for some reason the script never makes it to COMMIT or ABORT queries the postgresql backend will be _always_ in ABORT STATE. The problem is present in several combinations... for instance: in mysql you could make the connection with one user to database X. While logged in you could change to database Y This database backend will be in database Y after that! Even if you persistent_connect with the original parameters! This is because the backend is never terminated and retains the last state, being it a ABORT STATE or another DB... :) queriing "ROLLBACK WORK;" right after the conect is my best shot at this one. Regards, Nuno Silva -- 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]
Re: [PHP] Dynamic Variable Creation from Forms
[ rswfire ] wrote: > I have a problem I'm not sure how to fix. > > PART I > > I have a form on a page that creates its variables dynamically. > Here's an example: > > mysql_db_query($db, "SELECT * FROM table"); > while ($row = mysql_fetch_array($result)) > { > > echo ""; > > } > > PART II > > I need to make reference to these dynamically created variables. How > do I do this? This does not work, obviously: > > $chk_.$row["checkboxtype"] > > Thanks in advance... > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com > > $temp = "chk_$row"; echo $$temp["checkboxtype"]; the trick is $$var_name ;) have fun, Nuno -- 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]
Re: [PHP] LOCK TABLES x COMMIT/ROLLBACK
Richard Lynch wrote: [snip...] > I think the idea is this: > > 1. LOCK TABLES invovled. > 2. Get the current values for all records you are about to change. > 3. Attempt to make changes. > 4. If any of the attempted changes fails, change back the ones that > succeded.* you just can't relie on this... imagine that you stop apache just in the middle of the script... or imagine some power outage or some segfault... whatever... you manual "rollback" will not succeed :( the only cenario that a lock can (securelly) replace a transaction is when you're UPDATING (_not_ inserting or deleting) only ONE table. > 5. UNLOCK the TABLES > > * Or maybe UNLOCK lets you somehow rollback?... > * And if your attempt to undo the changes you already did fails, you'll need > some code to alert a human to straighten out the mess you've made after they > fix whatever is making the code not work in the first place. > > You might have an easier time porting to a database that actually supports > transactions...:-) > > http://postgresql.org yes, this would be my bet :) > > Or, the latest version of MySQL, but I dunno how stable their transaction > support is yet... > > -- > Visit the Zend Store at http://www.zend.com/store/ > Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm > Volunteer a little time: http://chatmusic.com/volunteer.htm > > > Regards, Nuno Silva -- 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]
Re: [PHP] E-mail Validation Question
Jeff Oien wrote: > Just a curiosity. I installed and tested Manuel Lemos's > PHP E-mail validation class. When I entered an address > at the @wi.rr.com domain, no matter what I put before > the domain, it would come back as valid. (That's the > Wisconsin domain for Road Runner cable service.) But > when I tried it for @earthlink.net only real addresses > came back as valid. Does anyone know what it is about > some mail servers at certain domains that it would return > everything as valid? > Jeff Oien > > so [EMAIL PROTECTED] would show as a valid address. > [EMAIL PROTECTED] wouldn't but [EMAIL PROTECTED] would > hi, this happens because some MTA's don't allow certain commands to be issued (security feature), qmail for instance... the class acts like it should: it tells you that the email is valid. (it's better than refusing a valid email...) regards, Nuno Silva -- 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]
Re: [PHP] Header ("location: test.php");
Christopher Allen wrote: > Hello, > I am using the Header call in a script that has multiple submit buttons: > > if ($submit =1) > { > Header (location: test1.php); > } > if ($submit ==2) > { > Header(location: test2.php); > } > > Should not the form varaibles be passed along to each of these pages > respectively? I have about 30 variables that should be passed to each > different page...none of these variables are showing up. Do I need to attach > these to the url for each different header? > such as: > Header ("Location: test1.php?add=1&name=juan"); > ??? > > Thanks > > Christopher C. M. Allen > > yes -- 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]