RE: [PHP] BUG: require_once() or die(); = fatal error

2003-11-29 Thread Rasmus Lerdorf
By default the CLI version turns off the html in the error messages.  And 
no, really, there is no bug here.  You are testing the return code of 
something that doesn't have one.  It doesn't make sense.

-Rasmus

On Fri, 28 Nov 2003, Daevid Vincent wrote:

 Hmm... Well Rasmus, I do see your point, however it still seems to me it
 'should' at least compile and work as I expect it to.
 
 My way, the logic is that the file *is* 'required' (whereas I view 'include'
 files as optional), and I want to exit the program with a graceful message
 instead of the fatal error (which doesn't really doesn't tell me what the
 problem is -- Failed opening required '1' doesn't mean anything to me or
 the user) that is shown. My intent was to put a  @require_once() so that I
 could do just that. Especially since I'm running my script on the command
 line, and your stock fatal error message uses HTML tags.
 
 Not a critical bug or a show stopper, but I do still feel it is a bug.
 
  -Original Message-
  From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED] 
  Sent: Wednesday, November 26, 2003 8:55 PM
  To: Daevid Vincent
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] BUG: require_once() or die(); = fatal error
  
  This code doesn't make much sense.  By definition, if require 
  cannot open
  a file it throws a fatal error, so you would never hit the or case
  anyway.  Hence there is no return code from require and you 
  can't write
  code like this.  If you want to test the return code you need to use
  'include' instead.
  
  -Rasmus
  
  On Wed, 26 Nov 2003, Daevid Vincent wrote:
  
   Using PHP 4.2.2 on Linux RH8:
  
   In a PHP script run from command line,
  
 require_once(gibberator_data.php) or die(No Data 
  file found\n);
  
   Causes:
  
   [EMAIL PROTECTED] gibberator]# ./gibberator.php
   br /
   bFatal error/b:  Failed opening required '1'
   (include_path='.:/php/includes;/usr/share/phpwebtools') in
   b/home/gibberator/gibberator.php/b on line b13/bbr /
  
   However
  
 require_once(gibberator_data.php);
  
   Works just fine.
  
   --
   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] The clock issue in this forum!

2003-11-28 Thread Rasmus Lerdorf
Why are you sorting your email on the sender's timestamp and not the
arrival timestamp in your mailbox?  Or is this really another thing
Outlook can't figure out?

-Rasmus

On Thu, 27 Nov 2003, Kim Steinhaug wrote:

 Im using Outlook Express reading theese messages and I
 think the newsreader works just fine.

 But what do I do when theese people post with wrong dates.
 Is there any way in Outlook Express I can remove theese posts,
 or do I have to see them topping the list every time I check the
 lists?

 Ive tried several ways now, but I cant seem to fix them.

 Any help would be appritiated? Maby I should change
 newsreader?

 --
 Kim Steinhaug
 ---
 There are 10 types of people when it comes to binary numbers:
 those who understand them, and those who don't.
 ---

 --
 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] Add Reply-To to this list(s)

2003-11-26 Thread Rasmus Lerdorf
Just to add an authoritative answer here.  Mucking up the reply-to header
is simply wrong.  I don't really care what arguments you come up with, it
makes no technical sense.  The list has been configured this way for years
and years and believe me, it is the safest and most flexible
configuration.  If you guys can't figure out how to use reply-all and
procmail to filter out duplicates if you don't want to see those, well,
then tough.  This is a technical mailing list.  I refuse to let a small
group of folks without the technical know-how make a mess of the list for
all of us who know how to deal with mailing lists correctly.

-Rasmus

On Wed, 26 Nov 2003, Nigel Jones wrote:

 Ok lets put it this way...

 There is LESS chance that a reply should be directed to X user than to the
 whole list

 If I want to CC something to the writer then let me but 99%(all together) of
 Mailing List Posts are directed to the actual List.

 Also why do we have to change clients? We have a FREEDOM of CHOICE

 If messing with the Reply-To headers then why does the NZPHPUG do it?
 ([EMAIL PROTECTED])

 Maybe we should consider a change or have a list like Digest(or whatever it
 is) where the Reply-To header is 'mugged'

 My 2 cents



 _
 Nigel Jones
 [EMAIL PROTECTED]

 --
 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] Add Reply-To to this list(s)

2003-11-26 Thread Rasmus Lerdorf
On Wed, 26 Nov 2003, Dave G wrote:
 Just to add an authoritative answer here.  Mucking up the reply-to
 header is simply wrong.  I don't really care what arguments you come up
 with...
   This seems to describe the tone of the debate. The idea of an
 authority on a matter that is incapable of considering alternate
 viewpoints seems oxymoronic to me.

It was an authoritative answer in the sense that I'm the guy who would 
have to be convinced to make this change and I really don't see this 
happening.  I do understand all the arguments and I have duly considered 
them.  Believe it or not, but I actually know a little bit about this 
stuff.  Here are just a small set of reasons to keep things the way they 
are:

 1. Default to safety!  

  If I think I am sending a private email and unknown to me it ends up 
  going to a public mailing list with hundreds of subscribers and
  archives all over the Net, there is no way to undo the security 
  breach this could cause if I inadvertently put some non-public 
  information in my reply.  If the odd message intended to be public
  instead ends up private, this is a small price to pay and something
  that can easily be remedied by either the sender or the receiver
  after the fact.

 2. People often want personal responses

- There are many interfaces to the PHP mailing lists and people do 
  not need to be subscribed to send a question to one of the lists.  
  If you are not subscribed to the list, it is very nice to get a
  private reply to your question and all other replies in the thread
  which is exactly what happens when people properly do a reply-all

- Sometimes the mailing lists are slow to propogate messages.  By
  also sending a private reply the person asking the question gets a
  much quicker response.

  And no, the but I don't want two copies isn't much of an argument.
  Any decent mail system should be able to weed out duplicate 
  messages.  The following procmail rule does it, for example:

# Remove duplicates
:0 Whc: msgid.lock
| formail -D 16384 msgid.cache
:0 a:
duplicates

  I'm saving a copy in duplicates, just in case here, but you could 
  also just trash the copy.  

  And yes, I realize not everyone has the ability to install their own
  procmail rules but again, this is a technical forum with a lot of
  people who can do this stuff.  Dumbing down and crippling the list 
  to cater to the less fortunate at the expense of the rest of us is
  not going to happen.  This might even help push others to use more
  advanced mail clients and mail servers.

 3. Avoiding misconfigured mailers from trashing our lists

  I often see vacation messages and other crap on lists that have the
  reply-to set to point back to the list.  This has also been known
  to cause mail loops with dozens of copies of this stuff getting sent 
  to every subscriber of the list.

 4. Quality over quantity

  I personally don't think it would be a bad thing if we saw less 
  replies go directly to the mailing list.  Especially for 
  high-volume php-general where there are a lot of newbie questions.
  If you know something has been answered dozens of times publically,
  a quick private response is fine.  And if the person asking the 
  question would then optionally post a summary later on our signal
  to noise ratio would go up considerably.

 5. Deleting existing reply-to headers?

  Most people would agree that if a message is sent to the list with
  an existing reply-to header, then it shouldn't be deleted.  Because
  if you delete it, there may be absolutely no way to reach the 
  original author.  The purpose of the reply-to header is to allow you
  to specify where you want replies to your message to go.  You could
  even send it from someone else's account and set the reply-to to 
  your address and should should reasonably expect replies to end up
  at the address you specify.  Now, if that holds, then only setting 
  the reply-to on messages that don't already have a reply-to, which
  some mailing list software does, means you now lose consistency. 
  Sometimes a reply will go to the list, sometimes it won't.  

