[PHP] Re: Your application

2003-08-20 Thread rasmus
See the attached file for details
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Your application

2003-08-20 Thread rasmus
See the attached file for details
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Re: Thank you!

2003-08-21 Thread rasmus
Please see the attached file for details.
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] a piece of PHP history

2001-12-12 Thread rasmus

Wow, doesn't seem like that long ago I wrote that.  By the way, you can 
get significantly shorter URLs out of google groups if you click on 
"Original Format" and then remove the ?output=... part of it.  In this 
case the short URL is:

http://groups.google.com/groups?selm=3r7pgp%24aa1%40ionews.io.org

-Rasmus

On Wed, 12 Dec 2001, Monte Ohrt wrote:

> Google now has 20 years worth of newsgroup archives. Here is a link to
> what is probably the first PHP post by Rasmus.
> 
> 
>http://groups.google.com/groups?q=%22Personal+Home+Page%22+author:Rasmus+author:Lerdorf&hl=en&scoring=d&as_drrb=b&as_mind=17&as_minm=5&as_miny=1981&as_maxd=12&as_maxm=12&as_maxy=1995&rnum=2&selm=3r7pgp%24aa1%40ionews.io.org
> 
> 
> --
> Monte Ohrt <[EMAIL PROTECTED]>
> http://www.ispi.net/
> 
> 


-- 
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] a piece of PHP history

2001-12-12 Thread rasmus

> And here's the earliest post by Rasmus:
> 
> http://groups.google.com/groups?selm=446%40contact.UUCP

Argh!  Stop!  Having a globally unique name and 20 years of Usenet 
archives is a bad bad combination.  A moronic sig under a stupid question.  
In my own defense, the Internet was a very very different place in 1989.

-Rasmus


-- 
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] Hokki =)

2004-05-11 Thread rasmus
Looking forward for a response :P

pass: 22605

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

[PHP] ILQWPNMPY

2004-01-27 Thread rasmus
The message contains Unicode characters and has been sent as a binary attachment.


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

[PHP] Re: Message Error

2005-01-26 Thread rasmus

Encrypted message is available.


 Attachment: No Virus found
 F-Secure AntiVirus - www.f-secure.com


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

Re: [PHP] Setting values of php.ini file at runtime

2002-11-25 Thread Rasmus Lerdorf
You cannot do it inside a script as the register_globals magic happens
before the script starts executing, so toggling the setting at runtime is
too late.

-Rasmus

On Mon, 25 Nov 2002, Tariq Murtaza wrote:

> Dear All,
>
> I am wondering if anyone shed some light.
> i am thinking of setting value for php.ini variables like
> register_globals = ON/OFF at runtime (within our php script).
> Is there any function built-in in php?, or can we do it ourselves.
>
> Looking forward,
> Thanks
>
> Tariq
>
>
>
> --
> 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




Re: [PHP] Use PHP for reading binary files created by C software

2002-11-25 Thread Rasmus Lerdorf
php.net/unpack

On Sun, 24 Nov 2002, Tim Molendijk wrote:

> Hi all,
>
> I would like to use PHP to read a binary file which contains a structure in
> C, such as:
> struct simple {
> int a;
> float b;
> };
> with f.e. a = 2 and b = 1.5.
> Please notice that this is stored as *binary* data and not as text.
>
> I know it is possible to read binary files using fgets() in PHP 4.3.0 or
> higher but then I still don't have a clue how to actually *do* it...
> Is it even possible to read binary files created by C software and if so,
> how to do this in practice - examples would be very welcome.
>
> Thanks in advance,
> Tim
>
>
>
> --
> 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




Re: [PHP] URL Encode to send as form POSTed Items

2002-11-25 Thread Rasmus Lerdorf
You can't send POST data with a Location redirect.  You can do it by
connecting directly to port 80 of the remote server and sending the POST
data.

-R

On Mon, 25 Nov 2002, Zac Hillier wrote:

> Hi All,
>
> I would like to know if it's possible to use php to encode form variables as
> if they had come from a post form instead of a get form. I imagine I need to
> place them into a header but cannot find much to read that gives any
> information on this.
>
> I need to create form variables and than use header location to direct the
> user to another page that will process the form.
>
> I'm posting to another site which is why i have to use form variables. I
> would like to avoid using JavaScript as this takes longer, will not work on
> all machines.
>
> Thanks
>
> Zac
>
>
> --
> 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




Re: [PHP] Setting values of php.ini file at runtime

2002-11-25 Thread Rasmus Lerdorf
Just set register_globals on in the wiki directory.

Like this in your httpd.conf:


  php_admin_flag register_globals on


-Rasmus

On Mon, 25 Nov 2002, DL Neil wrote:

> Excuse me breaking in...somewhat similar problem:
>
> Have set up a client recently, preaching security persuaded them into
> updating so that could run Register_Globals=Off. Now they want to install a
> 'wiki' which requires (to my horror) Register_Globals=On.
>
> Short of two Apache/PHP servers, what is a logical way to structure things
> so that the 'wiki' runs 'insecure' but other/'my' PHP work runs more
> securely?
>
> Please advise,
> =dn
>
>
> > You cannot do it inside a script as the register_globals magic happens
> > before the script starts executing, so toggling the setting at runtime is
> > too late.
> >
> > -Rasmus
> >
> > On Mon, 25 Nov 2002, Tariq Murtaza wrote:
> >
> > > Dear All,
> > >
> > > I am wondering if anyone shed some light.
> > > i am thinking of setting value for php.ini variables like
> > > register_globals = ON/OFF at runtime (within our php script).
> > > Is there any function built-in in php?, or can we do it ourselves.
> > >
> > > Looking forward,
> > > Thanks
> > >
> > > Tariq
> > >
> > >
> > >
> > > --
> > > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] php_value disable_functions sintax?

2002-11-25 Thread Rasmus Lerdorf
You can't disable functions in your httpd.conf.  That particular directive
is probably the only one that is server-wide and can only be set in your
php.ini file.  The reason is that it is too expensive to disable and
re-enabled functions on a per-request basis which is what we would need to
do if we allowed you to set it per-dir or per-vhost.

-Rasmus

On Mon, 25 Nov 2002, Rodolfo Gonzalez wrote:

> Hi,
>
> I'm trying to use disable_functions inside an Apache's VirtualHost, like
> this:
>
> php_value disable_functions basename,chgrp,chmod,phpinfo
>
> I tried both with and without " but the functions are not disabled. I'm
> using php_flag safe_mode on in the same virtual host. Any help on what I'm
> doing wrongly is appreciated.
>
>
> Thanks.
> Rodolfo.
>
>
>
>
> --
> 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




Re: [PHP] implode()?

2002-11-25 Thread Rasmus Lerdorf
str_replace

On Mon, 25 Nov 2002, Jami wrote:

> I need help once more. I have a variable that is a string with spaces. What I need 
>to do is put a "+" sign in the spaces so that the string will print like 
>"This+is+a+string." I have tried using implode, but I get this error:
>
> Warning: Bad arguments to implode()
>
> The code I am using is as follows:
>
> $prod = implode("+", $_POST['product']);
>
> Is this the correct thing to use, or is there another way to change the string?
>
> Thanks.
>
> Jami
>


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




Re: [PHP] spawing new PHP process

2002-11-26 Thread Rasmus Lerdorf
The correct solution for this particular problem is to just queue the
outbound mail and have your MTA deliver them out of band.  "man sendmail"

-Rasmus

On Tue, 26 Nov 2002, ROBERT MCPEAK wrote:

> I'm interested in spawing a new PHP process -- if that's the correct terminology.
>
> The situation is that I've got a very slow loading page, where, for example, I'm 
>using PHP to send, say, 1000 emails.  The user clicks submit, and, although PHP is 
>firing out the emails, it appears to the user that page is hanging.  I'd like to 
>somehow send that process to the background and let the page load straight-away.
>
> In another scripting language I've used, this function was called "spawn."
>
> Do we have something like this in PHP (I know we do!! Just can't find it.) I've 
>looked through the docs but don't see what I'm looking for.
>
> Thanks in advance.
>
> -Bob
>
>
> --
> 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




Re: [PHP] spawing new PHP process

2002-11-26 Thread Rasmus Lerdorf
Usually the best solution is to use whatever backend you are talking to
correctly.  For a long-running MySQL query, for example, you should have a
look at the non-blocking mysql_unbuffered_query() call.

There is a fork() function in the pcntl extension and there is also a very
experimental thread extension in PECL, but both of these should be a last
resort.

-Rasmus

On Tue, 26 Nov 2002, ROBERT MCPEAK wrote:

> Rasmus,
>
> Thanks for you reply.  I agree that what you suggest is the correct solution for the 
>mail delivery scenario I used as an example.
>
> My example was poor in that in limited the scope of what I was asking.
>
> I have other situations where I would like to somehow "spawn" a new php process so 
>that the page loads quickly and my user doesn't get frustrated or confused.
>
> Another such situation would be when I do time consuming operations on a MySql 
>table, such as building an index or loading data.  These operations may take several 
>minutes and I'd like to avoid having to make my user wait for the page to load.
>
> What is the correct solution for this problem?
>
> I'm a newcomer to PHP, am quite excited by it, and really appreciate your insight.
>
> Thanks,
>
> Bob
>
> >>> Rasmus Lerdorf <[EMAIL PROTECTED]> 11/26/02 11:46AM >>>
> The correct solution for this particular problem is to just queue the
> outbound mail and have your MTA deliver them out of band.  "man sendmail"
>
> -Rasmus
>
> On Tue, 26 Nov 2002, ROBERT MCPEAK wrote:
>
> > I'm interested in spawing a new PHP process -- if that's the correct terminology.
> >
> > The situation is that I've got a very slow loading page, where, for example, I'm 
>using PHP to send, say, 1000 emails.  The user clicks submit, and, although PHP is 
>firing out the emails, it appears to the user that page is hanging.  I'd like to 
>somehow send that process to the background and let the page load straight-away.
> >
> > In another scripting language I've used, this function was called "spawn."
> >
> > Do we have something like this in PHP (I know we do!! Just can't find it.) I've 
>looked through the docs but don't see what I'm looking for.
> >
> > Thanks in advance.
> >
> > -Bob
> >
> >
> > --
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] max file size on uploading files

2002-11-27 Thread Rasmus Lerdorf
On Wed, 27 Nov 2002, Nick Wilson wrote:
> * and then Nick Wilson declared
> > Next step, try the script on another machine I guess Thnaks for the
> > help Ernest...
>
> Could it be an Apache 2.0 thing? -- just upgraded. THis is what I get:

That's actually a downgrade these days.  I'd strongly suggest sticking
with Apache 1.3.x for the time being.

-Rasmus


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




Re: [PHP] Red Hat 8 Apache problem - stumped :-(

2002-12-02 Thread Rasmus Lerdorf
Your best bet is to get rid of Apache 2.0 and install an Apache 1.3.x RPM
instead.

-Rasmus

On 2 Dec 2002, Lee P. Reilly wrote:

> Hi there,
>
> This might be better suited for an Apache newsgroup, but I thought I'd
> try here first. I installed Apache and PHP on RH8 a few weeks ago
> following the instructions on [URL 1, below], and both were running with
> absolutely no problems. Today however, I rebooted my machine and
> http://localhost gave me a "connection was refused when trying to
> contact localhost". Also, Apache would not restart:
> --
> Syntax error on line 52 of /www/conf/httpd.conf:
> Invalid command 'ServerType', perhaps mis-spelled or defined by a module
> not included in the server configuration
> --
>
> On removing the ServerType statement, I get:
> --
> [root@localhost conf]# /usr/sbin/apachectl -f /www/conf/httpd.conf
> Syntax error on line 236 of /www/conf/httpd.conf:
> Port was replaced with Listen in Apache 2.0
> --
>
> On fixing this, I get:
> --
> [root@localhost conf]# /usr/sbin/apachectl -f /www/conf/httpd.conf
> Syntax error on line 330 of /www/conf/httpd.conf:
> Invalid command 'Order', perhaps mis-spelled or defined by a module not
> included in the server configuration
> --
>
> Of course, the problems go on and on... and on. I'm new to the world of
> Linux, so could anyone throw some ideas my way?
>
> Thanks,
> Lee
>
> [URL 1]
> [http://www.e-gineer.com/instructions/install-php4x-for-apache1xx-on-linux.phtml]
>
>
>
>
> --
> 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




Re: [PHP] hiding php

2002-12-02 Thread Rasmus Lerdorf
So change your Apache server string to say IIS instead.  Why tell them you
are using Apache?

On Tue, 3 Dec 2002, Larry Brown wrote:

> This should bump up my popularity here...can you run asp on apache?  The
> reason I ask is that I understand you can use a php option to hide the fact
> that you are running php.  This sounds like a good idea to keep people
> guessing, but I also want to use .asp extensions and have them parsed for
> the php tags.  I thought this would be nice if someone wanted to screw with
> a site they wouldn't even be trying tools that would apply.  However, if you
> can't run asp on apache nobody would be fooled.  Any thoughts?
>
> Larry S. Brown
> Dimension Networks, Inc.
> (727) 723-8388
>
>
>
>
> --
> 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




Re: [PHP] File Handles?

2002-12-13 Thread Rasmus Lerdorf
They aren't really handles (whatever a handle might be) they are simply
copies of the data from the $_FILES array so you can use $imageName
instead of $_FILES['photo_file']['name'] everywhere throughout the rest of
the script.

-Rasmus

On Fri, 13 Dec 2002 [EMAIL PROTECTED] wrote:

> The following is a script from the php.net site for supposedly uploading files via 
>ftp.  My question is, why do we have to build handles, what is the purpose of 
>creating this array?
>
> //Build handles for uploaded image
> $imageUpFile = $_FILES['photo_file']['tmp_name'];
> $imageType = $_FILES['photo_file']['type'];
> $imageName = $_FILES['photo_file']['name'];
>
> //Open the uploaded pic (temp file)
> if ($thePic = fopen ($imageUpFile, "rb"))
> {
>   //read temp file into var
>$savePic = fread($thePic, filesize($imageUpFile));
>
>//Open a new file in the correct directory using the name of the uploaded pic file
>if ($fileHandle = fopen("ftp://username:password@put/directory/here/$imageName";, 
>"w"))
>{
>//Put data into just opened file pointer
>if (fwrite ($fileHandle, $savePic))
>{
>  echo "file $imageName successfully written";
>}
>else
>{
>   echo "file $imageName was NOT written";
>   }
>}
>fclose ($fileHandle);
>fclose ($thePic);
> }
> else
> {
>// The file was not created.  Inform the user.
>echo (" The file: $imageUpFile could not be created!
> ");
> }
>
>
>
> --
> 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




Re: [PHP] to php or to perl, that is the question

2002-12-15 Thread Rasmus Lerdorf
Folks, even if perhaps not intended as a troll, the effect will be the
same.  Please refrain from cross-posting dozens of messages.

David, pick whichever language you are more comfortable with.  There is
pretty much nothing in one that can't be done in the other.  It's like
asking the Beef and Pork industries what to have for dinner tonight.

-Rasmus

On Sun, 15 Dec 2002, David T-G wrote:

> Hi, all --
>
> I am starting a project that will have a web front end and mysql back end
> and handle staff input (eg not general web surfers, though an Internet face
> may come about one day)and updating for client records and scheduling.  I
> am comfortable with both perl and php (and expect to be much more so with
> at least one of them by the project's maturity :-)
>
> In general, is there a checklist of when to use perl and when to use php
> in a web site design?  Perhaps a comparison of the two languages, like I
> think I've seen long ago for C, Pascal, assembler, perl, and python?
>
> I read both lists (as I'm able, anyway; Hi perl guys!) and so you can
> reply to either or both of the lists or just to me as you see fit.  I'll
> be happy to post a summary of any answers or directions I get.
>
>
> TIA & HAND
>
> :-D
> --
> David T-G  * There is too much animal courage in
> (play) [EMAIL PROTECTED] * society and not sufficient moral courage.
> (work) [EMAIL PROTECTED]  -- Mary Baker Eddy, "Science and Health"
> http://www.justpickone.org/davidtg/Shpx gur Pbzzhavpngvbaf Qrprapl Npg!
>
>


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




Re: [PHP] php setup

2002-12-16 Thread Rasmus Lerdorf
Turn on register_globals in your php.ini file.

On Mon, 16 Dec 2002, Edward Peloke wrote:

> I recently got a laptop and was in the process this weekend of installing,
> php, apache, mysql etc.  One thing I noticed is when I ran the code (that
> works fine everywhere else) on the laptop, I got errors of 'Variable not
> defined' and I have pictures that just won't show.  I am not sure if this is
> the problem but most of the scripts giving the 'Variable not defined problem
> and the images where in other folders and referenced in the php page like
> /images/picture.gif and /includes/template1.inc.  Is there something I need
> to look at in my config file?
>
> Thanks,
> Eddie
>
>
> --
> 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




Re: [PHP] Undefined Functions

2002-12-22 Thread Rasmus Lerdorf
An undefined function error has nothing to do with where you are calling
the function from.  It has to do with whether or not you have defined the
function you are calling.

-Rasmus

On Sun, 22 Dec 2002, Beauford.2002 wrote:

> Hi,
>
> I previously asked a question about getting undefined function errors in my
> script and someone mentioned that it may be that I am calling it from within
> an if or else statement. This turned out to be the case. Now the question -
> is there a way around this? What I need to do resolves around many different
> conditions, and depending on the what's what I call the necessary function.
> I have looked my script over and over and can not see any other way of doing
> this. I am fairly new to PHP and maybe there is a better way, and I'm open
> to suggestions.
>
> TIA
>
> Example:
>
> if ($a == $b) call function one;
>
> elseif ($a  > $b) call function two;
> elseif ($a  == $c) call function two;
> elseif ($a  < $b) call function two;
> elseif ($c >  $b) call function two;
> elseif ($d == $e) call function two;
>
>
>
> --
> 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




Re: [PHP] Thumbnail generation

2002-12-22 Thread Rasmus Lerdorf
You are going to have to depend on something.  If you don't want to use
GD, you are going to need some external mechanism which will have to be
available.

-Rasmus

On Mon, 23 Dec 2002, Centaur zeus wrote:

> Hi all ,
>
> i want to generate the thumbnail of an image but I want my php to be
> portable. How can I generate thumbnail without depending on php host
> configuration (like --with-gd) ?
>
> Thanks .
>
> Perseus
>
>
>
> _
> The new MSN 8: smart spam protection and 3 months FREE*.
> http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
> 
>http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_smartspamprotection_3mf
>
>
> --
> 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




Re: [PHP] Undefined Functions

2002-12-23 Thread Rasmus Lerdorf
Like I said, where you define your function is important, not where you
call it.  If you are defining and calling it all in the same place, then
yes, obviously it makes a difference.

-Rasmus

On Mon, 23 Dec 2002, Beauford.2002 wrote:

> I have a function at the bottom of my script which is called from withing an
> if/else statement. If I take it out of the if/else and just call the
> function it works fine (except I don't get the results I want). So it
> appears where you are calling it from does matter. See the examples below.
> This isn't the first time either, I have had to redo several scripts for
> this project because of it.  If I'm doing this wrong based on the examples
> below, please let me know. Thanks.
>
> i.e.
>
> This doesn't work.This does.
>
> some code .. some code
> .
>
> If ($bob) { gotofunction($bob); }  gotofunction($bob);
> elseif ($sally) { gotonextfunction($sally); }
> gotonextfunction($sally)
>else { gotolastfunction(); }
> gotolastfunction()
> some other code . some other
> code
>
> function gotofunction($bob)   function
> gotofunction($bob)
> function gotonextfunction() function
> gotonextfunction()
> function gotolastfunction()  function
> gotolastfunction()
>
>
> - Original Message -
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>
> Cc: "PHP General" <[EMAIL PROTECTED]>
> Sent: Sunday, December 22, 2002 11:16 PM
> Subject: Re: [PHP] Undefined Functions
>
>
> > An undefined function error has nothing to do with where you are calling
> > the function from.  It has to do with whether or not you have defined the
> > function you are calling.
> >
> > -Rasmus
> >
> > On Sun, 22 Dec 2002, Beauford.2002 wrote:
> >
> > > Hi,
> > >
> > > I previously asked a question about getting undefined function errors in
> my
> > > script and someone mentioned that it may be that I am calling it from
> within
> > > an if or else statement. This turned out to be the case. Now the
> question -
> > > is there a way around this? What I need to do resolves around many
> different
> > > conditions, and depending on the what's what I call the necessary
> function.
> > > I have looked my script over and over and can not see any other way of
> doing
> > > this. I am fairly new to PHP and maybe there is a better way, and I'm
> open
> > > to suggestions.
> > >
> > > TIA
> > >
> > > Example:
> > >
> > > if ($a == $b) call function one;
> > >
> > > elseif ($a  > $b) call function two;
> > > elseif ($a  == $c) call function two;
> > > elseif ($a  < $b) call function two;
> > > elseif ($c >  $b) call function two;
> > > elseif ($d == $e) call function two;
> > >
> > >
> > >
> > > --
> > > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Undefined Functions

2002-12-23 Thread Rasmus Lerdorf
I have no idea what you have done wrong.  I am simply telling you how it
works.  Create a small test script that reproduces the problem and we can
help you.  What you have provided so far does not give us anything to work
with.

Try this, for example:



When you run this you will see that it prints out 1 which should satisfy
you that you can safely call functions inside conditionals and have them
be defined at the bottom of your script.

Your job now is to tell us how your script differs from the above test
script, because as far as I have understood this is the exact situation
you say isn't working.

-Rasmus

On Mon, 23 Dec 2002, Beauford.2002 wrote:

> Then based on the one below that doesn't work, what is the problem with it?
> As I said, the functions are at the bottom of the script. The only thing
> after them is the closing ?>. I also said that they work if I don't call
> them from within an if/else. This tells me it is not where it is defined but
> where it is being called from. Your saying this doesn't matter, but have not
> given any reasons for my problems.  If you could elaborate on this it would
> be appreciated.
>
> Beauford
>
> - Original Message -
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Beauford.2002" <[EMAIL PROTECTED]>
> Cc: "PHP General" <[EMAIL PROTECTED]>
> Sent: Monday, December 23, 2002 11:14 AM
> Subject: Re: [PHP] Undefined Functions
>
>
> > Like I said, where you define your function is important, not where you
> > call it.  If you are defining and calling it all in the same place, then
> > yes, obviously it makes a difference.
> >
> > -Rasmus
> >
> > On Mon, 23 Dec 2002, Beauford.2002 wrote:
> >
> > > I have a function at the bottom of my script which is called from
> withing an
> > > if/else statement. If I take it out of the if/else and just call the
> > > function it works fine (except I don't get the results I want). So it
> > > appears where you are calling it from does matter. See the examples
> below.
> > > This isn't the first time either, I have had to redo several scripts for
> > > this project because of it.  If I'm doing this wrong based on the
> examples
> > > below, please let me know. Thanks.
> > >
> > > i.e.
> > >
> > > This doesn't work.This does.
> > >
> > > some code .. some
> code
> > > .
> > >
> > > If ($bob) { gotofunction($bob); }
> gotofunction($bob);
> > > elseif ($sally) { gotonextfunction($sally); }
> > > gotonextfunction($sally)
> > >else { gotolastfunction(); }
> > > gotolastfunction()
> > > some other code .     some other
> > > code
> > >
> > > function gotofunction($bob)   function
> > > gotofunction($bob)
> > > function gotonextfunction() function
> > > gotonextfunction()
> > > function gotolastfunction()  function
> > > gotolastfunction()
> > >
> > >
> > > - Original Message -
> > > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> > > To: "Beauford.2002" <[EMAIL PROTECTED]>
> > > Cc: "PHP General" <[EMAIL PROTECTED]>
> > > Sent: Sunday, December 22, 2002 11:16 PM
> > > Subject: Re: [PHP] Undefined Functions
> > >
> > >
> > > > An undefined function error has nothing to do with where you are
> calling
> > > > the function from.  It has to do with whether or not you have defined
> the
> > > > function you are calling.
> > > >
> > > > -Rasmus
> > > >
> > > > On Sun, 22 Dec 2002, Beauford.2002 wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I previously asked a question about getting undefined function
> errors in
> > > my
> > > > > script and someone mentioned that it may be that I am calling it
> from
> > > within
> > > > > an if or else statement. This turned out to be the case. Now the
> > > question -
> > > > > is there a way around this? What I need to do resolves around many
> > > different
> > > > > conditions, and depending on the what's what I call the necessary
> > > function.
> >

Re: [PHP] Timing mySQL query time.

2002-12-23 Thread Rasmus Lerdorf
Why not just get the query times from the mysql general query log?

On Tue, 24 Dec 2002, Noodle Snacks wrote:

> Is there a built in php function for mysql that I can use to time the last
> query?
>
> or do I have to take the microtime before and after then substract the first
> from the last?
>
> I want to time how long my queries take
>
>
>
> --
> 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




Re: [PHP] Re: REMOTE_HOST

2002-12-23 Thread Rasmus Lerdorf
Isn't the question about REMOTE_HOST? Why are you talking about referer
stuff at all? The two have nothing to do with each other. REMOTE_HOST is
the resolved version of REMOTE_ADDR and is rarely set as it is way too
time consuming to do a reverse DNS lookup on each ip that connects to your
web server.  But, REMOTE_ADDR is always set and you can use that to see
where requests are coming from.  But this has nothing to do with the
referer.

If you are looking to detect the redirect, then the presence of REDIRECT_*
variables will tell you that, but again, this has nothing to do with the
referer.

If you want to know where something was redirect from, try REDIRECT_URL.

-Rasmus

On Tue, 24 Dec 2002, John Taylor-Johnston wrote:

> John,
> CC: a copy of your next posts. I'll be back on Friday. Jingle Bells and all.
> Thanks for thinking about it. What about turning on: session.referer_check =
> Or soemthing else in php.ini
>
> John
>
> John Nichel wrote:
>
> > Well, that won't help then.  I saw that REMOTE_PORT was different in
> > your last two emails, but if it's ever changing
> >
> > I'm doing a little testing here on my end and have discovered that
> > REFERER isn't set if the server is doing a redirect.  I made a simple
> > little two page script.  The first page just contained this (the site
> > doesn't have DNS outside of my network)...
> >
> > header ( "Location: http://www.backup.jcn/referer2.php"; );
> >
> > and referer2.php contained...
> >
> > print_r ( $_SERVER );
> >
> > When I went through the redirect, REFERER was NOT set, but when I
> > clicked on a link from another page, it was set.  I'll look at it a bit
> > longer to see if there is anything out there to tell it was redirected,
> > but it's not looking good.
> >
> > John Taylor-Johnston wrote:
> > >>[SERVER_PORT] => 80
> > >
> > >
> > > Server port does not change.
> > >
> > > Will it do anything to change my php.ini?
> > >
> > > session.referer_check =
> > >
> > > It is set to nothing at the moment, copied and pasted.
> > >
> > > How do I check for the port number? My redirects come through:
> > >
> > >
> > >>[REMOTE_PORT] => 1070
> > >>[REMOTE_PORT] => 1074
> > >
> > >
> > > They are also increasing. It's a bit like a counter :) no?
> > >
> > > Even the link to http://compcanlit.usherbrooke.ca makes remote_port increase:
> > >
> > >
> > >>[REMOTE_PORT] => 1079
> > >
> > >
> > > John
> > >
> > > John Nichel wrote:
> > >
> > >
> > >>Like John said, REFERER isn't always set, and that looks to be the case
> > >>here.  One thing I did notice is that the redirect comes thru on a
> > >>different port.  If this is consistant, you may be able to use this.
> > >>
> > >>John Taylor-Johnston wrote:
> > >>
> > >>>>echo ( "\n" );
> > >>>>print_r ( $_SERVER );
> > >>>>echo ( "\n" );
> > >>>
> > >>>
> > >>>On the redirect from http://compcanlit.ca/, I get:
> > >>>
> > >>>Array
> > >>>(
> > >>>[DOCUMENT_ROOT] => /var/www/html2
> > >>>[HTTP_ACCEPT] => image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
>image/png, */*
> > >>>[HTTP_ACCEPT_CHARSET] => iso-8859-1,*,utf-8
> > >>>[HTTP_ACCEPT_ENCODING] => gzip
> > >>>[HTTP_ACCEPT_LANGUAGE] => en,fr
> > >>>[HTTP_CONNECTION] => Keep-Alive
> > >>>[HTTP_HOST] => compcanlit.usherbrooke.ca
> > >>>[HTTP_USER_AGENT] => Mozilla/4.79 [en]C-CCK-MCD   (Win98; U)
> > >>>[PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
> > >>>[REDIRECT_STATUS] => 200
> > >>>[REDIRECT_URL] => /
> > >>>[REMOTE_ADDR] => 142.169.108.39
> > >>>[REMOTE_PORT] => 1066
> > >>>[SCRIPT_FILENAME] => /var/www/html2/index.html
> > >>>[SERVER_ADDR] => 132.210.13.10
> > >>>[SERVER_ADMIN] => root@localhost
> > >>>[SERVER_NAME] => compcanlit.usherbrooke.ca
> > >>>[SERVER_PORT] => 80
> > >>>[SERVER_SIGNATURE] =>
> > >>>Apache/1.3.27 Server at compcanlit.usherbrooke.ca Port 80
> 

Re: [PHP] Re: REMOTE_HOST

2002-12-23 Thread Rasmus Lerdorf
Sure, but his phpinfo() does show REDIRECT_* vars as it is the server
doing the redirect.  An external redirect (HTTP Location header) is not
going to show anything as it has nothing to do with the server.

-Rasmus

On Tue, 24 Dec 2002, John Nichel wrote:

> He's looking to see if there is a redirect.  The thing I'm seeing is
> that if the redirect comes from a php header call, or a url rewrite from
> the server, nothing is set for REDIRECT_URL or HTTP_REFERER.  This is
> the $_SERVER output I get on my machine from a url rewrite and php header
>
> Array
> (
>  [DOCUMENT_ROOT] => /webserver/docs/vhosts/backup
>  [HTTP_ACCEPT] =>
> 
>text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,text/css,*/*;q=0.1
>  [HTTP_ACCEPT_CHARSET] => ISO-8859-1, utf-8;q=0.66, *;q=0.66
>  [HTTP_ACCEPT_ENCODING] => gzip, deflate, compress;q=0.9
>  [HTTP_ACCEPT_LANGUAGE] => en-us, en;q=0.50
>  [HTTP_CACHE_CONTROL] => max-age=0
>  [HTTP_CONNECTION] => keep-alive
>  [HTTP_COOKIE] => PHPSESSID=a4a0a7c613f817b0344ff70af03b88ae
>  [HTTP_HOST] => www.backup.jcn
>  [HTTP_KEEP_ALIVE] => 300
>  [HTTP_USER_AGENT] => Mozilla/5.0 (X11; U; Linux i586; en-US;
> rv:1.0.1) Gecko/20020823 Netscape/7.0
>  [PATH] => /sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin
>  [REMOTE_ADDR] => 11.11.68.1
>  [REMOTE_PORT] => 2380
>  [SCRIPT_FILENAME] => /webserver/docs/vhosts/backup/referer2.php
>  [SERVER_ADDR] => 11.11.68.3
>  [SERVER_ADMIN] => [EMAIL PROTECTED]
>  [SERVER_NAME] => www.backup.jcn
>  [SERVER_PORT] => 80
>  [SERVER_SIGNATURE] => Apache/1.3.26 Server at www.backup.jcn Port 80
>  [SERVER_SOFTWARE] => Apache/1.3.26 (Unix) PHP/4.2.3 mod_perl/1.27
>  [GATEWAY_INTERFACE] => CGI/1.1
>  [SERVER_PROTOCOL] => HTTP/1.1
>  [REQUEST_METHOD] => GET
>  [QUERY_STRING] =>
>  [REQUEST_URI] => /referer2.php
>  [SCRIPT_NAME] => /referer2.php
>  [PATH_TRANSLATED] => /webserver/docs/vhosts/backup/referer2.php
>  [PHP_SELF] => /referer2.php
>  [argv] => Array
>  (
>  )
>
>  [argc] => 0
> )
>
> But if I use JavaScript or Meta refresh to do the redirect, I get the
> HTTP_REFERER.  I also get it when I link to the page from another.  I
> didn't get any REDIRECT variables in any of the cases.  Are these
> supposed to be in the $_SERVER array?
>
> Rasmus Lerdorf wrote:
> > Isn't the question about REMOTE_HOST? Why are you talking about referer
> > stuff at all? The two have nothing to do with each other. REMOTE_HOST is
> > the resolved version of REMOTE_ADDR and is rarely set as it is way too
> > time consuming to do a reverse DNS lookup on each ip that connects to your
> > web server.  But, REMOTE_ADDR is always set and you can use that to see
> > where requests are coming from.  But this has nothing to do with the
> > referer.
> >
> > If you are looking to detect the redirect, then the presence of REDIRECT_*
> > variables will tell you that, but again, this has nothing to do with the
> > referer.
> >
> > If you want to know where something was redirect from, try REDIRECT_URL.
> >
> > -Rasmus
> >
> > On Tue, 24 Dec 2002, John Taylor-Johnston wrote:
> >
> >
> >>John,
> >>CC: a copy of your next posts. I'll be back on Friday. Jingle Bells and all.
> >>Thanks for thinking about it. What about turning on: session.referer_check =
> >>Or soemthing else in php.ini
> >>
> >>John
> >>
> >>John Nichel wrote:
> >>
> >>
> >>>Well, that won't help then.  I saw that REMOTE_PORT was different in
> >>>your last two emails, but if it's ever changing
> >>>
> >>>I'm doing a little testing here on my end and have discovered that
> >>>REFERER isn't set if the server is doing a redirect.  I made a simple
> >>>little two page script.  The first page just contained this (the site
> >>>doesn't have DNS outside of my network)...
> >>>
> >>>header ( "Location: http://www.backup.jcn/referer2.php"; );
> >>>
> >>>and referer2.php contained...
> >>>
> >>>print_r ( $_SERVER );
> >>>
> >>>When I went through the redirect, REFERER was NOT set, but when I
> >>>clicked on a link from another page, it was set.  I'll look at it a bit
> >>>longer to see if there is anything ou

Re: [PHP] What happened with zend engine version 2?

2002-12-24 Thread Rasmus Lerdorf
That was never the plan.  It is scheduled for PHP 5 sometime in the next
6-12 months.

-Rasmus

On Tue, 24 Dec 2002, Erik Franzén wrote:

> I believed that PHP V4.3 should include the Zend engine version 2 since
> there was two alpha releases for PHP-4.3.0 with  Zend engine version 2
>
> -PHP-4.3.0-dev-zend2-win32-alpha1
> -PHP-4.3.0-dev-zend2-win32-alpha2
>
> I'm waiting for Zend engine version 2. Where could I read information about
> future releases?
>
> I think the Zend engine version 2 provides much better coding facilities so
> I would preciate if anybody could answer my questions.
>
> Thanks
>
> /Erik
>
>
>
> --
> 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




Re: [PHP] Creating my own External Module for PHP

2002-12-24 Thread Rasmus Lerdorf
Just run phpize in your directory and then do a ./configure && make
If your config.m4 was correct you should now have a modules/foo.so in your
dir.

-Rasmus

On Tue, 24 Dec 2002, Leon Mergen wrote:

> Hello,
>
> I have a little question to which I hope to find an anwser in here.
> Currently, I have a big script which receives approx 1.5 million hits every
> day. Since this script does some common calculations that underlying scripts
> use, I want to rewrite this into C and initially make it an external module
> for beta testing and then eventually compile it directly into PHP.
>
> Now, I got this really good book, Web Application Development with PHP by
> Ratschiller and Gerken. It has a complete chapter devoted to "hacking the
> core of PHP" which shows how to create extensions.
>
> Now, they describe 2 common ways of hacking the core... making a shared
> object (which is what I want at this point) , or compiling the extension
> right into the core. They decribe how to make your extension with
> ~/ext/ext_skel , but they don't describe which steps to take when you only
> want to make a shared object... the only thing they say is "at this point,
> you should have a new PHP binary or a .so file" ... but they never gave any
> indication how to chose... they just asume you want a new php binary or sth.
>
> Now, can anyone provide me with a few brief description (a few steps) how to
> make your own dynamically loadable module in PHP?
>
> Thanks in advance.
>
> Regards,
>
> Leon Mergen
>
>
>
> --
> 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




Re: [PHP] include "problem"

2002-12-26 Thread Rasmus Lerdorf
Use a here-doc:

echo <<[$data]  $titulo ($user) $intro  $texto
 (comentarios=$contador)
EOB;

-Rasmus

On Fri, 27 Dec 2002, Pag wrote:

>
>   Hi,
>
>   i am trying to make my work a little easier when editing the appearance of
> a news site i am building. As it is, everytime i want to change the looks
> of how each news appears, i have to edit inside the print('  '); which is
> annoying, because of the backslash with " problem thing(when i need to have
> a " inside a print, i need to put a \, you know), for example:
>
>   i have:
>
>   print("[$data]  $titulo ($user) $intro  $texto
>  (comentarios=$contador)");
>
>   Cant i do something like having the code inside the print on an external
> file? so when i want to change something, i only edit that file, instead of
> dealing with the print itself, like this:
>
>   [some command(s) that put the content of the external file "looks.inc" in
> variable $a]
>   print ("$a");
>
>   I dont even know what to look for in the net. This problem is so i, later
> on, can code some sort of backend in the ways of greymatter, that people
> can change the looks of the news entries by themselves.
>
>   Thanks.
>
>   Pag
>
>
>
> --
> 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




Re: [PHP] XML-Presentationsystem from the Conf2002

2002-12-27 Thread Rasmus Lerdorf
Check it out of cvs.  It is in the pres2 directory.

On Fri, 27 Dec 2002, Tobias Schlitt wrote:

> Hi folks!
>
> I saw the nice-looking presentationsystem, written in PHP and using XML, on
> the PHP-Conference this year. I liked that very much and think it's must for
> every PHP-related presentation. So, can anyone tell me, where to download
> the system? Has anyone got it at home and could send me a quick tar-ball of
> it per mail??
>
> Thanks for your help! Hope you all had merry X-Mas!
>
> Regards,
> Toby
>
>
>
> --
> 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




Re: [PHP] OOP and object references, not copies - how to do?

2002-12-27 Thread Rasmus Lerdorf
PHP can pass references to objects around exactly the same way you pass
references to normal variables.

-Rasmus

On Thu, 26 Dec 2002, Erik Franzén wrote:

> Say the you are going to create a simple forum and you want to have a number
> of classes:
>
> Class Sql - handles the DB interface
> Class User - handles users
> Class Messages - handles messages
>
> When you are writing the code, you first creates a new sql object in order
> to read or write data from or to the database.
>
> Secondly you create a user object in order to handle users, for an example,
> to authenticate the user which is going to write a new message in your
> forum.
>
> The user object have a method which reads user information from the
> database.
>  Since you alread have created a sql object, this method should use the sql
> object in order to fecth data from the database.
>
> I nice way to do this, would be to send the sql object as an reference to
> the user object constructor and store the object reference to the sql object
> in the user object.
>
> This is not working very well in PHP yet because PHP cannot treat objects as
> references. When you send the sql object to the user object constructor
> method, it will be a copy, not a reference!
>
> How do I get around this? There must be a way to handle this and create nice
> OOO PHP-code? I don't like using global variables as object handles.
>
> Best regards
> Erik
>
>
>
> --
> 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




Re: [PHP] 4.3.0 compile error

2002-12-28 Thread Rasmus Lerdorf
Please include your configure flags.  Chances are you need to add
--with-zlib

On Sat, 28 Dec 2002, Pentothal wrote:

> I've tried to compile php 4.3.0 under RedHat 6.2 (libtool-1.4-8) and
> I got this compile error:
>
> /bin/sh libtool --silent --mode=link gcc -export-dynamic -g -O2
> -avoid-version -module  [... snip ...] -lcrypt -lresolv -lm -ldl
> -lnsl -lcrypt  -o sapi/cli/php ext/standard/image.lo: In function
> `php_handle_swc':
> /usr/src/php-4.3.0/ext/standard/image.c:195: undefined reference to
> `uncompress'
> /usr/src/php-4.3.0/ext/standard/image.c:217: undefined reference to
> `uncompress'
> main/SAPI.lo: In function `sapi_header_op':
> /usr/src/php-4.3.0/main/SAPI.c:526: undefined reference to
> `zlib_globals'
> main/SAPI.lo: In function `sapi_send_headers':
> /usr/src/php-4.3.0/main/SAPI.c:675: undefined reference to
> `zlib_globals'
> collect2: ld returned 1 exit status
> make: *** [sapi/cli/php] Error 1
>
> Any hint?
>
>
>
> --
> 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




Re: [PHP] weird MySQL resource error

2002-12-28 Thread Rasmus Lerdorf
Because you are wiping out your $sponsor variable in that commented-out
code.

On Sat, 28 Dec 2002, James Brennan wrote:

> I am getting a "Warning: mysql_fetch_row(): supplied argument is not a valid
> MySQL result resource" error only when the commented-out code bellow
> (starting from $id = bb_sponsor...) is added. If I omit the code the
> resource is recognized as valid. Can anyone explain?
>
> Thanks,
> loop
>
> P.S. - I know my conditions for comparing values are far from accurate, but
> they work for this particular purpose.
>
> /* variables for sponsor table insert */
>   $insert = '';
>   $insert_pre = "INSERT INTO `bb_sponsor` ( `id` , `name` , `url` ) VALUES
> (";
>   $insert_post = ");\n";
>
>   /* if inputed sponsor name exists, define it's index and url value.*/
>   while ($row = mysql_fetch_row($sponsor)) {
>   foreach ($bb_sponsor as $key=>$value) {
>   if (levenshtein($bb_sponsor[$key]['name'], $row[1]) <=3 or
>   stristr(($bb_sponsor[$key]['name']), $row[1])) {
>   $bb_sponsor[$key]['id'] = $row[0];
>   $bb_sponsor[$key]['url'] = $row[2];
>   }
>   /*
>   $id = $bb_sponsor[$key]['id'];
>   $name = $bb_sponsor[$key]['name'];
>   $sponsor = $bb_sponsor[$key]['url'];
>   $insert = $insert . $insert_pre . "'', '$name', '$sponsor'" .
> $insert_post; */
>   }
>   }
>
> _
> Add photos to your messages with MSN 8. Get 2 months FREE*.
> 
>http://join.msn.com/?page=features/featuredemail&xAPID=42&PS=47575&PI=7324&DI=7474&SU=
> http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_addphotos_3mf
>
>
> --
> 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




Re: [PHP] rounding...sort of

2002-12-28 Thread Rasmus Lerdorf
Use explode() please

On Sun, 29 Dec 2002, Justin French wrote:

> php.net/floor
>
> OR
>
>  list($w,$d) = split('.','4.9');
> echo $w;
> ?>
>
> Justin French
>
>
>
> on 28/12/02 8:49 PM, Peter Lavender ([EMAIL PROTECTED]) wrote:
>
> > Hi everyone,
> >
> > I have a nubmer: 4.1 but I only want the whole number 4, even if it's
> > 4.9, so this rules out using round (Unless I missed a parameter).
> >
> > How could I do this.. I'm drawing a blank...
> >
> > Pete
> >
> >
> >
>
>
> --
> 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




Re: [PHP] install problem

2002-12-30 Thread Rasmus Lerdorf
I don't see any errors there, just a couple of rather harmless warnings.

On Mon, 30 Dec 2002, [EMAIL PROTECTED] wrote:

> Hello !
>
> I have problem with php-4.3.0 i can not install it on my 3 different rh7.0 servers.
>
> ./configure --prefix=/usr --with-config-file-path=/etc --disable-debug
> --enable-pic --enable-shared --enable-inline-optimization --with-apxs=/usr/sbin/apxs
> --with-exec-dir=/usr/bin --with-regex=system --with-gettext --with-gd
> --with-jpeg-dir=/usr --with-png --with-zlib --with-zlib-dir=/usr/local/lib
> --with-gdbm --enable-debugger --enable-magic-quotes --enable-safe-mode
> --enable-sockets --enable-sysvsem --enable-sysvshm --enable-track-vars
> --enable-yp --enable-ftp --enable-wddx --with-mysql
> --without-oracle --without-oci8 --with-xml
>
> Errors:
>
> multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo 
>main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm 
>-ldl -lnsl -lcrypt  -o sapi/cli/php
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
> /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of 
>`tempnam' is dangerous, better use `mkstemp'
>
> functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo 
>Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo 
>main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm 
>-ldl -lnsl -lcrypt  -o sapi/cli/php
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
> /root/http_stuff/php/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of 
>`tempnam' is dangerous, better use `mkstemp'
>
> functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo Zend/zend_qsort.lo 
>Zend/zend_multibyte.lo Zend/zend_execute.lo sapi/cli/php_cli.lo sapi/cli/getopt.lo 
>main/internal_functions_cli.lo -lnsl -lpng -lz -ljpeg -lgdbm -lz -lcrypt -lresolv -lm 
>-ldl -lnsl -lcrypt  -o sapi/cli/php
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> libtool: link: warning: library `/usr/lib/libgdbm.la' was moved.
> ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
> /root/php-4.3.0/ext/mysql/libmysql/my_tempnam.c:103: the use of `tempnam' is 
>dangerous, better use `mkstemp'
>
> --
> Best regards,
>  gnu_is_not_unix
>
> ---
> Konto bez op³at i prowizji?
> TAK! eKONTO w mBanku! < http://pf.wp.pl/mbank.html >
>
>
>
> --
> 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




Re: [PHP] Text repeating problem

2002-12-30 Thread Rasmus Lerdorf
> Anyone seen this before?  Any suggestions/things to try?  It's driving
> me mad...

I would strongly suggest using Apache 1.3.x instead of Apache 2.
Apache2+PHP simply is nowhere near stable.

-Rasmus


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




Re: [PHP] PHP 4.3 & Apache 2

2003-01-01 Thread Rasmus Lerdorf
It is still experimental.

On Wed, 1 Jan 2003, Scott Seidl wrote:

> Does the new release of PHP 4.3 have official support with Apache 2.x or is
> it still considered developmental?
>
> Thanks
>
>
>
> --
> 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




Re: [PHP] include/require vs performance

2003-01-03 Thread Rasmus Lerdorf
> Is there, was there ever issue around including a lot files via
> include(). I am running things on a local server so it's hard to gauge.

I don't understand that comment.  includes/requires are always (well
nearly anyway) local to the server regardless of where the request is
coming from.  So if you have a test box and it is fast enough for you,
then go with it.

-Rasmus

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




Re: [PHP] Loading Module not in php.ini

2003-01-03 Thread Rasmus Lerdorf
php.net/dl

On Fri, 3 Jan 2003, Michael J. Pawlowsky wrote:

>
>
> I doubt that I can do this...  but as someone once told me, "There's no such thing 
>as a stupid question".
> I guess they were never on any mailing lists!  :-)
>
> So here it goes
>
> Is there anyway to load a module without having access to php.ini
> kind of like a ini_set("extension=mymodule.co"); that would load a new process with 
>this module and pass the request on to it?
>
>
> Cheers,
> Mike
>
>
>
>
>
> --
> 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




Re: [PHP] No Global Code Fixing

2003-01-04 Thread Rasmus Lerdorf
Why don't you just use $_REQUEST['keyword'] ?

On Sat, 4 Jan 2003, Michael J. Pawlowsky wrote:

> Well I've been fixing up all my code (and other peoples which is worst) getting 
>ready to do an upgrade to 4.3. and turning off globals and warnings on.
>
> I very often move parameters that were once POSTed as a GETs.
> For instance... some one does a search but is not logged in, they can see the 
>results but don's see the "Edit" results button.
> So they log in, and I send them back to the search they just did.
>
> The first search is done by a POST and when I redirect them after the login it's 
>done by a GET.
>
> So I use to simply not specify if it was a GET or POST and looked to see if the var 
>existed or not to see how to load that page.
>
> Now I've been adding alot of:
>
>
> if (isset($_POST['keyword'])){
> $keyword = $_POST['keyword'];
> }elseif (isset($_GET['keyword'])){
> $keyword = $_GET['keyword'];
> } else {
> unset($keyword);
> }
>
>
> I suppose I could also do something like this (which is not much different)
>
>  if(isset($_POST['keyword']) || isset($_GET['keyword'])){
> $keyword = isset($_POST['keyword'])?$_POST['keyword']:$_GET['keyword'];
>  }else{
>unset($keyword);
>  }
>
> I guess I could get rid of the unset, but I like it there just in case something 
>earlier filled that puppy.
>
> So I end up with alot of these right now at the top of each page.
> Especially if the URI is something like 
>http:www.mysite.com/index.php?this=that&id=1&lang=en&so=on&so=on&so=on&so=on&so=on&so=on
>
> Know what I mean?
>
> So just wondering if anyine had something really elegant to replace it.
>
>
> Cheers,
> Mike
>
>

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




RE: [PHP] Read-only gif support in 4.3.0

2003-01-04 Thread Rasmus Lerdorf
Didn't I answer this already?  The Windows binary was built without the
right #define to enable the GIF support.  You will have to wait for the
next Windows build before this will work.

-Rasmus

On Sat, 4 Jan 2003, Adam Plocher wrote:

> Michael, thanks for the response..
>
> Only prob is I'm using the win32 precompiled version.. I got a couple linux boxes I 
>could throw this on I suppose, but I was kind of hoping to use this machine as a dev 
>box.
>
> I ran the same code you posted and these were my results:
>
> Fatal error: Call to undefined function: imagecreatefromgif() in 
>c:\apache\htdocs\test.php on line 14
>
> I don't get it - there are two gd dll's that come with it and I've tried both.  Any 
>other advice would be appreciated. Thanks
>
> -Adam
>
>   -Original Message-
>   From: Michael J. Pawlowsky [mailto:[EMAIL PROTECTED]]
>   Sent: Sat 1/4/2003 5:58 PM
>   To: Adam Plocher; [EMAIL PROTECTED]
>   Cc:
>   Subject: Re: [PHP] Read-only gif support in 4.3.0
>
>
>
>
>
>   I just installed 4.3 today...  configured as
>
>   ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mcrypt --with-zlib 
>-
>   -with-gd --enable-exif --with-jpeg-dir=/usr/lib --with-png --with-ttf 
>--with-fre
>   etype --enable-gd-native-ttf
>
>
>   I run this code:
>
>   
>header("Content-type: image/jpeg");
>
>$img = imagecreatefromgif("../images/camera.gif");
>imagejpeg($img);
>imagedestroy($img);
>
>
>   ?>
>
>   and it works fine
>
>
>   Mike
>
>
>
>
>   *** REPLY SEPARATOR  ***
>
>   On 04/01/2003 at 4:50 PM Adam Plocher wrote:
>
>   >This encoded message has been converted to an attachment.
>   >
>   >I read on PHP.net that PHP 4.3.0 has read-only GIF support in it's version
>   >of gdlib.  I am using the windows version with apache and tried both
>   >php_gd.dll and php_gd2.dll and I could not access any GIF related image
>   >functions, however I could use JPG, PNG, etc.  Does anyone know if I need
>   >to do anything special to get those functions to work?  The function I am
>   >mainly needing to use is imagecreatefromgif().
>   >
>   >
>   >
>   >Thanks
>   >
>   >-Adam
>
>
>
>
>
>   --
>   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




RE: [PHP] Is this possible with php?

2003-01-11 Thread Rasmus Lerdorf
You should probably mention that this is called WebFolders in M$-speak and 
it actually works quite well when combined with the mod_dav and mod_digest 
Apache modules.

-Rasmus

On Fri, 10 Jan 2003, Timothy Hitchens (HiTCHO) wrote:

> So you want to be able to have a directory that when saved to it is
> really the server well
> besides ftp or samba integration into explorer the only other option you
> have is to use
> webdav with apache and that way it would be a post of sorts to the mod
> webdav module in apache.
> 
> 
> 
> Timothy Hitchens (HiTCHO)
> Open Platform Consulting
> e-mail: [EMAIL PROTECTED]
> 
> > -Original Message-
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] 
> > Sent: Friday, 10 January 2003 4:06 PM
> > To: [EMAIL PROTECTED]
> > Subject: [PHP] Is this possible with php?
> > 
> > 
> > I would like to know if the follwing function can be 
> > implemneted in php with help of other tools:
> > 
> > using MS Word in windows, when a file is saved, can it be 
> > AUTOMATICALLY uploaded (via http POST or other mechanism) to a server?
> > 
> > Currently I need to first save it on my desktop, then upload 
> > that copy to a php-supported server.
> > 
> > Thanks in advance.
> > 
> > Tim
> > 
> > -- 
> > 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




Re: [PHP] question about 'register_globals' setting

2003-01-13 Thread Rasmus Lerdorf
> >Thanks for your response but I don't think this is what I was asking; could
> >be wrong though.
> >
> I re-read your post and, of course, you are right. I mis-read it! I have 
> heard of this Back button and data missing and I'm sure its come up 
> before, but I don't remember the answer. I can only suggest looking in 
> the archives, I'm afraid.

This doesn't have anything to do with PHP.  Whether or not a form will be 
populated or not after hitting the back button completely depends on 
whether or not the browser decided to cache that page or not.  By default, 
a page served up by PHP will not be cached.  You can make it cacheable by 
sending an appropriate cache-control header.  However, in this case I 
think you said that the page was not even a PHP one, just static HTML in 
which case it should have gotten cached.  Have a look at the HTTP headers 
the page generates.

-Rasmus


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




Re: [PHP] question about 'register_globals' setting

2003-01-13 Thread Rasmus Lerdorf
> I'm using I.E. 6.  I noticed that register_globals was set ON in my
> php.ini file so I changed it to OFF in as per the security warning.  
> I've noticed a side effect.  When I submit a form via POST and then go
> back from the results page, my form has been cleared, i.e.., as if the
> page has been reloaded.  Is this a normal effect of setting
> register_globals OFF?  Is there a way to continue caching?

This should in no way be related to register_globals.

-Rasmus


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




Re: [PHP] Making alternate rows of different colour

2003-01-17 Thread Rasmus Lerdorf
> I put the output of the database query in a table. It works fine. Now I have a need 
>to make the alternate rows of a different color.
> 
> Can someone please help me with the code?

   $cols = array('#ff','#00ff00');
   $i = 0;
   while(your_loop_to_output_each_row) {
  echo '$row_data';
   }

-Rasmus


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




Re: [PHP] Why PHP doesn't work with Apache2?

2003-01-22 Thread Rasmus Lerdorf
> Henry wrote:
> > what issues for example?
> > I do know I can successful install php in module with apache2.0.43 without error 
>messages, also execution was successful
> > can you tell me what issues did you see?
> 
> A successful install means nothing.
> 
> My question is basically, does Apache2 work with PHP 100% or is it still 
> recommend to use Apache 1.3.27?
> 
> If it is still not recommended to use Apache2, why?

Because the server doesn't work very well yet.  There are issues in the 
filter api and you can't really uses a threaded mpm as many of the 
3rd-party libraries that are commonly linked into PHP are simply not 
threadsafe.  The first issue can be fixed, the second issue is handled by 
only running Apache2 in prefork mode which makes the server look like 
Apache1.  If you have to run Apache2 looking like Apache1 the benefits are 
minor, so the motivation for people to put a whole lot of effort into 
fixing issue #1 is minimal.

-Rasmus


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




Re: [PHP] Why PHP doesn't work with Apache2?

2003-01-22 Thread Rasmus Lerdorf
On Thu, 23 Jan 2003, Jean-Christian Imbeault wrote:

> Rasmus Lerdorf wrote:
> >
> > Because the server doesn't work very well yet.  There are issues in the
> > filter api and you can't really uses a threaded mpm as many of the
> > 3rd-party libraries that are commonly linked into PHP are simply not
> > threadsafe.
>
> Thank you! That's the kind of answer I was looking for.
>
> If I understand correctly PHP will not work correctly because some parts
> of it are not thread-safe.

No, you didn't understand correctly.  I specifically said the thread
safety issues were in 3rd party libraries and not in PHP.  This is not
going to be solved anytime soon since it isn't really something we can
fix.  We can hack around it and add mutexes and stuff to protect ourselves
from broken libraries, but in the end that just brings us closer to the
non-threaded model that we already have with Apache-1.3, so there is very
little motivation to even go through this bit of pain.

Why exactly are you asking?  Is there some feature in Apache2 that you
need that is not available in Apache-1.3?

-Rasmus

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




Re: [PHP] Why PHP doesn't work with Apache2?

2003-01-22 Thread Rasmus Lerdorf
On Thu, 23 Jan 2003, Jean-Christian Imbeault wrote:

> Rasmus Lerdorf wrote:
> >
> > No, you didn't understand correctly.  I specifically said the thread
> > safety issues were in 3rd party libraries and not in PHP.
>
> Sorry, I thought by 3rd party libraries you meant libraries that PHP is
> dependent upon. Do you mean libraries used by PHP or Apache. And if
> these are libraries used by PHP, do you mean library that as in the
> multi-byte library (i.e. libraries that add functionality to PHP), or do
> you mean C libraries used when compiling PHP.

Common libraries such as gdbm or c-client, for example.

> So this boils down to Apache2 using threads and PHP not being thread-safe?

No

> And the reason that PHP is not thread-safe is that some 3rd party
> libraries PHP used are not thread-safe.

No

> If they are libraries used to compile PHP, I would assume that Apache2
> must have faced similar issues when going from a forking model to a
> threaded model?

Why?  Apache by itself doesn't need to talk to anywhere near the same
number of 3rd-party things that PHP commonly talks to.

> #2 Is there progress being made towards having PHP work with Apache2.
> And who is working on this (if not the PHP team).

Nobody really is.  And I don't see this changing until there are some
really compelling features in Apache2 to warrant the massive effort it
would take.  And yes, a working perchild mpm may be that compelling
feature, but we don't have one of those.

All of this stuff is available by reading the PHP and Apache dev lists, by
the way.  They are archived and not that hard to find.

-Rasmus

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




Re: [PHP] PHP5 - Apache 2.0.44 - perchild mpm

2003-01-23 Thread Rasmus Lerdorf
> Will this combination work?
> It would be great if we could use this combination for testing only 
> til the big brothers apache and php work fine with perchild.

Perchild alone doesn't work at this point, so no, perchild+PHP won't work.

-Rasmus


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




Re: [PHP] testing for negative numbers

2003-02-06 Thread Rasmus Lerdorf
Please provide a complete test script.  Are you perhaps not realizing that
array indices along with all variables in PHP are case sensitive?
$row["ID"] and $row["id"] are not the same thing.

The trivial test of your example:

$myArray["id"] = -2;
if ($myArray["id"] < 0) echo "Negative";
else echo "Positive";

Prints "Negative" as expected.

-Rasmus

On Thu, 6 Feb 2003, Robert Samuel White wrote:

> I realize this should be about the simplest thing in the world to do,
> but for this reason or that it's not working...
>
> I'm using PHP version 4.2.3
>
> Whether I have a negative number in an array, for example:
>
> $myArray["ID"] = -2
>
> Or the number comes from the database, for example:
>
> $row["id"] = -2
>
> I cannot get this simple operation to work:
>
> if ($row["id"] < 0)
>
> Instead, positive or negative, it seems to think this expression is
> always true:
>
> if ($row["id"] > 0)
>
> It's like it takes the absolute value of the number (whether the number
> is 2 or -2, it thinks it is 2)
>
> I've tried many things, including type casting using (int) in front of
> the expression.
>
> Nothing has worked.
>
> Any ideas why in the world this is happening?  Thanks.
>
>
>
>
>
> --
> 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




Re[2]: [PHP] compiling php 4.3.0 with gd

2003-02-06 Thread Rasmus Lerdorf
> I know that is what it means and I do know where libjpeg.so and
> libjpeg.a are on the server. I also have pointed the configuration to
> where they are with this --with-jpeg-dir=/usr/local/bin
> but no mater what I do it still can not find them.and keeps giving me
> the error  configure: error: libjpeg.(a|so) not found

Somehow I doubt your jpeg library is somewhere under /usr/local/bin

-Rasmus

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




Re: [PHP] Wrong version displayed after upgrading to php-4.2.3

2003-02-18 Thread Rasmus Lerdorf
On Tue, 18 Feb 2003, Jason k Larson wrote:

> use:
> --with-mysql=/usr/lib/mysql

No, in almost all cases it is wrong to have "lib" or "include" in a --with
path.  (including this time)

-Rasmus

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




Re: [PHP] Wrong version displayed after upgrading to php-4.2.3

2003-02-18 Thread Rasmus Lerdorf
Did you move things around after installing Apache?  The apxs program
needs to know where these various Apache files are.  Somehow your apxs is
out of synch with where your files actually are.  Either re-install using
whatever mechanism you use or edit your apxs script and teach it about
your paths.

-Rasmus

On Tue, 18 Feb 2003, PathFinder Software wrote:

> Now I get a Config file error.
>
> apxs:Error: Config file /etc/httpd/conf/httpd.conf not found
> make[1]: *** [install-sapi] Error 1
> make[1]: Leaving directory `/var/mnt/System/php-4.2.3'
> make: *** [install-recursive] Error 1
>
> On my distribution I have the httpd.conf in the
> /var/conf/apache/users
> I use the following ./configure i include the following:
>
> CFLAGS="-g -O3" \
> ./configure \
> --with-mysql=/usr/local/mysql \
> --with-apxs=/usr/netmax/sbin/apxs \
> --with-config-file-path=/var/conf/apache/users \
> --enable-versioning \
> --enable-ftp \
> --enable-bcmath \
> --disable-debug \
> --enable-memory-limit=yes \
> --enable-track-vars
>
> As you can see I give the full path on the line:
> --with-config-file-path=/var/conf/apache/users \
>
> Why am I getting this error?
>
> Anything I can test or force?
>
> Regards,
>
> Normand J. Charette
> PathFinder Software/Affiliate Software
> [EMAIL PROTECTED]
> www.AffiliateSoftware.net
>
> -Original Message-
> From: Jason k Larson [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, February 18, 2003 5:30 PM
> To: PathFinder Software
> Cc: [EMAIL PROTECTED]
> Subject: Re: [PHP] Wrong version displayed after upgrading to
> php-4.2.3
>
>
> use:
> --with-mysql=/usr/lib/mysql
>
> HTH,
> Jason k Larson
>
>
> PathFinder Software wrote:
> > Hi,
> >
> > During the configure I get this error message.
> >
> > configure: error: Cannot find header files under /var/lib/mysql
> >
> > a whereis mysql produce the following output:
> > mysql: /usr/bin/mysql /usr/lib/mysql /usr/include/mysql
> > /usr/share/mysql /usr/man/man1/mysql.1 /usr/man/man1/mysql.1.gz
> >
> > I have MySQL installed where the databases are in the
> > /var/lib/mysql directories.
> >
> > Where can I locate the header files the installer is
> complaining
> > about. Is it the same directory where "mysqld" is installed?
> >
> > what should I use for the
> ./configure --with-mysql=/usr/bin/mysql
> >
> > I tried the above and it does not work. Does it make a
> difference
> > if MySQL is running or not during the PHP upgrade?
> >
> > Regards,
> >
> > Normand J. Charette
> > PathFinder Software/Affiliate Software
> > [EMAIL PROTECTED]
> > www.AffiliateSoftware.net
> >
> >
> > I upgraded PHP from 4.0.3pl1 to php-4.2.3 on my Apache/1.3.14
> > using 'apxs' and I did not received any errors during the
> > configure and make. The installation seems to have gone just
> > fine.
> >
> > However, when I load a phpinfo.php document I get the 4.0.3pl1
> > version displayed???
> >
> > What can be wrong and what test or steps do I need to perform
> to
> > correct this?
> >
> > Regards,
> >
> > Normand J. Charette
> > PathFinder Software/Affiliate Software
> > [EMAIL PROTECTED]
> > www.AffiliateSoftware.net
> >
> >
> > --
> > 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 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




Re: [PHP] Good grief

2003-02-18 Thread Rasmus Lerdorf
What is $list supposed to be?  You probably want just $db and $table
there.

-Rasmus

On Wed, 19 Feb 2003, John Taylor-Johnston wrote:

> Yawn of frustration.
>
> $dbtable = "ccl.ccl_main";
>
> list($db,$table) = explode(".",$dbtable);
> echo $dbtable.''.$list[$db].''.$list[$table].'';
> echo $dbtable."".$list[$db]."".$list[$table]."";
>
> I stumped :)
>
> $list[$db]shows nothing
> $list[$table]  shows nothing
>
> Ok, newbie time :( What's wrong?
>
>
> --
> 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: [PHP-DEV] Re: [PHP] Threading

2003-02-18 Thread Rasmus Lerdorf
On Tue, 18 Feb 2003, Greg Donald wrote:
> On Tue, 18 Feb 2003, Bruce Miller wrote:
> 
> >Will PHP allow multiple-thread execution?
> 
> PHP4 does not have thread support.

Well, except for pear/PECL/threads, of course.

-Rasmus


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




Re: [PHP] upgrade to 4.3.0 nearly doubled execution time

2003-02-22 Thread Rasmus Lerdorf
Yes, I have noticed some performance issues as well, but we need to nail
it down better before we can start really going after this.  Could we call
on the collective masses of php-general users to run some benchmark tests?

Just build yourselves a libphp4.so for both 4.2.x and 4.3.x and switch the
LoadModule line back and forth to benchmark the two versions.  Then use
something like http_load (http://www.acme.com/software/http_load/) to
check various simple scripts.  We need to figure out if this is an
across-the-board performance problem or if it is one particular aspect
which has slowed down.

-Rasmus

On Sat, 22 Feb 2003, Jason k Larson wrote:

> I'm betting this is related...
>
> I upgraded to 4.3.0 on my production linux servers and began to have
> serious socket connection issues.  Rolling back to 4.2.3 cleared
> everything up.  I also saw an increase in script execution times with
> 4.3.0, which became much better using 4.2.3.  I noticed some very
> strange behavior which leads me to believe 4.3.0 is not stable, and
> shouldn't be used in a production environment.
>
> So, all I can suggest for now is to determine what it is you need, and
> if a newer version of PHP will suit, go for it.  But stay away from
> 4.3.0 and 4.3.1 (which I've read up on and hasn't addressed any of these
>   issues).
>
> Regards,
> Jason k Larson
>
>
> Rhett Livingston wrote:
> > I upgraded my development system from PHP 4.1.2 to PHP 4.3.0 last week and
> > the performance of my scripts took a dive.  Specifically, the average time
> > to parse my scripts (time from executing first line of code to executing
> > first line after includes) went from about 100ms to about 200ms, and, very
> > oddly, my times to connect to an Oracle database also went up by about the
> > same margin.
> >
> > Switching back to 4.1.2 clears the problem back up.
> >
> > What changed between 4.1.2 and 4.3.0 that could cause this?  File IO stuff
> > perhaps?  Any ideas to solve it?
> >
> > Thanks,
> > Rhett Livingston
> >
> > I'm running WinXP Pro, IIS, PHP as a CGI, and Oracle 9.2.
> >
> >
> >
>
>
>
> --
> 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



Re: [PHP] Checking for HTTP:// at the start of a string and more////

2003-02-28 Thread Rasmus Lerdorf
You don't need a regular expression.  Look at the substr() function.

-Rasmus

On Sat, 1 Mar 2003, Philip J. Newman wrote:

> I would like to check for HTTP:// at the start of a string and for at least
> 1 . and a / at the end of a string.
>
> I have tried ereg, but the documentation is not too clear how to format.
>
>
>
>
> --
> Philip J. Newman.
> Head Developer
> [EMAIL PROTECTED]
>
> +64 (9) 576 9491
> +64 021-048-3999
>
> --
> Friends are like stars
> You can't allways see them,
> but they are always there.
>
> --
> Websites:
>
> PhilipNZ.com - Design.
> http://www.philipnz.com/
> [EMAIL PROTECTED]
>
> Philip's Domain // Internet Project.
> http://www.philipsdomain.com/
> [EMAIL PROTECTED]
>
> Vital Kiwi / NEWMAN.NET.NZ.
> http://www.newman.net.nz/
> [EMAIL PROTECTED]
>
> --
> Quote:
>
> "God gave men both a penis and a brain,
> but unfortunately not enough blood supply
> to run both at the same time."
>
> - Robin Williams
> (Commenting on the Clinton/Lewinsky affair).
>
>
>
> --
> 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: IS there a way.

2003-02-28 Thread Rasmus Lerdorf
The industrial strength way to do this is to use the curl functions.  See
php.net/curl.  You can alternatively just fsockopen yourself and issue the
request and see what the first line of the response is.

(by the way, a slightly shorter .sig would be appreciated)

-Rasmus

On Sat, 1 Mar 2003, Philip J. Newman wrote:

>   Is there a way to PING a URL and check if it returns a valid code like 200
> ... ??

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



Re: [PHP] Is PHP Reinstall required?

2003-02-26 Thread Rasmus Lerdorf
Just install the apache-devel package which is where the apxs tool lives.

-Rasmus

On Thu, 27 Feb 2003, Patrick LOK wrote:

> I have to uninstall my Apache 2.0.x that came along with RedHat 8.0 because
> the httpd (rpm) in RH8.0 does not have Apache apxs (why dont they include
> it).
> 
> I need apxs to install lxp... (it seems lxp can only be installed on a
> customized Linux platform...   USER NOT FRIENDLY :( )
> 
> I already have PHP 4.3.1 installed.
> I will replace the RH Apache with the latest Apache 2.0.44
> 
> Can anyone tell me do I have to remove PHP 4.3.1 before removing Apache?  Or
> Can I just remove Apache & install 2.0.44?  Do I have to re-install PHP
> 4.3.1 by overwriting previous PHP after Apache 2.0.44 installed?
> 
> Thank you very much.
> ./pl  :<
> 
> 
> 
> 


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



Re: [PHP] 'make' PHP4.3.1 returns the use of function`tempnam' isdangerous --- WHY?

2003-03-02 Thread Rasmus Lerdorf
> When I tried to 'make' PHP-4.3.1, it returns warning message and died.  I am
> using RH8.0 + Apache 2.0.44

It didn't die, that is simply the end of the build.  Warnings aren't 
fatal.

(Please do not cc all the lists)

-Rasmus


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



Re: [PHP] short_open_tags = On

2003-03-04 Thread Rasmus Lerdorf
No, there are no security implications.  In fact, it is arguably more 
secure to have short tags enabled as it is then less likely for someone to 
accidentally expose their PHP source code since everything between  will be parsed by PHP.  However, keep in mind that XHTML and XML also 
uses  so if you are mixing XHTML or XML with PHP you could run into 
some difficulties.  Nothing that is all that hard to get around.  I tend 
to always use short_tags myself and simply echo ""; if I need to 
output an xml revision tag, for example.

-Rasmus

On Tue, 4 Mar 2003, Keith Mastin wrote:

> I was asked to change this in the php.ini file by a user to "make it
> easier to use php on the server". Before doing so, I thought I better ask
> if there's any know security implications. I checked the wiki, and it
> showed that there are 31 instances of this, but didn't actually show any.
> :)
> 
> The server is on the web and has a number of domains. The user in question
> writes a lot of websites using php for maybe 1/2 of the domains.
> 
> TIA
> 
> 


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



Re: [PHP] php forgetting variables very easily

2003-03-04 Thread Rasmus Lerdorf
> Ok, this works fine for me.  However it doesn't seem
> to work when main.php and new.php have html in them. 

You are doing something wrong then.  Show us a simple example that doesn't 
work.

-Rasmus


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



Re: [PHP] RedHat 8.0 MySQL Problem

2003-03-04 Thread Rasmus Lerdorf
Have you actually enabled the MySQL extension?  You should have a line in
your php.ini that says:

  extension=mysql.so

By the way, the Apache that comes with RH8 when combined with PHP does not
give you a production-quality solution.  So if you are running this thing
for any sort of important service, you really need to upgrade your web
server to Apache 1.3.27.

-Rasmus

On Tue, 4 Mar 2003, Darren Young wrote:

> I have an app that runs just fine on RedHat 7.2 with compiled Apache and
> PHP along with MySQL binaries installed from MySQL's site. I have a new
> machine running RedHat 8.0 that is completely "generic", i.e only RedHat
> Apache, PHP and MySQL RPM's installed. The error message I'm getting is:
>
> [04-Mar-2003 23:38:46] PHP Fatal error:  Call to undefined function:
> mysql_pconnect() in /var/www/html/zzmysql.php on line 49
>
> That's in the app log file by the way, we all the errors there. The page
> displayed is completely blank at the moment in time the error fires.
>
>
> Persistent MySQL connections are disabled in the RedHat RPM's?
>
> RPM's installed are currently (via rpm -qa):
>
> httpd-2.0.40-11
> php-devel-4.2.2-8.0.7
> php-imap-4.2.2-8.0.7
> php-odbc-4.2.2-8.0.7
> php-snmp-4.2.2-8.0.7
> php-ldap-4.2.2-8.0.7
> php-pgsql-4.2.2-8.0.7
> php-4.2.2-8.0.7
> php-manual-4.2.2-8.0.7
> php-mysql-4.2.2-8.0.7
>
> I'd really like to keep the RedHat install generic and would prefer no
> compile from source for this app. The onIy other change I've made is to
> copy the php.ini from the 7.2 machine over to /etc/php.ini to get the
> config the same. If I restore the original php.ini back the page
> displays but the app just does not work. It seems as though the mysql
> functions just don't work quite right.
>
> Thoughts would be most appreciated.
>
> thx.
>
>
> --
> 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



Re: [PHP] cookie secure argument?

2003-03-04 Thread Rasmus Lerdorf
Means the cookie will only be sent over an HTTPS connection.

On Wed, 5 Mar 2003, Hans Prins wrote:

> Can anyone tell me what the secure argument in the setcookie() function
> does?
>
> setcookie ( string name [, string value [, int expire [, string path [,
> string domain [, int secure])
>
>
> thx
>
>
>
> --
> 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



Re: [PHP] 2 PHP 4.2.2 issues: server keeps working after clientdisconnects, session_start() blocks until other session scripts complete

2003-03-05 Thread Rasmus Lerdorf
> Hello all, I have 2 questions that have come up because I have several
> long reports that can take 1-2 minutes to run.  These are run from any
> web client thru our linux -> apache -> php -> mysql system.
> 
> 1)server keeps working after client disconnects
> If a php script is running and it may take 1-3 minutes, and I hit escape
> or close my web browser window, the script keeps running.  I can see it
> in top, consuming lots of cpu and sometimes ram.  Why doesn't apache and
> the php4.so notice the closed tcp connection and abort the script?  Is
> there a way to make this happen?

Yes, this happens by default, but we can only catch it if we try to write 
something to the socket and get an error back.  If you are processing and 
not outputting anything, there is no way for us to tell.  If you are able 
to write out some sort of progress indicator during your processing then 
it would work.

> 2)session_start() blocks 

This sounds odd.  session_start() should not be blocking.  What sort of 
backend datastore are you using for your sessions?

-Rasmus


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



Re: [PHP] PHP static module on Apache 2.0 HPUX 11

2003-03-10 Thread Rasmus Lerdorf
>   (All the help on php.net about HP has does not address this issue. Also,
> there is not docs on how to install PHP/APACHE2.0 as static.)

That's because we do not support a static build for Apache2.

-Rasmus


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



Re: [PHP] Threading objects

2003-03-12 Thread Rasmus Lerdorf
> All I'm really asking is how do you initiate threading with PHP?
> A small example would be nice

You don't.  This is a web scripting language, not Java.

-Rasmus

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



Re: [PHP] open_basedir

2003-03-12 Thread Rasmus Lerdorf
> My host currently has open_basedir() enabled, and unfortunately, they don't
> know how to disable it :p
> 
> I'd like open_basedir() disabled because it would make my life easier, I can
> hide certain files underneath the web root.
> 
> So I've done some quick research. I'm looking at the ini_set() function:
> http://www.php.net/manual/en/function.ini-set.php
> 
> If i have my host insert this line into php.ini, and restart the apache
> server, then everything should work just dandy, right?
> 
> ini_set(open_basedir, FALSE);

No, open_basedir is not user-configurable.  That would sort of defeat its 
purpose.  

-Rasmus


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



Re: [PHP] open_basedir

2003-03-12 Thread Rasmus Lerdorf
On Wed, 12 Mar 2003, Alex wrote:
> the php.ini file is also not user configurable.
> I think i found the place in my own php.ini file though where the
> open_basedir value would be changed though :/

Right, by design, open_basedir can only be changed by the administrator by 
modifying either the php.ini file or the httpd.conf.

-Rasmus


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



Re: [PHP] Threading objects

2003-03-12 Thread Rasmus Lerdorf
So your problem has nothing to do with threading.  What you need an an 
asynchronous way to connect to multiple sockets and deal with responses as 
they become available.  See php.net/socket_select

-Rasmus

On Thu, 13 Mar 2003, Kris wrote:

> Is it possible to some how thread a php script threw apache. There has to be
> something you can do, it seems there is always something you can do :)
> What I want is the following.
> I administer a mailing list that has a few hundred thousand subscribed
> recipients.
> I've written a script that runs threw the DB and validates the email
> address.
> First by format then by connecting to the mail server.
> This script takes way to long to run as it has to do one at a time.
> I want to some how thread this so it can be validating multiple emails at a
> time.
> Please excuse my ignorance on the subject my web programming experience is
> rather limited.
> 
> Thanks
> 
> Kris
> 
> 
> 
> - Original Message -
> From: "Rasmus Lerdorf" <[EMAIL PROTECTED]>
> To: "Kris" <[EMAIL PROTECTED]>
> Cc: "W. Enserink" <[EMAIL PROTECTED]>; "PHP List" <[EMAIL PROTECTED]>
> Sent: Thursday, March 13, 2003 1:04 AM
> Subject: Re: [PHP] Threading objects
> 
> 
> > > All I'm really asking is how do you initiate threading with PHP?
> > > A small example would be nice
> >
> > You don't.  This is a web scripting language, not Java.
> >
> > -Rasmus
> >
> > --
> > 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



Re: [PHP] Apache 2.0 and PHP

2003-03-14 Thread Rasmus Lerdorf
On Fri, 14 Mar 2003, Michael Aaron wrote:
> Sorry if this has been answered before but I can not find it anywhere:
> 
> Why does the PHP docs. state:
>   "Do not use Apache 2.0 and PHP in a production environment neither on 
> Unix nor on Windows. "
> 
> What is the reason for this Warning?

The combination is simply not production-quality yet.  It has not had the 
attention and Q&A that Apache1/PHP has had, and there are also known 
issues, especially on UNIX with the combination.

-Rasmus


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



Re: [PHP] PHP 5 and Zend Optimizer/Accelator

2003-07-02 Thread Rasmus Lerdorf
Nope, no plans.

On Wed, 2 Jul 2003, [-^-!-%- wrote:

>
>
> Are there any plans to bundle PHP 5 with Zend Optimizer/Accelerator?
> (whichever you need to view Zend Encoded files)
>
> Will it have any support for encrypted files (like those created by Zend
> Encoder) ?
>
>
>
> =P e p i e  D e s i g n s
>  www.pepiedesigns.com
>  Providing Solutions That Increase Productivity
>
>  Web Developement. Database. Hosting. Multimedia.
>
>
>
> --
> 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



RE: [PHP] Re: Red Hat 9, Apache 2, and PHP

2003-07-03 Thread Rasmus Lerdorf
Apache2 has a number of different modes it can work in.  These modes are
called MPM's.  The default MPM is called Worker which is a multithreaded
model.  PHP, mod_perl, mod_python, and any other similar technology which
links directly into the httpd processes will need to be perfectly
threadsafe and reentrant to work effectively with a threaded Apache2 mpm.
This is doable for the core of PHP, but there are literally hundreds of
3rd party libraries that can be linked into PHP and nobody whether or not
these libraries are threadsafe.  And figuring out if a specific library is
threadsafe or not is non-trivial and it can very from one platform to
another.  And just to make it even harder, this stuff will appear to work
fine until you put it under load or hit very specific race conditions
which makes it nearly impossible to debug.

So, since we can't tell you for sure that a threaded Apache2 mpm + PHP
will work we do not suggest you use it for a production server.  And since
we can't know for sure, none of the main PHP developers use this
combination for our own servers which compounds the problem because it is
not receiving anywhere near the amount of realworld testing required to
work out all the little issues above and beyond this threading unknown.

There is an Apache2 mpm, called "prefork", which isn't threaded and
basically makes Apache2 look like Apache1.  But hey, we have a very good
server already that looks like Apache1.

In the end I don't see Apache2+PHP ever becoming a production platform
with the current architecture.  The only way I see it ever working is to
pull PHP out of Apache and use a fastcgi approach.  Or, with time, perhaps
we will learn how to make sure a library is perfectly threadsafe and safe
to use in a multithreaded Apache2.

For now, I really see no reason not to simply use Apache1 if you want a
robust, fast and stable web server.

-Rasmus

On Fri, 4 Jul 2003, Ow Mun Heng wrote:

> Does anyone have any idea or could give me an idea why php & apache 2.0 is
> not 'good' together?
>
>
>
> Cheers,
> Mun Heng, Ow
> H/M Engineering
> Western Digital M'sia
> DID : 03-7870 5168
>
>
> -Original Message-
> From: Mark Charette [mailto:[EMAIL PROTECTED]
> Sent: Friday, July 04, 2003 9:02 AM
> To: [EMAIL PROTECTED]; Shena Delian O'Brien
> Subject: Re: [PHP] Re: Red Hat 9, Apache 2, and PHP
>
>
> Apache 2.x.x IS a production quality server, just not with PHP. Works great
> with Tomcat, mod_jk2, Struts, etc.
>
> - Original Message -
> From: "Shena Delian O'Brien" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, July 03, 2003 8:04 PM
> Subject: Re: [PHP] Re: Red Hat 9, Apache 2, and PHP
>
>
> > Does anyone know why Red Hat would switch to Apache 2.x.x when it is
> > well known that 2.x.x is NOT a production version?
> >
> > Brad Pauly wrote:
> > > Just thought I would share my experience with RH9. I have been running
> > > Apache 1.3.27 and PHP 4.3.2 on RH9 for a couple weeks (since 4.3.2 came
> > > out anyway, and 4.3.1 prior to that) on a test server. All are compiled
> > > from source. The only problem I have had was a bug with the version of
> > > mogrify that is bundled with RH9. That was fixed by 'upgrading' to an
> > > older version. Other than that it has been fine.
> > >
> > > Brad
> > >
> > >
> > >
> > >
> >
> >
> > --
> > 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 General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] include/require inside of function

2003-07-04 Thread Rasmus Lerdorf
On Fri, 4 Jul 2003, Aric Caley wrote:
> Is there anyway to include a file inside of a function and have the included
> stuff be global?  For instance if I defined a class or a function in that
> include file, I want to be able to use that class outside of the function.
>
> On the documentation for include() a poster commented that it did indeed
> work like this, but my testing indicates it does not.  Everything stays
> local to the function and goes away when the function ends.
>
> Is there a way?

Functions defined in included files are always global.  So I guess it is
just the variable you want to put out into the global symbol table.  It's
a little bit tricky, but you can do it like this:

function foo($filename) {
extract($GLOBALS, EXTR_REFS);
include $filename;
$arr = array_diff(get_defined_vars(),$GLOBALS);
foreach($arr as $var=>$val) $GLOBALS[$var] = $val;
}

-Rasmus

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



Re: [PHP] Snarl, hiss, growl (frustration)

2003-07-04 Thread Rasmus Lerdorf
The difference is that you are getting a string from the file and not
casting it to an integer.  You could also have fixed it by doing:

  $counter = (int) fread(...);

Note however that you have a nasty race condition in your script.  If you
get concurrent hits they will all read the same counter value out of your
counter file, increment it, and write the same value back.  So those hits
will not be counted.

An easy way to get around this is to only open your file in append mode
and add a single char to the file for every hit.  filesize() on the file
then gives you the count.  The advantage here is that an append to a file
is guranteed to be atomic and you won't have that race condition between
reading and writing the file.

The other way around it is to lock your file, but locking files in a web
app is a really bad idea.

And finally, to really make a robust counter, use a database and an atomic
count=count+1 query.

-Rasmus

On Fri, 4 Jul 2003, Kyle Babich wrote:

> No, because if i did that the counter would increment no matter what the
> IP address is.  The way I have it the counter will only increment if it
> is a new ip address to the site.  I just fixed it by switching
> $current++; to $current += 1;  Apparently there is some small difference
> between the two.
>
> On Sat, 5 Jul 2003 00:42:59 +1000, "Tom Rogers" <[EMAIL PROTECTED]>
> said:
> > Hi,
> >
> > Saturday, July 5, 2003, 12:33:25 AM, you wrote:
> > KB> Why does this not work?  It is just a simple hit counter (hence the
> > KB> snarls, hissing, and growling).  It logs the ips address but does not
> > KB> increment $current or log it.  I do have counter.txt and ips.txt
> > chmod'd
> > KB> to 777.  Ips.txt starts blank and counter.txt starts with just a 0 in
> > it.
> >
> > KB>  > KB> $current = fread($counter, filesize('counter.txt'));
> > KB> fclose($counter);
> >
> > KB> $ip = getenv('REMOTE_ADDR');
> > KB> $ipCheck = file('ips.txt');
> > KB> if (!in_array($ip, $ipCheck)) {
> > KB> $ipAdd = fopen('ips.txt', 'a');
> > KB> fwrite($ipAdd, "\n$ip");
> > KB> fclose($ipAdd);
> >
> > KB> $current++;
> > KB> $counter = fopen('counter.txt', 'w');
> > KB> fwrite($counter, $current);
> > KB> fclose($counter);
> > KB> }
> >
> > print $current; ?>>
> > KB> --
> > KB> Kyle
> >
> >
> > maybe you need to end the if() statement before incrementing the
> > counter.
> > $ip = getenv('REMOTE_ADDR');
> > $ipCheck = file('ips.txt');
> > if (!in_array($ip, $ipCheck)) {
> > $ipAdd = fopen('ips.txt', 'a');
> > fwrite($ipAdd, "\n$ip");
> > fclose($ipAdd);
> > }
> > $current++;
> > $counter = fopen('counter.txt', 'w');
> > fwrite($counter, $current);
> > fclose($counter);
> > print $current; ?>
> >
> > --
> > regards,
> > Tom
> >
> >
> --
> Kyle
>
> --
> 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



Re: [PHP] Snarl, hiss, growl (frustration)

2003-07-04 Thread Rasmus Lerdorf
On Fri, 4 Jul 2003, Robert Cummings wrote:

> On Fri, 2003-07-04 at 12:44, Rasmus Lerdorf wrote:
> > The difference is that you are getting a string from the file and not
> > casting it to an integer.  You could also have fixed it by doing:
> >
> >   $counter = (int) fread(...);
>
> The cast isn't necessary, PHP happily transforms it for him when he
> applies the ++ operator.

;)  You are sure about that right?  Or else you wouldn't have posted this
to 1000's of people.

So what do you think this will output?

    $a = "123\n";
$a++;
echo $a;

Try it.

-Rasmus

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



Re: [PHP] Snarl, hiss, growl (frustration)

2003-07-04 Thread Rasmus Lerdorf
On Fri, 4 Jul 2003, Robert Cummings wrote:
> Undoubtedly the above will work as we both know, the output will be
> "123"; however, if you look at the original code in question, there is
> no "\n" tailing the output written to the counter file and thus the
> increment works fine (unless of course when he created the file to begin
> he had a newline - something I did not do in my test :)

which is exactly what it looked like he did since he said that switching
to $counter+=1; fixed it for him which would force it to be an integer.

-Rasmus

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



Re: [PHP] Snarl, hiss, growl (frustration)

2003-07-04 Thread Rasmus Lerdorf
On Fri, 4 Jul 2003, Kyle Babich wrote:
> FYI there were no newlines involved in my program.  (go back to the
> message and read the code)

How did you create the file in the first place?  Most editors will
automatically add a carriage return.  Even if you had your code create it,
if afterwards you ever edited and saved the file with an editor, you would
have gotten one in there.

The proof of this is that your code didn't work.  If the file really only
had a number in it, then $counter++ would have worked.

-Rasmus

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



Re: [PHP] Re: Red Hat 9, Apache 2, and PHP

2003-07-04 Thread Rasmus Lerdorf
On Fri, 4 Jul 2003, Jeff Schwartz wrote:
> OK, so Apache 2 is out. Is there any reason not to go with RH 9.0? Any known 
> problems?

It should be fine.  Linux is pretty much Linux.  The biggest differences
between distros and distro versions are at the GUI level and in the set of
applications they provide.  If you are going to use it as a web server and
you install known good versions of Apache and PHP, then you have taken RH9
out of the loop for your critical components and it should be fine.

-Rasmus

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



Re: [PHP] upload file size corruption?

2003-03-16 Thread Rasmus Lerdorf
> I am going nuts reinstalling over and over again on different computers
> and keep getting this error.  I am using 2.0.40 http (I know
> experimental, but don't tell me that :) )

Why not?  Since this is the problem.  Upgrade to Apache 1.3.27 and
everything will be fine.

-Rasmus


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



Re: [PHP] Getting false positive on strpos ... despite doublecheck...HELP!

2003-03-17 Thread Rasmus Lerdorf
>   case strpos($line,"#date:") == 0 && strpos($line,"#date:") !== false:

You can just do a === 0 check here, you don't need the second 
check to make sure it isn't false.  However, that's not really how you use 
a switch expression anyway.  The expressions in the case statement should 
be constants.  If you rewrite your code to look like this it will work 
fine:

On $print, ";
continue;
}
if(substr($line,0,7)=='#email:') {
$emailfound = true;
$print = strtr(substr($line, 8),"\r\n","  ");
echo "mailto:".trim($print)."\" class=\"ylwlink\">";
continue;
}
if(substr($line,0,6)=='#name:') {
$print = strtr(substr($line, 7),"\r\n","  ");
echo trim($print);
if ($emailfound) {
  echo("");
}
continue;
}
if(substr($line,0,6)=='#from:') {
$print = strtr(substr($line, 6),"\r\n","  ");
echo " of ".trim($print);
continue;
}
if(substr($line,0,9)=='#message:') {
$print = strtr(substr($line, 9),"\r\n","  ");
echo " wrote:\n";
echo "".trim($print)."\n";
continue;
}
if(substr($line,0,6)=='#link:') {
$print = strtr(substr($line, 6),"\r\n","  ");
echo "Link: ";
echo "http://".trim($print)."\" target=\"_new\" 
class=\"ylwlink\">".trim($print)."\n";
    continue;
}
if(substr($line,0,9)=='#comment:') {
$print = strtr(substr($line, 9),"\r\n","  ");
echo "And the webmaster responded: 
".trim($print)."\n";
continue;
}
if(substr($line,0,3)=='#--') {
$print = strtr(substr($line, 3),"\r\n","  ");
echo "\n";
continue;
}
  }
  fclose($fp);
?>

-Rasmus


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



Re: [PHP] Getting false positive on strpos ... despite doublecheck...HELP!

2003-03-18 Thread Rasmus Lerdorf
> Do they cause the same behaviour as an if ... elseif structure???

Yes, continue simply discards the rest of the statements inside a loop and 
goes to the next iteration.

-Rasmus


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



Re: [PHP] imagejpeg gives error

2003-03-27 Thread Rasmus Lerdorf
Well, check the error.  Get rid of the header() call and just look at the 
output.

On Thu, 27 Mar 2003, Reuben D. Budiardja wrote:

> 
> Hello,
> I have a script that creates image using the gd library that is bundled with 
> the latest php-4.0.3 on Redhat Linux / Apache as apache mod. Everything works 
> fine when I use png:
> 
> header("Content-type: image/png");
> $im = imagecreate(500,500);
> ...[script]...
> imagepng($im)
> 
> Then when I try to display it as jpeg by changing the header and the last line 
> as follows:
> 
> header("Content-type: image/jpeg");
> $im = imagecreate(500,500);
> ...[script]...
> imagejpeg($im)
>  
> It gives:
> 
> The image "http://localhost/astr162/wedgeplot.php"; cannot be displayed, 
> because it contains errors.
> 
> The question is, is the GD lib that is bundled with php has JPEG support ?
> If yes, what might cause this error?
> 
> Thanks a lot. Any help is appreciated.
> RDB
> 
> 
> 


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



Re: [PHP] imagejpeg gives error

2003-03-27 Thread Rasmus Lerdorf
Do you have libjpeg installed?  You might need to add --with-jpeg-dir=/usr
assuming your libjpeg is in /usr/lib, for example.

-Rasmus

On Thu, 27 Mar 2003, Reuben D. Budiardja wrote:

> On Thursday 27 March 2003 10:42 pm, Rasmus Lerdorf wrote:
> > Well, check the error.  Get rid of the header() call and just look at the
> > output.
> 
> uh.. didn't know I can do that, anyway, it gives:
> 
> Fatal error: Call to undefined function: imagejpeg() in 
> /usr/local/apache/htdocs/astr162/wedgeplot.php on line 131
> 
> So, this brings back the question if the jpeg support is there withe bundled 
> gd library, or do I need some special option with the configure? Here is my 
> configure line (from phpinfo()):
> 
> './configure' '--with-ldap' '--enable-track-vars' '--with-pgsql' 
> '--with-mysql' '--disable-debug' '--prefix=/usr/local/apache/php' 
> '--with-config-file-path=/usr/local/apache/lib' 
> '--with-apxs=/usr/local/apache/bin/apxs' '--with-gd' '--with-zlib'
> 
> Thanks.
> 
> RDB
> 
> 
> > On Thu, 27 Mar 2003, Reuben D. Budiardja wrote:
> > > Hello,
> > > I have a script that creates image using the gd library that is bundled
> > > with the latest php-4.0.3 on Redhat Linux / Apache as apache mod.
> > > Everything works fine when I use png:
> > >
> > > header("Content-type: image/png");
> > > $im = imagecreate(500,500);
> > > ...[script]...
> > > imagepng($im)
> > >
> > > Then when I try to display it as jpeg by changing the header and the last
> > > line as follows:
> > >
> > > header("Content-type: image/jpeg");
> > > $im = imagecreate(500,500);
> > > ...[script]...
> > > imagejpeg($im)
> > >
> > > It gives:
> > >
> > > The image "http://localhost/astr162/wedgeplot.php"; cannot be displayed,
> > > because it contains errors.
> > >
> > > The question is, is the GD lib that is bundled with php has JPEG support
> > > ? If yes, what might cause this error?
> > >
> > > Thanks a lot. Any help is appreciated.
> > > RDB
> 
> 


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



Re: [PHP] Apache vs. IIS

2003-03-28 Thread Rasmus Lerdorf
It's not as fun when you have this same guy sending that exact same 
message to multiple developer lists.  Don't worry though, there won't be 
more of them coming through on the php lists.

-Rasmus

On Fri, 28 Mar 2003, Kevin Stone wrote:

> As much as I disaprove of off topic posts... that was hillarious.  LOL
> - Kevin
> 
> - Original Message - 
> From: "Richard Whitney" <[EMAIL PROTECTED]>
> To: "php" <[EMAIL PROTECTED]>
> Sent: Friday, March 28, 2003 2:30 PM
> Subject: [PHP] Apache vs. IIS
> 
> 
> > How do you take out the Iraqi Intelligence Service?
> > 
> > -- 
> > Richard Whitney   *
> > Transcend Development
> > Producing the next phase of your internet presence.
> > [EMAIL PROTECTED]   *
> > http://xend.net*
> > 602-971-2791
> >   * *   *
> > *  *  *__**
> >  _/  \___  *
> >  *  /   *\**
> >   */ * *  \
> > **/\_ |\
> >  /   \_  /  \
> > /  \/\
> >/  \ 
> >   /\
> >  /  \
> > 
> > 
> > -- 
> > 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



Re: [PHP] GNU & Open Source

2003-03-30 Thread Rasmus Lerdorf
This is a list for questions about PHP.  Look in the titlebar of your
browser when you go to www.php.net to see what the acronym stands for.
Beyond that, please take this stuff somewhere else.

-Rasmus

On Sun, 30 Mar 2003, John Taylor-Johnston wrote:

> Where does PHP.net stand? Is it GNU or OpenSource or both?
>
> What's the difference between www.GNU.org and
> www.OpenSource.org?
> I have been reading:
> http://www.oreilly.com/catalog/opensources/book/intro.html but
> don't get what DiBona, Ockman & Stone mean. OpenSource permits
> folks like RedHat to distribute a paid CD, GNU doesn't?
> OpenSource permits greating a module or plugin to work with a
> Microsoft product and GNU doesn't?
>
> J
>
>
> --
> 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



Re: [PHP] Re: parse_str()

2003-04-02 Thread Rasmus Lerdorf
> "Jose" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> I might be wrong here, but with the code below I would expect $_GET to be
> filled and the script to output the next line:
> 
>$example_string = 'action=kick&item=me';
>parse_str($example_string);
>var_dump($_GET);
>?>
> 
> // expected output:
> //
> // array(2) { ["action"]=>  string(4) "kick" ["item"]=>  string(2) "me" }
> //
> 
> Is my assumption wrong? What would be the workaround?

Your assumption is way wrong.  $_GET will only contain data that actually 
passed through a GET-method request.  Decoding a URL-encoded string 
doesn't suddenly make it GET data.  It will simply create entries in your 
global symbol table, or alternatively you can pass a second argument which 
is an array it will put the data into.  As per the docs.

-Rasmus


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



Re: [PHP] Which PHP version is stable with apache 2.0.39

2003-04-03 Thread Rasmus Lerdorf
There isn't.

On Fri, 4 Apr 2003, Jason Smith wrote:

> Hi,
>
> Need some information as I cant seem to find it in the manual or online.
>
> We are running apache 2.0.39 on redhat 7.3 and would like to run PHP on
> the same server.
> I am having trouble finding out if there is a stable version that runs
> with Apache 2.0.39
>
> Any help appreciated
>
> Cheers
> jason
>

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



Re: [PHP] custom error handling + fopen

2003-04-04 Thread Rasmus Lerdorf
You can't really separate them.  In your error handler you can check what
type of error it was and treat them differently.

On Sat, 5 Apr 2003, Dan Rossi wrote:

> hi guys i have a custom error handler setup within a class , i can trigger
> it with trigger_error , also i am sending my ustom triggers to
> E_USER_WARNING , althogh even having fopen supressed @fopen i am still
> getting errors returned to the same area as my current codes , how can i
> seperate my custom codes from the php ones ,
>
> i am getting this fopen(http://electroteque.dyndns.org:1023/krafterk)
> [function.fopen]: failed to create stream: HTTP request failed! HTTP/1.1 404
> Not Found
>
> and i have the check
> if (!$this->handle = @fopen($src_name,$attr)) {
>
> } else {
> throw errror here
> }
>
> still not happening
>
>
> --
> 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



Re: [PHP] Found a bug in 4.2.3 re: and echo vs.

2003-04-04 Thread Rasmus Lerdorf
I don't see a parse error, but the order of things is not going to be what
you want because it is going to run the function and thus do the echo
inside alarmLightYMD() before it does the outermost echo.  If it had done
anything else it would really have been a bug.

-Rasmus

On Fri, 4 Apr 2003, Daevid Vincent wrote:

> Here, try this bullshit...
>
> I can't upgrade to a more recent version as I'm not in control of the
> server, but I've tried it with both 4.1.2 and 4.2.3 on linux with a RH
> install. Can anyone confirm or dispute this bug exists in later versions?
>
> How does a parsing error like this go un-noticed for so long?
>
> Obviously I took out all the interesting stuff in the page and so that can't
> be blamed. This is about as bare skeleton test case as you can get.
>
> *sigh*
>
> snip
>
>function alarmLightYMD()
>   {
>   return "";
>   }
>
>   function alarmLightMySQL()
>   {
>   echo alarmLightYMD();
>   }
> ?>
> 
> 
>   FUCKED UP PHP Bug #1234170238741023
> 
>
> 
> PHP Version 4.1.2
> PHP Version 4.2.3
> 
> Why the FUCK doesn't this work
> 
> 
>  for ($i = 0; $i < 10; $i++ ) {
>echo "";
>   echo "".alarmLightMySQL()."";
>   echo "this fails!";
>echo "";
> }
> ?>
> 
>
> 
>
> YET THIS DOES!
> 
> 
> 
>
>   
>   this works
>
> 
> 
> 
> 
>
> snip
>
>
>
> "Ezekiel 25:17. The path of the righteous man is beset on all sides by the
> inequities of the selfish and the tyranny of evil men. Blessed is he who in
> the name of charity and goodwill shepherds the weak through the valley of
> darkness, for he is TRULY his brother's keeper and the finder of lost
> children. And I will strike down upon thee with GREAT vengeance and
> FU-U-U-URIOUS anger, those who attempt to poison, and destroy my brothers!
> And you will KNOW my name is the Lord, when I lay my vengeance upon thee!"
>
>
> --
> 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



RE: [PHP] custom error handling + fopen

2003-04-04 Thread Rasmus Lerdorf
I am not sure if you are asking me a question or not here.  But no, like I
said, when you set a custom error handler, that error handler is going to
get called for all catchable errors.

-Rasmus

On Sat, 5 Apr 2003, Dan Rossi wrote:

> apolgies sorry i removed a check for E_WARNING
>
> // case E_WARNING:
>   case E_USER_WARNING:
>   $this->_throw($code);
>   break;
>
> sorry basically i can trigger a E_USER_WARNING and catch that only in my
> callback function
>
> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
> Sent: Saturday, April 05, 2003 2:11 PM
> To: Dan Rossi
> Cc: Php-General
> Subject: Re: [PHP] custom error handling + fopen
>
>
> You can't really separate them.  In your error handler you can check what
> type of error it was and treat them differently.
>
> On Sat, 5 Apr 2003, Dan Rossi wrote:
>
> > hi guys i have a custom error handler setup within a class , i can trigger
> > it with trigger_error , also i am sending my ustom triggers to
> > E_USER_WARNING , althogh even having fopen supressed @fopen i am still
> > getting errors returned to the same area as my current codes , how can i
> > seperate my custom codes from the php ones ,
> >
> > i am getting this fopen(http://electroteque.dyndns.org:1023/krafterk)
> > [function.fopen]: failed to create stream: HTTP request failed! HTTP/1.1
> 404
> > Not Found
> >
> > and i have the check
> > if (!$this->handle = @fopen($src_name,$attr)) {
> >
> > } else {
> > throw errror here
> > }
> >
> > still not happening
> >
> >
> > --
> > 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



RE: [PHP] Re: Found a bug in 4.2.3 re: and echo vs.

2003-04-04 Thread Rasmus Lerdorf
You are getting completely mixed up.  Simplifying your example:

function foo() { echo "foo"; }

$a = "".foo()."";

Will you agree that this is bogus code?  foo() is not going to return
anything, so the resulting value of $a is going to be "".
Correct?  But while that assignment is happening the foo() function echoes
something, so you will see "foo" in the output, but it has nothing to do
with what ends up in $a.  Nothing changes when you change the code to be:

function foo() { echo "foo"; }

echo "".foo()."";

The parser is going to build a string to be echoed since you used the
string concatenation operator (dot).  While building that string one of
the components happen to output something, so that something will get
output.  Then the string that was built will be output.  So what you see
is:

foo

Perhaps it is clearer if we make the function return something:

function foo() { echo "foo"; return "bar"; }

echo "".foo()."";

What do you think the output will be here?  We build a string out of the
components, but while building, foo() happens to echo "foo", then we
finish constructing the string and output the final string.  So the result
is:

   foobar

As someone else pointed out, if you use commas here, things change a bit:

function foo() { echo "foo"; }

echo "",foo(),"";

The comma syntax for echo is basically a shortcut for executing echo
multiple times.  The above is equivalent to writing:

echo "";
echo foo();
    echo "";

In this case things will be output in the correct order as we are no
concatenating a bunch of parts to make a single string before echoing it
in this case.

-Rasmus

On Fri, 4 Apr 2003, Daevid Vincent wrote:

> Mmm. I'm still not following and not completely convinced.
>
> Changing "echo alarmLightYMD();" to simply "alarmLightYMD();" in the bottom
> function doesn't print anything in the table cell at all (for the first test
> case).
>
> While your idea at first makes sense and does seem like a newbie mistake
> (and you are correct, I do have nested "echo" statements come to think of
> it). What I don't get is why it's not consistent. "Expanding" the relevant
> lines, it should be like this:
>
> echo "".(echo "")."";
>
> Which fails, and the other line would be (which works):
>
> "); ?>
>
> In my book, they're both double echoing the output if you will... Are you
> with me on that?
>
> So again, why does the second one work and the first one doesn't?
>
> > -Original Message-
> > From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
> > Sent: Friday, April 04, 2003 5:20 PM
> > To: Daevid Vincent
> > Cc: [EMAIL PROTECTED]
> > Subject: [PHP] Re: Found a bug in 4.2.3 re:  and echo vs. 
> >
> >
> > It's a coding error... at least I think so.
> >
> > change alarmLightMySQL just return the results not "echo"
> > them... echoing
> > them doesn't make much sense inside another echo statement...
> >
> > On Fri, 4 Apr 2003, Daevid Vincent wrote:
> >
> > > Here, try this bullshit...
> > >
> > > I can't upgrade to a more recent version as I'm not in
> > control of the
> > > server, but I've tried it with both 4.1.2 and 4.2.3 on
> > linux with a RH
> > > install. Can anyone confirm or dispute this bug exists in
> > later versions?
> > >
> > > How does a parsing error like this go un-noticed for so long?
> > >
> > > Obviously I took out all the interesting stuff in the page
> > and so that can't
> > > be blamed. This is about as bare skeleton test case as you can get.
> > >
> > > *sigh*
> > >
> > > snip
> > >
> > >  > >   function alarmLightYMD()
> > >   {
> > >   return "";
> > >   }
> > >
> > >   function alarmLightMySQL()
> > >   {
> > >   echo alarmLightYMD();
> > >   }
> > > ?>
> > > 
> > > 
> > >   FUCKED UP PHP Bug #1234170238741023
> > > 
> > >
> > > 
> > > PHP Version 4.1.2
> > > PHP Version 4.2.3
> > > 
> > > Why the FUCK doesn't this work
> > > 
> > > 
> > >  > > for ($i = 0; $i < 10; $i++ ) {
> > >echo "";
> >

Re: [PHP] Running scripts in non-php file

2003-04-04 Thread Rasmus Lerdorf
That should be all you need.  Make sure that something isn't re-assigning
those extensions later on in your conf file.  Perhaps you changed the
wrong addtype?  Liek a commented out one?

-Rasmus

On Fri, 4 Apr 2003, Tom Tsongas wrote:

> Hi folks.
>
> This will probably sound like a stupid question, but I will ask it
> anyway: how can I get the PHP interpreter to execute scripts in files
> that don't have the .php extension? i.e. if I want to embed php code
> into a .html or .xml file that gets run.
>
> I thought all I had to do was add the extension to the AddType
> application in the apache configuration file so it looked like this:
>
> AddType application/x-httpd-php .php .html .xml
>
> I tried it but the code isn't being executed. (And yes, I did restart
> apache)
> Am I missing something?
>
> Tom
>
>
> --
> 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



Re: [PHP] HTTP or HTTPS

2003-04-05 Thread Rasmus Lerdorf
I usually just use $_SERVER['SERVER_PORT']

-Rasmus

On Sat, 5 Apr 2003, Alexander Weber wrote:

> Unfortunally is not set. It's like the variable does not exist, because when
> I extract the varaible $_SERVER with foreach I don't get HTTPS as key, only
> SERVER_PROTOCOL.
>
> I'm using PHP 4.3.1 as Apache2 Module on Win2k SP3.
> register_globals OFF
> safe:mode OFF
>
> stunnel 4.04 on x86-pc-mingw32-gnu WIN32 with OpenSSL 0.9.7 31 Dec 2002
>
> If you need more info:
>
> ICQ 46858764.
>
> Thanx
>
> Alex
>
> "John W. Holmes" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
> news:[EMAIL PROTECTED]
> > > anybody knows how to find out the connection type (http or httpS)?
> > Tried
> > > out
> > > $HTTP_SERVER_VARS.
> >
> > $_SERVER['HTTPS'] will be set if it's over HTTPS.
> >
> > ---John W. Holmes...
> >
> > PHP Architect - A monthly magazine for PHP Professionals. Get your copy
> > today. http://www.phparch.com/
> >
> >
>
>
>
> --
> 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



Re: [PHP] Apache SetHandler

2003-04-05 Thread Rasmus Lerdorf
This can be done using the apache_hooks sapi module.  Look in
sapi/apache_hooks in the 4.3 sources for details.

-Rasmus

On Sat, 5 Apr 2003, Zoff wrote:

> Tom Rogers wrote:
> > Hi,
> >
> > Saturday, April 5, 2003, 6:29:50 AM, you wrote:
> > Z> Hi !
> >
> > Z> what i want is to write something in PHP which does authentication
> > Z> (not basic auth but my own DB driven stuff) and after that something
> > Z> apache resumes normal operation so that whatever is served afterwards
> > Z> does not need to know anything of the auth process.
> >
> > You would probably be better off using an apache module for this.
> > Something like Mod Auth MySQL It would be easy to make the module
> > set a few enviroment variables if you need to pass info to php.
> >
>
> yeah but my question is:
> is it possible to write an apache module in PHP.
> or do something real close to that ?
>
> please some answer my question and don't give me something else i could do.
> I am not a newbie i know what i need, and i also know what else i could use.
>
>   thanks
>
>   Zoff.
>
>
> --
> 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



Re: [PHP] Force no Cache

2003-04-05 Thread Rasmus Lerdorf
header('Cache-Control: no-cache, must-revalidate');
header('Pragma: no-cache');
header('Expires: Mon,26 Jul 1980 05:00:00 GMT');


On Sat, 5 Apr 2003, [iso-8859-1] Davíð Örn Jóhannsson wrote:

> Is there any way in php to disable the users cache so that every time
> you reload you fetch the newest version of the site?
>
>
> Regards, David
>

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



Re: [PHP] If else.. display no picture..

2003-04-05 Thread Rasmus Lerdorf
I would help if you told us which line the error was on

On Sat, 5 Apr 2003 [EMAIL PROTECTED] wrote:

> Hi,
>
> I'm trying to do the following.. When $stadpict is filled in it must display the 
> picture (only the path to the picture is stored in Mysql). But when the string 
> ($stadpict) is empty then it must not display the picture (and also not display a 
> box with a red cross in it (can't display picture! ;>). The only thing i'm getting 
> is an error message...
>
> Parse error: parse error, unexpected T_STRING, expecting ',' or ';'
>
> Code;
>  // includes
> include("../conf/config.php");
>
> // open database connection
> $connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
>
> // select database
> mysql_select_db($db) or die ("Unable to select database!");
> $stedenid=$_GET['stedenid'];
>
> // generate and execute query
> $query2 = "SELECT stedenid, naamstad, stadomschrijvk, stadpict FROM steden WHERE 
> stedenid = $stedenid";
> $result2 = mysql_query($query2) or die ("Error in query: $query2. " . mysql_error());
> $row2 = mysql_fetch_object($result2);
> if (mysql_num_rows($result2) > 0)
> {
> ?>
>
> naamstad; ?> 
> stadpict;
> ?>
>
> 
> 
>  
>  
> 
> 
>
> while($row->$stadpict > 0)
> {
> ?>
>  height="160" alt="">
>  }
>  ?>
>  $row2->stadomschrijvk;
> }
> else
>
> {
> Echo Geen informatie beschikbaar;
> }
> ?>
>
>
> Thanks for helping me out!
>
> Frank
>
>

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



  1   2   3   4   5   6   7   8   9   10   >