I could rhyme off another 5-10 reasons here, but even stopping after #1 in 
the above list is more than enough for me to justify the current list 
configuration.

-Rasmus

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



RE: [PHP] Add Reply-To to this list(s)

2003-11-26 Thread Rasmus Lerdorf
On Wed, 26 Nov 2003, Nigel Jones wrote:

 You have missed in my opinion the most important thing, many do NOT want to
 throw money down the drain because their Client Doesn't support mailing
 lists ok.
 
 IMHO we'd be better off having a PHP Forum on php.net and scrub the Mailing
 List altogether. That would just about suit everyone. You get to subscribe
 to Topics you want to, you can subscribe to whole forums if you want to,
 less Privacy Issues.

Except perhaps the people you most want to reach.  Many of the oldtimers 
like myself who have the most experience with this stuff and can thus 
answer the most questions would never do so if it was a web forum.  And 
there are plenty of PHP web forums out there that illustrate this point.

A web browser is for buying toilet paper online.  An email client is for
communicating.

-Rasmus

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



Re: [PHP] PHP Java extension--hopeless?

2003-11-26 Thread Rasmus Lerdorf
On Wed, 26 Nov 2003, Kelly Hallman wrote:
 I am trying to find help or information on running the Java extension with
 PHP under Apache on Redhat Linux using a Sun JVM.
 
 I am aware that the PHP documentation says that the Java extension is
 experimental. I am also aware that people say the ISAPI version does not
 work well and that running PHP as a CGI should give better results. We've
 tried, and so far it doesn't seem to be more reliable.

Not sure how ISAPI has anything to do with Apache on Redhat here.  But I 
guess you are just making two disjointed comments.

 Oddly, it does work most of the time. However, maybe 3/10 times or so it
 gives an error. When using the Java extension with PHP running as ISAPI,
 PHP gives the error Unable to create Java Virtual Machine .. when
 running as a CGI I get that or one of several different errors--again,
 only part of the time. That is, when an error does appear, refreshing the 
 page once or twice will usually bring up the correct output.

Ok, maybe not.  So which is it?  There is no ISAPI for Linux.

 At first, I was frustrated that the cookie decrypter was only available in
 Java.. However, after a while I began to see why they chose to do it this
 way: so that you could decrypt the cookie from various languages and
 platforms, but they only needed to maintain one code base.

Having to run a Java emulator just to decode a cookie sounds absolutely 
nuts to me.  Can you not get the algorithm for decrypting this cookie and 
simply write it in C?  That's how everyone else achieves code portability.  

 Now, I'm just frustrated that PHP doesn't work very well with Java.  
 Myself and several others have looked extensively for the answer to this 
 and we've tried all the viable remedies that have been suggested.  Does 
 anyone have any suggestions?  Also, can it be confirmed or denied that 
 Java support will eventually be dropped from PHP?  Plans to improve it?

The demand has been very low and volunteers to improve it are hard to 
find.  If someone steps up to do it, it will improve.

-Rasmus

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



Re: [PHP] Problem with mail() function and exec

2003-11-26 Thread Rasmus Lerdorf
Do you have /bin/sh inside your jail?

On Thu, 27 Nov 2003, th3 th1nk3r wrote:

 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 Hi,
 I have a great problem. I hava an apache 1.3.28 + php 4.3.3 installation into 
 a chroot jail in my Linux box. Into the jail I have installed postfix (with 
 his sendmail executable) and I can send mails with it (I run it like a chroot 
 user to test it). But, with a simple script like this doesn't work:
 
 ?php
 if(mail([EMAIL PROTECTED],hello world!!,Msg))
 echo OK;
 else
 echo Opsss!!!;
 ?
 
 If I run apache from outside the jail, the scripts runs perfectly and send the 
 mail, but inside it doesn't send anything (php don't exec the program 
 sendmail).
 I have the same config in and out the jail, the execs have root like owner (I 
 have test it with apache like owner, but doesn't work) I have test it with 
 safe_mode on and off, with safe_mode_exec_dir and sendmail_path, but don't 
 work.
 
 The run functions like exec, don't work. I'm curious because don't work inside 
 and outside the jaul, but the mail function works outside. I have test it 
 with a script that works in an old install of php.
 
 The mail perhaps could function with sockets and contacting the localhost smtp 
 server, but I continu with the exec problem. I think of it like a security 
 problem, because I don't know why is failing.
 
 Any Idea? suggestions?
 
 sorry for my bad english, and thanks ;)
 Byez
 - -- 
 - ---
   Jabber ID: [EMAIL PROTECTED]
   GNU/Linux User# 266578
   http://www.blacklord.net/
 
  -BEGIN GEEK CODE BLOCK-
   Version: 3.1
   GCS/CM d-- s: a? C UL+++ P ++ L+++ E--- W+++ N-- o-- K--- w--- O M- V- 
 PS+++ PE-- Y++ PGP+++ t+ 5+ X+++ R+++ tv-- b++ DI++ D++ G e+++ h r++ y+
  --END GEEK CODE BLOCK--
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.2.2 (GNU/Linux)
 
 iD8DBQE/xU2pXlg6KvYpupERAlDrAJ9Wc7UW7gEj8dJViFQG1g38lOcV+gCgkrIg
 4Ysp0QFLZruAWlWh4pBs9Qs=
 =RiOv
 -END PGP SIGNATURE-
 
 
 -- 
 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] BUG: require_once() or die(); = fatal error

2003-11-26 Thread Rasmus Lerdorf
This code doesn't make much sense.  By definition, if require cannot open
a file it throws a fatal error, so you would never hit the or case
anyway.  Hence there is no return code from require and you can't write
code like this.  If you want to test the return code you need to use
'include' instead.

-Rasmus

On Wed, 26 Nov 2003, Daevid Vincent wrote:

 Using PHP 4.2.2 on Linux RH8:

 In a PHP script run from command line,

   require_once(gibberator_data.php) or die(No Data file found\n);

 Causes:

 [EMAIL PROTECTED] gibberator]# ./gibberator.php
 br /
 bFatal error/b:  Failed opening required '1'
 (include_path='.:/php/includes;/usr/share/phpwebtools') in
 b/home/gibberator/gibberator.php/b on line b13/bbr /

 However

   require_once(gibberator_data.php);

 Works just fine.

 --
 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] Invalid Library??

2003-11-26 Thread Rasmus Lerdorf
Your steps look ok.  Try a make clean and rebuild your mysql.so and see
if that fixes it.  If not, consider just compiling it in statically.  Do
you have a requirement for a shared mysql.so for some reason?

Also, note that Apache 2.x + PHP is still not a recommended platform for
PHP.  If you use a threaded mpm (anything but the prefork mpm) you are
likely to run into issues under load.  We still suggest using
Apache-1.3.29 for any sort of stable production server.  The fact that
Redhat has decided to ship an unstable combination of software doesn't
mean that suddenly all threading problems have magically gone away.

-Rasmus

On Wed, 26 Nov 2003, xmg wrote:


 On Linux RH 9.0 I built Apache 2.0.48 from source
 (to fix a problem I had with an earlier version).
 I also built PHP 4.3.4 using the following configuration
 directives:

 ./configure --with-apxs2=/usr/local/apache2/bin/apxs '--with-mysql=shared,/usr'

 Finally I installed MySQL 3.23.58 from an RPM.

 In the php.ini the extension_dir=/usr/lib/php4
 and I copied in the mysql.so file created when
 built PHP.

 But when I run Apache I see the following in the
 error_log:

 PHP Warning:  Unknown(): Invalid library (maybe not a PHP library)
 'mysql.so'  in Unknown on line 0


 Is there anything obviously wrong with what I am
 doing here? Basically I need Apache, and MySQl,
 and PHP. But I can't seem to find a combination that
 will work together?

 Thanks in advance for any ideas on this.

 lk

 --
 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] Help with fread()

2003-11-26 Thread Rasmus Lerdorf
Why not just fread($pagehandle,32768) ?

On Wed, 26 Nov 2003, Nick Wilson wrote:

 Hi all,

 I'm using the code below to open webpages and read them into a variable.
 I got the example from the manual but am confused as to how to limit how
 much of the page to read.

 Ideally, I just want to read the first 30k of each webpage. Could
 somebody please show me how?


 [EMAIL PROTECTED]($pagebeingcrawled,rb);
 $contents = ;
 do {
 $data = @fread($pagehandle, 8192);
 if (strlen($data) == 0) {
 break;
 }
 $contents.=$data;
 while(true);
 @fclose($pagehandle);


 Many thanks!
 --
 Nick W

 --
 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] Variable

2003-11-26 Thread Rasmus Lerdorf
I couldn't parse this question.  How about posting a code snippet?

On Thu, 27 Nov 2003, Jorge Infante Osorio. wrote:

 Hi every one.
 I am new in this List.

 My problem is:

 I determinate the value of a variable in the botton of  one  page, and I want to use 
 it in the middle of the page, inside
 a while structure, but I cant´n, inside the while structure I calculate the value of 
 this variable several times until I keep with the value that I want, the lastand 
 I want that in eache of the repetition used the final value of the variable to 
 display a result that I want.

 If I can´t not explain my self OK, is due to I a few of Inglish...sorry...

 If any can answer meplease do it..

 Best Regard.


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



Re: [PHP] read session data without starting session

2003-11-26 Thread Rasmus Lerdorf
I don't really understand why you are looping through things there.  A
simple unserialize() on everything after the session_name| part will work
just fine on arrays and everything else as well.

-Rasmus

On Wed, 26 Nov 2003, Andrew Warner wrote:

 I have a script that browses a sessions table and extracts and
 displays the session values for display.  The function below (I don't
 remember where I got it) extracts session data without starting a
 session, but it doesn't handle session values that are arrays.
 Anyone have something like this that works?



 function sess_string_to_array($sd)
 {
 $sess_array = array();
 $vars = preg_split('/[;}]/', $sd);

 for ($i=0; $i  sizeof($vars); $i++)
 {
$parts = explode('|', $vars[$i]);
$key = $parts[0];
$val = unserialize($parts[1].;);

$sess_array[$key] = $val;
 }

 return $sess_array;
 }


 aw

 --
 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] Korean mbstring settings?

2003-10-22 Thread Rasmus Lerdorf
Any Korean users using --with-mbstring=kr ?

What do your mbstring.* settings in your php.ini file look like?  I am
assuming you don't need any output encoding translation but are you using
input encoding translation?

Or if you aren't using mbstring at all, but iconv or something else, I'd 
like to hear about that too.  You can email me privately and I will 
summarize for the list.

-Rasmus

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



Re: [PHP] addslashes() vs. magic_quotes_gpc

2003-10-19 Thread Rasmus Lerdorf
If you are doing both addslashes() and have magic_quotes_gpc turned on, 
then yes, you are double-escaping things.

From a performance-perspective I doubt you could measure much difference, 
but I suppose doing it through magic_quotes_gpc would be faster assuming 
you need to escape all your GPC data.  If you have a lot of GPC data that 
doesn't need to be escaped, then only running addslashes() on the data 
that needs it might be more efficient.

-Rasmus

On Mon, 20 Oct 2003, Jake McHenry wrote:

 If you have magic_quotes_gpc = On in your php.ini file, which it is by
 default, does one still need to have the addslashes function in their
 coding?
 
 When I'm inserting into my database, I have addslashes in place, and I
 haven't change the default value of magic_quotes_qpc = On. I havn't
 seen any side effects from this. It seems like it's doing this job
 twice.
 
 Would any speed difference be seen by using / not using either of
 these? I currently have 3 databases, roughtly 25 tables each, with
 roughly 500 entries in each (growing about 50 daily), and it's
 starting to get sluggish when I do a select * from tablename. I need
 to recover all the speed I can.
 
 If anyone has any other little tweaks I can do to gain performance,
 that would be helpful.
 
 Thanks,
 Jake McHenry
 Nittany Travel MIS Coordinator
 http://www.nittanytravel.com
 
 

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



Re: [PHP] PHP output|Buffer, PLEASE ADVISE

2003-09-21 Thread Rasmus Lerdorf
On Sun, 21 Sep 2003, nabil wrote:
 In general , when you open an html file , the browser start to display and
 draw the tables, then start to display the pictures (on slow internet
 connection).. but when you make your html code inside an php the output will
 be different, it will buffer everything then it will pop the whole page.
 
 I have a question.. how can I make php output and display my website as
 stream html..
 
 because I have a postnuke website and it take ages for popping all contents
 , but when I saved it as html and I upload it on the same apache server ,
 the home page start to be displayed picture after picture and so on ...
 
 Please any advise  ??

The output won't actually be different unless you have turned on 
zlib.output_compression or output_buffering in your php.ini file.  Both of 
these are off by default.  Without these PHP will not do any buffering.  
The only buffering you see is done by Apache and this buffering happens in 
your static file case as well.  It is natural that a static file version 
of a big complex page will render faster than the PHP-generated one.

You can ask Apache to flush its internal buffer by using the flush() call 
from PHP, but it really isn't advised to do that too often.  Apache is 
buffering in order to spew out full TCP packets for maximum efficiency.  
Using flush() defeats that and your application end-to-end page delivery 
time will increase.

-Rasmus

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



Re: [PHP] session_start() || shell access problem......

2003-09-21 Thread Rasmus Lerdorf
On Sun, 21 Sep 2003, CF High wrote:
 Well, is there a way to pass params to file_to_be_executed in command line?
 
 For example:
 
 ?
 $my_param = 'my_include_path';
 $text = `usr/local/bin/php /path/to/my/php/page.php`;
 ?
 
 Somehow I need $my_param to be passed to page.php (the file to be processed
 in command line).
 
 Any ideas?

Just put them after the filename and grab them out of your $argv array.

-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
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 ?php $counter = fopen('counter.txt', 'r');
  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] php5 and mysql licences

2003-06-30 Thread Rasmus Lerdorf
On Mon, 30 Jun 2003, Dan Joseph wrote:
   Is the mysql client library going to be put back in for future betas?  Or
 are we mis-reading the change log and its still there?

There will always be MySQL support in PHP of one kind or another.  The
only change in PHP5 is that we are no longer bundling the client library
itself.  Some reasons in no particular order:

  1. Most systems these days already have the client library installed.
  2. Given 1, having multiple versions of the library can get messy.
 For example, if you link mod_auth_mysql against 1 version and PHP
 against another and then enable both in Apache, you get a nice fat
 crash.  Also, the bundled library didn't always play well with the
 installed server version the most obvious symptom of this being
 disagreement over where to find the mysql.socket unix domain socket
 file.
  3. Maintenance was somewhat lax and it was falling further and further
 behind the released version.
  4. Future versions of the library are under the GPL and thus we don't
 have an upgrade path since we cannot bundle a GPL'ed library in a
 BSD/Apache-style licensed project.  A clean break in PHP5 seemed like
 the best option.

This won't actually affect that many people.  UNIX users, at least the
ones who know what they are doing, tend to always build PHP against their
system's libmyqlclient library simply by doing --with-mysql=/usr when
building PHP.

For the beta1 release, it went out without a mysql.dll extension because
we haven't quite worked out how to handle it, not because the final PHP5
release will not have MySQL support.  Of course it will and Windows users
will not be affected.

-Rasmus

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



Re: [PHP] php-general as REPLY TO

2003-06-30 Thread Rasmus Lerdorf
Guys, this will not change.  Look back through the archives.  It has been
discussed a couple of times.  If you don't like it, unsubscribe.  Sorry to
be blunt, but this is a waste of bandwidth.

Keep in mind that many people post without being subscribed to the list,
so only sending a reply to the list doesn't get them the answer they were
looking for.  Also, often the list can get slow and getting a private copy
of the answer to your question means you don't have to wait an hour or
more for it.  If you don't know how to configure your mail system to get
rid of duplicates, then you will have to suffer through hitting the delete
key an extra time.  And finally, defaulting to a public post when replying
to an individual is simply wrong.

-Rasmus

On Mon, 30 Jun 2003, Doug Essinger-Hileman wrote:

 On 30 Jun 2003 at 22:34, Derick Rethans wrote:

   I disagree with you Derick. In many (most? all?) programs, the
   reply- all function will send an email back to the list **and** one
   to the author. This wastes bandwidth needlessly, in my opinion. I
   receive the messages to the list and do not need to receive a
   message sent directly to me.
 
  You have procmail for that. There is some very good explanation for
  this, see
  http://www.math.fu-berlin.de/~guckes/faq/maillist.html#munge_reply-to

 First, Derick, not everyone has access to procmail. In fact, most
 folk **do not** have access to procmail.

 Second, I still think it antithetical to the whole idea of a public
 mailing list to set the reply-to default to anything other than the
 mailing list. Since I see no evil coming out of this, nor any misuse,
 I fail to see the problem. As the owner of a mailing list, I am quite
 familiar with the webpage you referenced; to my mind, it doesn't make
 any valid arguments.

 Having said this, I suspect that you and I will continue to disagree,
 which is perfectly okay. If this list changes the default I will be
 happy. If it doesn't, I will learn to adjust. One request I make is
 that folk, including you, Derick, refrain from sending replies to my
 email to both the list *and* my personal inbox. There's no need to
 waste the bandwidth.

 Doug


 --
 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] Yahoo Stuff.

2003-06-30 Thread Rasmus Lerdorf
Someone had subscribed [EMAIL PROTECTED] to
php-general.  I got rid of it.

-Rasmus

On Mon, 30 Jun 2003, Jeremy Thibeaux wrote:

 I am getting the same message, but I hadn't made the
 connection.  Is anyone else seeing this?

 Jeremy

 --- Daryl Meese [EMAIL PROTECTED] wrote:
  Does anyone know why I get an email from Yahoo
  Groups everytime I submit to
  this list?
 
  The email comes from: Yahoo! Grupos
 
 [EMAIL PROTECTED]
  .com.br]
 
  and the body is:
 
  Olá [EMAIL PROTECTED],
 
  Recebemos sua solicitação para entrar no grupo
  BUNDAS2003
  do Yahoo! Grupos, um serviço de comunidades online
  gratuito e
  super fácil de usar.
 
  Este pedido expirará em 21 dias.
 
  PARA ENTRAR NESTE GRUPO:
 
  1) Vá para o site do Yahoo! Grupos clicando neste
  link:
 
 
 
 http://br.groups.yahoo.com/i?i=JahBLwdWc4CuYfaEw-x7X8UMS3Ye=darylm%40magias
  oftware%2Ecom
 
(Se não funcionar, use os comandos para cortar e
  colar o link acima na
 barra de endereço do seu navegador.)
 
  -OU-
 
  2) RESPONDA a este e-mail clicando em Responder e
  depois em Enviar,
 no seu programa de e-mail.
 
  Se você não fez esta solicitação ou se não tem
  interesse em entrar no grupo
  BUNDAS2003, por favor, ignore esta mensagem.
 
  Saudações,
 
  Atendimento ao usuário do Yahoo! Grupos
 
 
  O uso que você faz do Yahoo! Grupos está sujeito aos
  http://br.yahoo.com/info/utos.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


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



Re: [PHP] php-general as REPLY TO

2003-06-30 Thread Rasmus Lerdorf
On Mon, 30 Jun 2003, John Manko wrote:

 Keep in mind that many people post without being subscribed to the list,

 This is false.  In fact, I tried sending a message to the list from another account 
 that wasn't subscribed, and I got a reply stating the following:

 Because you are not subscribed to [EMAIL PROTECTED]
 using the email address [EMAIL PROTECTED], your message
 has been held until you can confirm that you are a real person sending
 mail.

Correct, and once you confirm your email goes through whether you are
subscribed or not.  Sheez.

-Rasmus

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



RE: [PHP] 'Cannot send Headers' Problem!! MOre..

2003-06-28 Thread Rasmus Lerdorf
First, where is your header call?  And when you do a view source on the
page with the error, what do you see before that error is shown?

-Rasmus

On Sat, 28 Jun 2003, PHPSpooky wrote:

 Glory!

 Well so far all solutions have failed..
 I gave the include functions as the first line of my directory.php as
 this..

 ?php include(global.inc.php);?

 I've given HTML in it's original form.. as well as in echo.. tried
 both..

 This..

 body bgcolor=#314160 background=bg.jpg topmargin=0 marginheight=0
 link=#ffdead vlink=#ff alink=#ffdead

 Or this..

 echo body bgcolor=#314160 background=\bg.jpg\ topmargin=0
 marginheight=0 link=#ffdead vlink=#ff alink=#ffdead;

 for each line.

 And yet nothing is working!
 I still get the Headers cannot be modified error..

 Is there no solution to this problem?

 PHPSpooky


  -Original Message-
  From: Marek Kilimajer [mailto:[EMAIL PROTECTED]
  Sent: Friday, June 27, 2003 7:25 PM
  To: [EMAIL PROTECTED]
  Cc: [EMAIL PROTECTED]
  Subject: Re: [PHP] 'Cannot send Headers' Problem!! MOre..
 
  The top means the top of the file, not the top of your coding.
  Simply:
  Line 1. of directory.php: ?php include_once(global.inc.php) ?
  Line 2. of directory.php: html
  Line 3. of directory.php: head
  
 
  PHPSpooky wrote:
  Headers can't be sent after HTML output, it's as simple
  as it sounds. What that means is, if you suddenly decide
  you want to send a Location header to redirect the browser,
  you can't if you outputted any HTML before the line that
  outputs the location, unless ofcourse your using Output
  Buffering.
  
  
   Excellent.. I understand that fine. But what is the solution for
 this?
  
  
 
 



 --
 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 Certification

2003-06-26 Thread Rasmus Lerdorf
On Thu, 26 Jun 2003, Oscar F wrote:
 Does anybody know of any plans for an official certification path for
 PHP?. Are they launching something like that anytime soon?. Just curious.

Who are they ?

Do you mean the developers of PHP in general?  Nope, no chance.  We write
code, we do not manage world-wide certification programs.  Something like
that would be a fulltime job for a whole team of people.  Generally you do
it through partners who offer local courses and some sort of standardized
or approved certification test.  The oversight of doing this on a global
basis is way beyond what any of us have time for and personally I find the
value of such certification programs extremely questionable.

-Rasmus


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



Re: [PHP] 4.3.2 -- does connection_status() actually work?

2003-06-12 Thread Rasmus Lerdorf
On Thu, 12 Jun 2003, Per Jessen wrote:
 Shouldn't the following work - or rather why doesn't it :


 ignore_user_abort(0);

 for( $i=100; $i; $i-- )
 {
 if ( connection_status() ) exit(0);
 print  blurp.br/; flush();
 sleep(1);
 }
 print Done.br/;

 This is php4.3.2 on apache 2.0.45.

What does it do?  Using connection_status() in a script that doesn't
ignore user aborts is pretty useless.  The script will abort on the print
and never get to the connection_status() line so your code doesn't
actually make any sense.  And, beyond that, all bets are off for
Apache-2.0.x.  No real extensive testing has been done on that platform
which is why we don't suggest running it in production because stuff like
this is likely to be broken even if you got your code right.

-Rasmus

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



Re: [PHP] post data?

2003-06-09 Thread Rasmus Lerdorf
Apache-1.3.x with whatever version of PHP you want.

-Rasmus

On Tue, 10 Jun 2003, Billy wrote:

 Thx a lot John.

 Red Hat 8.0 is bundled with Apache 2 + php 4.2
 if i needed to use Red Hat 8.0, except upgrading both program to the latest
 version  (which as u saidnot recommended) ,   any other combination of
 apache + php do u recommend?

 thx a lot!
 HPS


 John W. Holmes [EMAIL PROTECTED] ???
 news:[EMAIL PROTECTED] ???...
  It's an Apache2 / PHP bug. Upgrade to the latest versions of each
  (although Apache2 and PHP are still not recommended).
 
  ---John W. Holmes...
 
  Amazon Wishlist: http://www.amazon.com/o/registry/3BEXC84AB3A5E
 
  PHP Architect - A monthly magazine for PHP Professionals. Get your copy
  today. http://www.phparch.com/
 
   -Original Message-
   From: esctoday.com | Wouter van Vliet [mailto:[EMAIL PROTECTED]
   Sent: Monday, June 09, 2003 7:21 AM
   To: HPS; [EMAIL PROTECTED]
   Subject: RE: [PHP] post data?
  
   in that case,.. I guess something is going wrong in your checkform
   javascript function .. probably you attach the name and value (by
  mistake)
   to eachother in there 
  
   -Oorspronkelijk bericht-
   Van: HPS [mailto:[EMAIL PROTECTED]
   Verzonden: maandag 9 juni 2003 12:16
   Aan: [EMAIL PROTECTED]
   Onderwerp: Re: [PHP] post data?
  
  
   the form tag is
   form action=syn2.php method=post onSubmit=return
  checkform(this);
  
   Thx!
   HPS
  
  
  
   Esctoday.Com | Wouter Van Vliet [EMAIL PROTECTED] wrote in
  message
   news:[EMAIL PROTECTED]
What does your form tag look like?
   
-Oorspronkelijk bericht-
Van: HPS [mailto:[EMAIL PROTECTED]
Verzonden: maandag 9 juni 2003 9:32
Aan: [EMAIL PROTECTED]
Onderwerp: [PHP] post data?
   
   
Dear all,
   
i am using PHP 4.2.2 with Red Hat 8.0
i had a form in form.php, which has a form like this
input class=text type=text name=course_id size=10 maxlength=10
value=
say, i enter 6 in the text box.
   
After i click the submit button and i echo the value of course_id,
  it
returned 6course_id=6, NOT 6
do you have any idea?
   
   
thx a lot!
HPS
   
   
   
--
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


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



Re: [PHP] post data?

2003-06-09 Thread Rasmus Lerdorf
On Mon, 9 Jun 2003, Michael A Smith wrote:
 Get Apache 1.3.27 (I think). and PHP. Follow the instructions on the PHP
 site! I found that those are the only one's I could get to work. Any PHP
 version using --with-apxs=/usr/local/apache I couldn't get to work. Also
 take a look at what you'll need first and make sure you know what to
 compile with!

You have to specify the full path to the apxs script.  ie.
--with-apxs=/usr/local/apache/bin/apxs or wherever it is.

-Rasmus

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



Re: [PHP] post data?

2003-06-09 Thread Rasmus Lerdorf
Well, this is how millions of people build PHP.  It works pretty well.

-Rasmus

On Mon, 9 Jun 2003, Michael A Smith wrote:

 Yes I know, but I've never been able to get it to work. I just followed
 the instructions on the PHP site.

 -Michael
 On Mon, 2003-06-09 at 10:34, Rasmus Lerdorf wrote:
  On Mon, 9 Jun 2003, Michael A Smith wrote:
   Get Apache 1.3.27 (I think). and PHP. Follow the instructions on the PHP
   site! I found that those are the only one's I could get to work. Any PHP
   version using --with-apxs=/usr/local/apache I couldn't get to work. Also
   take a look at what you'll need first and make sure you know what to
   compile with!
 
  You have to specify the full path to the apxs script.  ie.
  --with-apxs=/usr/local/apache/bin/apxs or wherever it is.
 
  -Rasmus


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



Re: [PHP] Downloading PHP

2003-06-07 Thread Rasmus Lerdorf
Try a different mirror.

On Sat, 7 Jun 2003 [EMAIL PROTECTED] wrote:

 Hello All,
   I have a problem with downloading new PHP 4.3.2. Whenever
 I try to download it from whichever mirror I got a HTTP 404 error.
 Could someone tell why?

   Thanks Milan


 --
 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 Bug?

2003-06-06 Thread Rasmus Lerdorf
Uh, http://www.walkereffects.com/test/include.php is not a full path
name, that is a URL.  That will make an HTTP request to your web server
for /test/include.php which will of course get parsed by PHP and you will
only get the parsed output which means you won't see any variables or any
PHP tags at all for that matter.  This is doing exactly what you are
asking it to do.

-Rasmus

On Fri, 6 Jun 2003, Steven Walker wrote:

 Hello,

 I have found troubling behavior using include() that looks like a bug.
 When I specify an include file by a full path name versus a relative
 path, PHP acts as though it has included the file, but variable and
 constant definitions in the include file are not coming through. My
 server is running PHP 4.3.1.

 Here is an example:

 I created a file called 'include.php', with the following contents:
   ?
   echo include.php opened br; //should print -only- if included,
 right?
   $testVar = test succeeded!;
   ?

 Then I created 'test.php', with the following contents:
   ?
   $testVar = not defined;   //include.php should redefine this as 
 'test
 succeeded!'
   //include(http://www.walkereffects.com/test/include.php;); // full
 path
   include(include.php); // relative path
   echo $testVar;
   ?

 Using the relative path version of include outputs:
   include.php opened
   test succeeded!

 And using the full path results in:
   include.php opened
   not defined

 This doesn't seem right! Any ideas how I can work around this?

 Steven J. Walker
 Walker Effects
 www.walkereffects.com
 [EMAIL PROTECTED]

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



RE: [PHP] Re: Using register_globals

2003-06-05 Thread Rasmus Lerdorf
On Wed, 4 Jun 2003, Jay Blanchard wrote:
 [snip]
 Have register globals set to ON is one way of leaving your script open
 to being exploitable.
 [/snip]

 Please explain this, how does it make it more exploitable? I think that
 this is only true if the code is sloppy.

Correct, if you properly initialize your internal variables there is
nothing insecure about leaving register_globals on.

-Rasmus

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



Re: [PHP] Re: Using register_globals

2003-06-05 Thread Rasmus Lerdorf
On Wed, 4 Jun 2003, Leif K-Brooks wrote:
 It's true that register_globals being on only makes sloppy code more
 insecure.  Most people aren't going to write perfect code, though.  It's
 incredibly annoying to have to unset every variable that shouldn't be
 from an outside source.  Even if you do so, it's very likely that you
 will forget one variable on one page.  It will, of course, be the
 variable allowing admins to blow up a nuclear bomb over New York. :)

It's incredibly annoying to have to initialize your variables?

This would be an example:

  for($i=0;$i10;$i++) {
$str .= $i;
  }

Here, since you haven't initialized $str and you are appending to it,
someone can inject something into $str via GET or POST data.  To fix it,
you have to make the code:

  $str = '';
  for($i=0;$i10;$i++) {
$str .= $i;
  }

Is that really what you find incredibly annoying?  Even without
register_globals, you should be initializing your variables this way.
What if other parts of your code happened to use $str and left stuff in it
you didn't expect?

-Rasmus

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



RE: [PHP] Re: Using register_globals

2003-06-05 Thread Rasmus Lerdorf
On Wed, 4 Jun 2003, Jay Blanchard wrote:
 [snip]
 On Wed, 4 Jun 2003, Jay Blanchard wrote:
  [snip]
  Have register globals set to ON is one way of leaving your script open

  to being exploitable. [/snip]
 
  Please explain this, how does it make it more exploitable? I think
  that this is only true if the code is sloppy.

 Correct, if you properly initialize your internal variables there is
 nothing insecure about leaving register_globals on.
 [/snip]

 Then why has there been such a big deal about register_globals security?
 Is it because so much code is sloppy?

From a robustness perspective, it is not a bad idea to be more explicit
about where your user data is coming from and being able to easily
distinguish user-oriented data from internal data.  What has been blown a
bit out of proportion is the idea that you cannot possibly write secure
code with register_globals on.  That is of course completely false, but
you do have to be a little bit more careful which why the default was
changed to error on the side of safety.

-Rasmus

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



Re: [PHP] $_POST array

2003-06-02 Thread Rasmus Lerdorf
You should read this section of the manual:

http://us2.php.net/manual/en/language.types.string.php

Scroll down the the Variable parsing title and read from there and all
will be clear.

-Rasmus

On Sun, 1 Jun 2003, Steven Farrier wrote:

 I have tried using $_POST array variables in the following ways

 $message = ($_POST['first_name'])
 ($_POST['last_name'])\n($_POST['address'])\n($_POST['city'])
 ($_POST['state'])
 ($_POST['zip'])\n($_POST['country'])\n($_POST['email'])\n($_POST['design'])\
 n($_POST['comments']);

  $message = $_POST['first_name']
 $_POST['last_name']\n$_POST['address']\n$_POST['city'] $_POST['state']
 $_POST['zip']\n$_POST['country']\n$_POST['email']\n$_POST['design']\n$_POST[
 'comments'];

 Neither of these have worked what am I doing wrong?

 Steve

 --
 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 and POP3

2003-06-02 Thread Rasmus Lerdorf
Sure, all the imap_* functions in PHP also work for POP3.  Read through
http://php.net/imap

On Sun, 1 Jun 2003, Erich Kolb wrote:

 I am somwhat aware of the ability to access email using php and IMAP, but is
 it at all possible to download email via pop3?



 --
 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] Add Up Prices in Array

2003-06-01 Thread Rasmus Lerdorf
If they are coming out of your database, why not get your database to do
it for you by calling SUM() in your query?

On Sun, 1 Jun 2003, Ralph wrote:

 I'm querying prices off a database then storing these in an array, I
 want to add these up to get the grand total, how would I go about adding
 up all the prices stored in the array?

 Thanks in advance.





 --
 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] mirror search is going to google !!!

2003-06-01 Thread Rasmus Lerdorf
We are reworking our local search code.  It was killing the server.
Pointed it at Google temporarily.

-Rasmus

On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:

 the idiot mirror search is going to google instead and not giving me results

 http://www.google.com/search?q=manual%2Fen%2Ffunction.connection-
 aborted.php+site:www.php.netl=en



 --
 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: connection_aborted was [PHP] trikky authenticationquestion

2003-06-01 Thread Rasmus Lerdorf
On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:
 how can i get this to work ??

 if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
 WHERE userID=$this-userID);

Did you read the connection handling chapter in the manual?

http://www.php.net/manual/en/features.connection-handling.php

-Rasmus

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



Re: [PHP] OOP question

2003-06-01 Thread Rasmus Lerdorf
On Sat, 1 Jun 2003, Jackson Miller wrote:
 Is it possible to reference two instances of an object at once with a
 single variable name while retaining the ability to reference the
 objects seperately?

No chance.  Well, you could hack it with some really fancy object
overloading, but in general, no, you cannot have a single reference that
references two distinct objects.  References work the other way around.
Given a single distinct object, you can create multiple equivalent
references to it.

-Rasmus

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



Re: [PHP] Shipping Rates

2003-06-01 Thread Rasmus Lerdorf
Better approach in what sense?  From a performance perspective you are not
going to beat a specific set of if conditions unless there is an distinct
formula you can apply.  I will assume there is no simple mathematical
relationship for your full set of data and what you are really looking for
is a way to just feed the pricing structure into your code by some
mechanism and then have it just work, so your goal is to make it more
maintenable.  To that end, you could stick your pricing table into an
array of arrays and simple loop through it.  Something like this:

function find_rate($num) {
$rates = array(array('7.45'=20),
   array('8.45'=35),
   array('9.45'=55),
   array('10.45'=80),
   array('11.45'=100),
   array('13.45'=150),
   array('15.55'=200),
   array('19.45'=9));

foreach($rates as $i = $vals) {
if($num  current($vals)) continue;
else { $price = key($vals); break; }
}
return $price;
}

This should return the correct shipping price for whatever you pass into
find_rate().

-Rasmus

On Sun, 1 Jun 2003, Ralph wrote:

 Maybe it's just that it's late, but can't seem to figure this out. I
 want to show a shipping price depending on the amount of purchase. I
 thought about using a lot of if() statements, but I know this is not the
 best way to go about this.

 Can anybody enlighten me on this one and give me a better approach.

 Here is an example of my shipping rates:

 Less than $20.00 = $7.45
 $20.01-$35.00 = $8.45
 $35.01- $55.00 = $9.45
 $55.01-$80.00 = $10.45
 $80.01-$100.00 = $11.45
 $100.01-$150.00 = $13.45
 $150.01-$200.00 = $15.55
 $200.01 or more  = $19.45

 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] RE: connection_aborted was [PHP] trikky authenticationquestion

2003-06-01 Thread Rasmus Lerdorf
??  Are you reading that chapter at all?  Closing the browser has
absolutely nothing to do with aborted connections unless the browser is
closed while data is actually flowing across the wire.  You are completely
on the wrong track here.  HTTP is a simple stateless protocol.  Sessions
can be used to emulate state, but that doesn't mean you suddenly have a
stateful connection-oriented protocol.  Between clicks of your browser you
do not have an active connection from the browser to the web server (with
the minor exception of keep-alive connections, but they aren't what you
think anyway, so ignore those).  Since you don't have an active
connection, closing your browser could not possible abort a connection.

-Rasmus

On Sun, 1 Jun 2003, electroteque wrote:

 of course thats where i got the example from but it doesnt work

 ignore_user_abort(true);
 if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
 WHERE userID=$this-userID);

 if i close the browser its not setting the fiel to 0 meaning they are logged
 out
 -Original Message-
 From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]
 Sent: Sunday, June 01, 2003 5:46 PM
 To: [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 Subject: Re: [PHP] RE: connection_aborted was [PHP] trikky
 authentication question


 On Sun, 1 Jun 2003 [EMAIL PROTECTED] wrote:
  how can i get this to work ??
 
  if (connection_aborted()) $this-db-query(UPDATE users SET logged_in=0
  WHERE userID=$this-userID);

 Did you read the connection handling chapter in the manual?

 http://www.php.net/manual/en/features.connection-handling.php

 -Rasmus


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



Re: [PHP] Sessions can be dangerous

2003-05-31 Thread Rasmus Lerdorf
On Fri, 30 May 2003, George Whiffen wrote:
 1. Heterogeneous Code Environments
 php session data is not easily accessible from non-php code e.g.
 Perl/C/ASP etc.  In contrast, either client-stored data e.g. cookies,
 hidden posts, get variables, or data stored in a structured database
 table, (i.e. one column per variable), is easily accessible from other
 code.

For anything beyond a trivial application, you are going to be writing
your own backend save_handler anyway, so I don't really see how this is an
issue.  If you don't want to write your own save_handler (which is really
really easy) you can always just set session.serialize_handler = wddx in
your php.ini file and you will have the data stored in a standard XML
format instead.  This format is very accessible from non-PHP code.

 2. Provably Secure Authentication Data

 Hopefully we all know by now that the best way to safely authenticate
 for access control is to make sure the username/password is checked
 every time either by your script, your webserver or a trusted third-party.

 However, I have the feeling some session users are tempted to simply
 authenticate in one script and store a logged in or username flag in
 the session without the username/password having been re-validated.

Sure, but this isn't really specific to sessions.  I would say this is
related to any cookie a developer might create.  There is always the
temptation to not include the auth headers on each page and just toss the
logged in user id into the cookie.  This is obviously a bad idea, but I
wouldn't necessarily attribute this to an inherent danger in sessions.

 3. Independent Audit of Server Stored Data

 Procedures for independently verifying the data stored on a server in a
 SQL RDBMs are well established.  It is easy to query the database schema
 to see what columns are defined.  It is easy to verify that the data
 actually held in a column is as expected.  In general it is easy to
 prove and verify what data is held e.g. to prove Data Protection
 compliance or Bank/Credit Card requirements, (no storage of cvv2 for
 example).

 It is intrinsically much harder to prove that the contents of php
 session data are compliant.  You need to write a php script to unpack
 the session data.  That means proving that that script itself is safe.
 Even after you've unpacked the session data, you still have to make
 sense of it. Different sessions may hold different numbers of
 differently named variables.  But that's not all,  the same variable may
 hold data in different formats in different sessions!

Again, see point 1.  Any real usage of sessions is going to need a custom
save_handler most likely written against a real database.  You simply
cannot go beyond a trivial single-server web-app without doing so and the
facilities in the php session support for doing this is good.

 4. State-ful Designs

 My personal concern about sessions, is more about the design issues.
 What worries me is that sessions may be used to try and re-create
 client/server style state when the most distinctive advantage of the
 internet, (and the key to its astounding success), is that it is
 fundamentally state-less.

 What this means, is that the internet is based on the principle that
 every request is entirely self-contained and independent of any other
 request.  There is for example, absolutely and explicitly, no guarantee
 that http requests will be received in chronological order.  It is all
 strictly about best effort, and no guarantees. This is why the
 internet works: each component does its own job as well as it can
 without worrying about what else is happening.

The boat has long since sailed on this one.  People need and want to
maintain state.  You can't build any sort of shopping-cart style site
without them.

 5. Reduced Component Reusability

 ...

 On the other hand if the update is coded as a proper component i.e. it
 reads the key of the data to be updated from the http request, (GET,
 POST or COOKIE), then you can automatically allow it to be accessed from
 anywhere without having to always go through some particular
 search/list/select sequence.

I tend to distinguish between the human interface to an app and the
machine interface.  Trying to put them both into the same interface tends
to make them cumbersome for both sides.  Often the human interface is just
a thin layer on top of an underlying machine interface and it is at the
machine interface that you have your reusability and transparency.  In a
properly designed architecture, the session layer is simply part of the
human interface and really doesn't affect the reusability of your base
machine interface.

-Rasmus

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



Re: [PHP] making sense of time(), date() and strtotime()

2003-05-30 Thread Rasmus Lerdorf
If you have your date components split up already the way you do, you
should be using mktime().

Next you have to determine which timezone your information is from.  If
you consider your month/day/year values to be GMT values, then use
gmmktime() to generate your timestamp.  Otherwise, make sure you
putenv(TZ=whatever) the timezone that matches your data before your call
to mktime().

It is important to understand that a UNIX timestamp (seconds since 1970
epoch) carries no timezone information.  A single UNIX timestamp
represents one specific second all over the world.  That is, if I gave you
the timestamp for when my baby was born, it would be the exact second this
happened.  This might be Monday here, but Tuesday in Australia.  Timezone
information is only applied once you go to display a human-readable date
from the unix timestamp.  gmdate() is just a special-case that does about
the same as:

   $old = getenv(TZ);
   putenv(TZ=GMT);
   echo date(M d Y H:i:s,$timestamp);
   putenv(TZ=$old);

It is in there because GMT is needed for all sorts of stuff and we figured
having a shortcut version of the above was a good idea.

If you really want to use strtotime() you can just tack the timezone
associated with your data onto the end of the string.  In your example:

  strtotime({$_POST['month']}/{$_POST['day']}/{$_POST['day']} GMT);

if your month/day/year are in GMT.

-Rasmus

On Thu, 29 May 2003, Justin French wrote:

 I have $_POST['day'] (1-31), $_POST['month'] (1-12), $_POST['year']
 (2003-2004).

 I store all dates as unix (epoch) timestamps, and generate the timestamp for
 the event with:

 strtotime('{$_POST['month']}/{$_POST['day']}/{$_POST['day']}');

 Everything works fine on my LAN (Australia), but when I upload my database
 to the live server (US), the dates are a day behind (when echo'd with
 date('Y-m-d')), presumably due to the time difference between the two
 servers.

 Timestamps generated directly on the live server appear correct when echoed
 out using date.


 How can I reliably generate timestamps which will work on any server, and
 reliably convert these timestamps to human readable format (eg
 date('Y-m-d')) on any server?


 Is the key to use GMT in the strtotime() string and use gmdate() instead of
 date()?  Or is it more complex than that?


 Thanks,

 Justin French


 --
 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] Variables don't pass... *sniff*

2003-05-30 Thread Rasmus Lerdorf
On Thu, 29 May 2003, Wendell Brown wrote:

 On Thu, 29 May 2003 10:33:16 +0100, Ford, Mike   [LSS]
 wrote:

 Well, how about references, then?  (And me, personally, I'd use isset()
 rather than is_array().)
 
if (isset($_POST)):
   $POST = $_POST;
else:
   $POST = $HTTP_POST_VARS;
endif;

 I was told that PHP didn't do pointers - just goes to show that you
 can't believe everything your told.  Thanks for the POINTER. ;)

It isn't a pointer.  It is a reference which you should think of as a
symbol table alias.  A pointer, at least by my definition, is a memory
address.  In PHP it isn't a memory address, just another entry in the
symbol table that references the same data as another symbol.

-Rasmus

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



[PHP] Dealing with spam on the list - please read

2003-05-29 Thread Rasmus Lerdorf
Folks, occasionally the odd spam message is going to slip through our
various safeguards and spam will go out on the PHP lists.  We are working
on improving things on our end to reduce the amount that slip through, but
we also need your help with the following:

 1. Do not respond to the list complaining about the spam.  That just
makes things worse.

 2. Do not report the spam to the upstream providers of the PHP mailing
list server.  People tend to report the spam to the abuse address
at Pair Networks which only serves to get our provider upset at us
and does nothing to combat the original spam.  

 3. Please just hit your delete key and move on if you see a spam.  
Local spam filters such as SpamAssassin or Bogofilter are quite
effective at catching the ones that slip through our net.  If
you really feel the need to yell at someone over the spam, please
yell at us.  Send your gripes to [EMAIL PROTECTED] and we will try
to address your problem.

-Rasmus


-- 
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)
 {
 ?

 font class=bold? echo $row2-naamstad; ? /font
 brbr? echo $row2-stadpict;
 ?

 /td
 /tr
  /table
  table cellspacing=0  width=405 cellpadding=0 border=0
 tr style=padding-top:10
 td width=139 valign=top style=padding-left:20
  ?
  
 while($row-$stadpict  0)
 {
 ?
 img src=../steden/images/? echo $row-stadpict; ? border=0 width=108 
 height=160 alt=/td
 ?
 }
  ?
 td width=266 valign=top style=padding-right:10;padding-left:10? echo 
 $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



RE: [PHP] Force no Cache

2003-04-05 Thread Rasmus Lerdorf
On Sat, 5 Apr 2003, John W. Holmes wrote:

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

 Kind of a follow on question to this. If you use a method like this on
 public web pages, does anyone know if it'll affect how search engines
 index your page? Will they ignore it because it's expired? Thanks.

No, as far as I know at least google does not ignore cache-expired pages
like that.  There is a No-Archive meta tag you can put in your page to
tell it not to archive, or of course, you can robots.txt it.

-Rasmus

-- 
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
Presumably you know the HTTPS port on your server.  Anything not SSL is
going to be straight HTTP.  The point here is that SSL happens a layer
below PHP.  PHP doesn't care whether it is running over SSL or not.  In
fact it has no idea what transport layer is below it.  So your only way to
tell is to depend on whatever the web server tells you.  Look at a
phpinfo() for both an SSL and a non-SSL request and see what the
differences are on your server.  For me, checking SERVER_PORT has been the
most portable/reliable mechanism.

-Rasmus



On Sat, 5 Apr 2003, Alexander Weber wrote:

 But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is not
 really secure.

 Alex

 Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]
  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


-- 
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
No, the destination port will not change.  You must be looking at the
source port.

-Rasmus

On Sat, 5 Apr 2003, Alexander Weber wrote:

 So far so good, the next problem is now, that the port changes with every
 new request. Tried this on my personal server an my hoster's one.

 Perhaps there is another way? JScript, xml or anything other?

 Thanx so far,

 Alex


 Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
 news:[EMAIL PROTECTED]
  Presumably you know the HTTPS port on your server.  Anything not SSL is
  going to be straight HTTP.  The point here is that SSL happens a layer
  below PHP.  PHP doesn't care whether it is running over SSL or not.  In
  fact it has no idea what transport layer is below it.  So your only way to
  tell is to depend on whatever the web server tells you.  Look at a
  phpinfo() for both an SSL and a non-SSL request and see what the
  differences are on your server.  For me, checking SERVER_PORT has been the
  most portable/reliable mechanism.
 
  -Rasmus
 
 
 
  On Sat, 5 Apr 2003, Alexander Weber wrote:
 
   But SERVER PORT is not always 80 using HTTP (not HTTPS). So this way is
 not
   really secure.
  
   Alex
  
   Rasmus Lerdorf [EMAIL PROTECTED] schrieb im Newsbeitrag
   news:[EMAIL PROTECTED]
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
  



 --
 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
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: TD and echo vs. ?php?

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

 ?php
   function alarmLightYMD()
   {
   return IMG SRC='images/light_red.gif';
   }

   function alarmLightMySQL()
   {
   echo alarmLightYMD();
   }
 ?
 html
 head
   titleFUCKED UP PHP Bug #1234170238741023/title
 /head

 body
 PHP Version 4.1.2BR
 PHP Version 4.2.3BR
 BR
 Why the FUCK doesn't this work
 P
 TABLE BORDER=1
 ?php
 for ($i = 0; $i  10; $i++ ) {
echo TR;
   echo TD.alarmLightMySQL()./TD;
   echo TDthis fails!/TD;
echo /TR;
 }
 ?
 /TABLE

 HR

 YET THIS DOES!
 P
 TABLE BORDER=1
 ?php for ($i = 0; $i  10; $i++ ) { ?
TR
   TD?php echo alarmLightMySQL(); ?/TD
   TDthis works/TD
/TR
 ?php } ?
 /TABLE
 /body
 /html

 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] Re: Found a bug in 4.2.3 re: TD and echo vs. ?php?

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

function foo() { echo foo; }

$a = TD.foo()./TD;

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 TD/TD.
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 TD.foo()./TD;

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:

fooTD/TD

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

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

echo TD.foo()./TD;

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:

   fooTDbar/TD

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

function foo() { echo foo; }

echo TD,foo(),/TD;

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

echo TD;
echo foo();
echo /TD;

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 TD.(echo IMG SRC='images/light_red.gif')./TD;

 Which fails, and the other line would be (which works):

 TD?php echo (echo IMG SRC='images/light_red.gif'); ?/TD

 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: TD and echo vs. ?php?
 
 
  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
  
   ?php
 function alarmLightYMD()
 {
 return IMG SRC='images/light_red.gif';
 }
  
 function alarmLightMySQL()
 {
 echo alarmLightYMD();
 }
   ?
   html
   head
 titleFUCKED UP PHP Bug #1234170238741023/title
   /head
  
   body
   PHP Version 4.1.2BR
   PHP Version 4.2.3BR
   BR
   Why the FUCK doesn't this work
   P
   TABLE BORDER=1
   ?php
   for ($i = 0; $i  10; $i++ ) {
  echo TR;
 echo TD.alarmLightMySQL()./TD;
 echo TDthis fails!/TD;
  echo /TR;
   }
   ?
   /TABLE
  
   HR
  
   YET THIS DOES!
   P
   TABLE BORDER=1
   ?php for ($i = 0; $i  10; $i++ ) { ?
  TR
 TD?php echo alarmLightMySQL(); ?/TD
 TDthis works/TD
  /TR
   ?php } ?
   /TABLE
   /body
   /html
  
   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 

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] 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] 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:
 
?php
$example_string = 'action=kickitem=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] 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] 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] 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] 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] 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:

?php
  // read the guestbook source file
  // version 1
  $fp = fopen(guestbook.txt,r);

  while (! feof($fp)) {
$line = fgets($fp, 4096);
if(substr($line,0,6)=='#date:') {
$print = strtr(substr($line, 7),\r\n,  );
$print = date(j F Y H.i.s O,strtotime(trim($print)));
echo span class=\ylwbld\On $print, ;
continue;
}
if(substr($line,0,7)=='#email:') {
$emailfound = true;
$print = strtr(substr($line, 8),\r\n,  );
echo a href=\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(/a);
}
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:/spanbr\n;
echo span class=\whttxt\.trim($print)./spanbr\n;
continue;
}
if(substr($line,0,6)=='#link:') {
$print = strtr(substr($line, 6),\r\n,  );
echo span class=\ylwbld\Link:/span ;
echo a href=\http://.trim($print).\ target=\_new\ 
class=\ylwlink\.trim($print)./abr\n;
continue;
}
if(substr($line,0,9)=='#comment:') {
$print = strtr(substr($line, 9),\r\n,  );
echo span class=\redbld\And the webmaster responded: 
.trim($print)./spanbr\n;
continue;
}
if(substr($line,0,3)=='#--') {
$print = strtr(substr($line, 3),\r\n,  );
echo hr width=\85%\ color=\#ff\ noshade align=\center\\n;
continue;
}
  }
  fclose($fp);
?

-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] 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 QA 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] 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] 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] 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] 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 ? and 
? 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 ?xml...?; 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] '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] 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] 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] 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.'br'.$list[$db].'br'.$list[$table].'hr';
 echo $dbtable.br.$list[$db].br.$list[$table].hr;

 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] 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] 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] 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] 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 'tr bgcolor='.$cols[$i%2].'td$row_data/td/tr';
   }

-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
 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] 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




<    1   2   3   4   5   6   7   8   9   10   >