php-general Digest 7 Apr 2002 09:08:29 -0000 Issue 1272

Topics (messages 91889 through 91914):

Re: regular expressions: HUGE speed differences
        91889 by: Chris Adams

Re: how to sort by value in associative array
        91890 by: Chris Adams
        91894 by: Peter J. Schoenster

The PHP Filter did not receive suitable input data
        91891 by: bvr

Re: redirector
        91892 by: Bob
        91893 by: Bob

Re: Executing functions within ereg_replace() output
        91895 by: CC Zona

Re: nl2br returns <BR />? normality or a bug?
        91896 by: Maxim Maletsky

What's wrong with php??
        91897 by: Gerard Samuel
        91907 by: Tyler Longren

Phone number validation
        91898 by: Gary
        91899 by: Jason Cribbins
        91900 by: Justin French
        91901 by: Richard Baskett

Can I fopen() files in .htaccess protected directories?
        91902 by: Dalton Hunter

Re: PHP on Apache 2.0 -- Does it work?
        91903 by: Tyler Longren

/usr/bin/php Question
        91904 by: Chris Kay
        91905 by: Rasmus Lerdorf
        91906 by: Jason Wong

Re: Newbie and includes
        91908 by: G-no / |{iller
        91909 by: Rasmus Lerdorf

move_uploaded_file returning true but not working
        91910 by: Leif K-Brooks

counter for HIGH traffic site
        91911 by: Craig Westerman

Re: How to convert a website to a txtfile....?
        91912 by: Sebastian A.
        91914 by: heinisch.creaction.de

Multiple Selection Menu Dilemma
        91913 by: Phillip S. Baker

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
On Sat, 06 Apr 2002 15:01:24 +0300, Ando <[EMAIL PROTECTED]> wrote:
> (eregi("(<frame[^>]*src[[:blank:]]*=|href[[:blank:]]*=|http-equiv=['\"]refresh['\"]

You might want to try using preg_match instead. The PCRE engine should
be significantly faster. You might also find the ability to pass an
array of expressions would simplify your code significantly.

Chris
--- End Message ---
--- Begin Message ---
On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster
<[EMAIL PROTECTED]> wrote:
> $ArrayOfNewsLinks = array(
>   "http://dailynews.yahoo.com/fc/World/Brazil/"; => array(
>     title => 'Yahoo Brazil News',
>     category  => 'news',
>     language => 'English',
> 
>   ),
...
> function cmp ($a, $b) {
>     if ($a[2] == $b[2]) return 0;
>     //return strcmp ( $a[2], $b[2]); // thought this would work
>     return ($a[1]>$b[1])?1:-1; 
> }
> 
> 
> uksort ($ArrayOfNewsLinks, "cmp");

Try changing those subscripts to keys:
if ($a["language"] == $b["language"])

etc. You should have a ton of PHP warnings generated from the code
above, as numeric elements won't exist.

As a side note, an interesting addition would be using the title as a
second sort key:

        if ($a["language"] == $b["language"]) {
                return strnatcasecmp($a["title"], $b["title"]);
        }
        
--- End Message ---
--- Begin Message ---
On 6 Apr 2002, at 14:38, Chris Adams wrote:

> On Sat, 6 Apr 2002 10:36:18 -0600, Peter J. Schoenster
> <[EMAIL PROTECTED]> wrote:
> > $ArrayOfNewsLinks = array(
> >   "http://dailynews.yahoo.com/fc/World/Brazil/"; => array(
> >     title => 'Yahoo Brazil News',
> >     category  => 'news',
> >     language => 'English',
> > 
> >   ),
> ...
> > function cmp ($a, $b) {
> >     if ($a[2] == $b[2]) return 0;
> >     //return strcmp ( $a[2], $b[2]); // thought this would work
> >     return ($a[1]>$b[1])?1:-1; 
> > }
> > 
> > 
> > uksort ($ArrayOfNewsLinks, "cmp");
> 
> Try changing those subscripts to keys:
> if ($a["language"] == $b["language"])
> 
> etc. You should have a ton of PHP warnings generated from the code
> above, as numeric elements won't exist.

Not running with warnings on that server (bad thing I know).

I tried the above.

uksort ($ArrayOfNewsLinks, "SortByValue");

function SortByValue ($a, $b) {
    if ($a["language"] == $b["language"]) return 0;
    return ($a["language"] > $b["language"]) ? 1 : -1; 
}


or this

function SortByValue ($a, $b) {
  return strcmp ( $a["language"], $b["language"]);
}

Doesn't work.

Peter
http://www.readbrazil.com/
Answering Your Questions About Brazil
--- End Message ---
--- Begin Message ---

Hello!

I'm expirimenting with apache 2 and PHP, I've got things running but 
there's one problem left:

When I request a directory, and the index is a PHP script, the following 
error is reported to the client:

'The PHP Filter did not receive suitable input data'

Apache also reports this error to his error_log:

'Directory index forbidden by rule: <name of the PHP script!>'

And when I enable the 'Indexes' option, Apache logs:

'Not a directory: Can't open directory for index: <name of the PHP script!>'


I'm using my Apache 1.3 configuration but with Filters instead of 
AddType , I hope this is simply a configuration issue.

versions used:
Apache 2.0.35
PHP 4.3.0-cvs (03 Apr 2002 23:53 GMT+1)


apache conf:
# PHP
LoadModule php4_module modules/libphp4.so
<FilesMatch "\.(phpc?|phtml)$">
   SetOutputFilter PHP
   SetInputFilter PHP
</FilesMatch>

# Indexes
DirectoryIndex index.phtml index.html index.php


Any clues ?

Thanks,
bvr.


--- End Message ---
--- Begin Message ---
Well, then you probably can't do much with Apaches mod_rewrite then either..
I know of a Javascript command for doing that history.replace() but if
you're looking for something in PHP, I'm pretty new to PHP and don't know of
anything offhand.. My programmer integrates some Javascript into our stuff I
think (maybe window.location()).. And then sends a location= value to it..
Here's what I could find in the stuff he does for us:

function javascriptJump( $location )
{
 global $PHPSESSID, $HTTP_USER_AGENT;

 if( ( $PHPSESSID or ini_get( "session.use_cookies" ) == 0 ) and ereg( "\?",
$location ) ) $location .= "&PHPSESSID=$PHPSESSID";

 if( !headers_sent() ) header( "Location: $location" );
  else {
   print "<html>\n";
   print "<head>\n";
   print "<script language=javascript>\n";
   print "location='$location';\n";
   print "</script>\n";
   print "</head>\n";
   print "<body bgcolor=white>\n";
   print "Jumping to <a href=\"$location\">$location</a> via javascript.  If
you don't have javascript enabled, click on the link.\n";
   print "</body>\n";
   print "</html>";
  }
 exit;
}

This is one parts he calls that javascriptJump() function from:

javascriptJump( "$PHP_SELF?command=updateInventory&update=done" );

Hope this might help out some..

Later,

Bob Weaver

----- Original Message -----
From: "Joerg Hanke [ML-php]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 4:20 PM
Subject: AW: [PHP] Re: redirector


> i do not own a server, i just own a virtual host, an ordinary
> webspace... i can't do anything in httpd.conf
>
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Gesendet: Samstag, 06. April 2002 21:30
> An: [EMAIL PROTECTED]
> Betreff: [PHP] Re: redirector
>
>
> First things first, when you say domain.com/home/adam do you mean
> /home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know
> that you can make a more educated decision.. Either way, you should be
> able to specifiy DocumentRoot /home/adam/public_html or DocumentRoot
> /home/httpd/htdocs/home/adam in your httpd.conf file for <VirtualHost
> adam.domain.com:80>. Unless you are talking about authenticating users
> or something and redirecting specific users to the target and the rest
> somewhere else..
>
> Bob
>
> "Joerg Hanke" <[EMAIL PROTECTED]> wrote in message
> 002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
> > hi,
> >
> > i've got the possibility to create alias subdomains, which redirect
> > all to the document-root...
> >
> > e.g.:
> >
> > http://adam.domain.com redirects to http://domain.com
> >
> > i want to redirect the users who access http://adam.domain.com to
> > http://domain.com/home/adam
> >
> > how to do this best in php??
> >
> > reguards,
> > george
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
Oh hey, I found this.. It looks like it might be something along the lines
of what you need..

http://www.php.net/manual/en/function.header.php#AEN23288

Now that I look back through the stuff my programmer did that I send
earlier, he uses the header() function.. I just has to be send first and he
tests for that then uses Javascript to redirect if they have it seems..
Anyway, hope this is useful to you..

Later,

Bob Weaver

----- Original Message -----
From: "Joerg Hanke [ML-php]" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 4:20 PM
Subject: AW: [PHP] Re: redirector


> i do not own a server, i just own a virtual host, an ordinary
> webspace... i can't do anything in httpd.conf
>
> -----Ursprüngliche Nachricht-----
> Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Gesendet: Samstag, 06. April 2002 21:30
> An: [EMAIL PROTECTED]
> Betreff: [PHP] Re: redirector
>
>
> First things first, when you say domain.com/home/adam do you mean
> /home/httpd/htdocs/home/adam or /home/adam/public_html.. Once you know
> that you can make a more educated decision.. Either way, you should be
> able to specifiy DocumentRoot /home/adam/public_html or DocumentRoot
> /home/httpd/htdocs/home/adam in your httpd.conf file for <VirtualHost
> adam.domain.com:80>. Unless you are talking about authenticating users
> or something and redirecting specific users to the target and the rest
> somewhere else..
>
> Bob
>
> "Joerg Hanke" <[EMAIL PROTECTED]> wrote in message
> 002701c1dd9a$69c08010$0400a8c0@Joerg">news:002701c1dd9a$69c08010$0400a8c0@Joerg...
> > hi,
> >
> > i've got the possibility to create alias subdomains, which redirect
> > all to the document-root...
> >
> > e.g.:
> >
> > http://adam.domain.com redirects to http://domain.com
> >
> > i want to redirect the users who access http://adam.domain.com to
> > http://domain.com/home/adam
> >
> > how to do this best in php??
> >
> > reguards,
> > george
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Adam Wan) wrote:

> $content = 'string string 12463409834234 string string';
> $content = ereg_replace( "[0-9]{14}" , substr("\\1",0,5) , $content );
> 
> // this is the output i want, but the above doesnt seem to be the right way
> to generate it.
> 
> string string 12363 string string
> --------------------
> 
> any ideas?

For future reference:
<http://www.php.net/preg-replace-callback>

For this instance:
$content = ereg_replace( "([0-9]{5})[0-9]{9}" , "\\1", $content);

-- 
CC
--- End Message ---
--- Begin Message ---
Thanks Torben,

I have rushed into this discussion because I didn't know anything about
this change. Later on I've discovered the rest.

Thank you all.


Sincerely,

Maxim Maletsky
Founder, Chief Developer

PHPBeginner.com (Where PHP Begins)
[EMAIL PROTECTED]
www.phpbeginner.com



> -----Original Message-----
> From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]] On Behalf Of Lars
Torben Wilson
> Sent: Saturday, April 06, 2002 10:30 PM
> To: Justin French
> Cc: php
> Subject: Re: [PHP] nl2br returns <BR />? normality or a bug?
> 
> On Fri, 2002-04-05 at 18:34, Justin French wrote:
> > on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED])
wrote:
> >
> > > You're deadly wrong, Justin. Years of coding and I have never seen
this
> > > behavior of nl2br(). Perhaps I missed its new behavior's
introduction
> > > (guilty as charged if so) but I only remember it returning me <BR>
not
> > > <BR>. I have several regex depending on it.
> 
> 'Deadly' wrong? Wow.
> 
> > Well, I've been at this PHP thing for 2 years, and like I said, "for
as long
> > as *I* can remember, it's been <BR />".  Perhaps it was introduced
in PHP4,
> > perhaps earlier.  I was not an in depth user of PHP3.
> 
> Justin is right on this one. This was changed on Dec 27, 2000. So it's
> been around for quite a long time.
> 
> It was added because it's valid XML *and* valid HTML. It is true that
> some browsers will not correctly interpret <br/> (note the lack of a
> space before the /) but everything I've ever tested has been just fine
> with <br />. As they should.
> 
> This has been discussed a zillion times on the mailing lists. Maxim,
you
> could have found lots of background on the change by searching the
list
> archives (http://marc.theaimsgroup.com) the bug database
> (http://bugs.php.net) and the CVS repository (http://cvs.php.net).
Some
> links which may explain things a bit better:
> 
> A thread on the topic:
> http://marc.theaimsgroup.com/?l=php-dev&m=99321596031773&w=2
> 
> The CVS entry itself:
>
http://cvs.php.net/diff.php/php4/ext/standard/string.c?r1=1.176&r2=1.177
> 
> 
> Torben
> 
> > But I can't be "deadly wrong" :)
> >
> >
> > > False!
> > >
> > > It DOES NOT work fine in every browser. I'd love to give you a
prov, but
> > > because I am lazy I will just tell you this formula:
> > >
> > >
> > > if("I found this issue"=="I noticed screwed pages on my site") {
> > > All I did: preg_replace("<BR[^>]*>", "<BR>", $text); {
> > > ...and pages became pretty again.
> > > }
> > > }
> > >
> > > /// preg 'couse I had no idea what comes up next :-)
> >
> > Again.  I was only stating MY experience.  "Every browser I can get
my hands
> > on".  I do extensive testing, and have never seen a <BR> or <BR/> or
<BR />
> > misbehave.
> >
> > If you have seen it perform unexpectedly, I'm keen to hear about.
> >
> >
> > In fact, if this is the case, then I'll be writing my own nl2br
function
> > which returns a <br>, to avoid this problem ever again.
> >
> >
> > Perhaps in future releases, nl2br() should have an option flag for
switching
> > between XHTML and HTML?  I can't see why the powers that be would
have
> > included XHTML compliance if it wasn't backwards compatible.
> >
> >
> >
> > > when was it changed? Is there any reference?
> >
> > I went to php.net/nl2br and this line of text was in there:
> >
> > "Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All
versions
> > before 4.0.5 will return string with '<br>' inserted before newlines
instead
> > of '<br />'."
> >
> > :)
> >
> > So it would appear that I've only been using nl2br since I got my
hands on
> > PHP4.05+, which according to the earliest date I can find, was
released
> > sometime around 2001-04-30.
> >
> >
> >
> > Justin French
> > --------------------
> > Creative Director
> > http://Indent.com.au
> > --------------------
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> --
>  Torben Wilson <[EMAIL PROTECTED]>
>  http://www.thebuttlesschaps.com
>  http://www.hybrid17.com
>  http://www.inflatableeye.com
>  +1.604.709.0506
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


--- End Message ---
--- Begin Message ---
Well yesterday, my test box went down because of the powersupply failed.
I replaced it today, and I just so happened to pull up a phpinfo() page, 
and it would display half the page and hang.
The test site seems to be operating normally, but phpinfo page isn't 
like it should.
I tried reinstalling, and its still giving the same behaviour.
Anyone heard of this before??

Try and see http://www.trini0.org:81/test.php

--- End Message ---
--- Begin Message ---
It's very possible something went horribly wrong with your entire box when
your ps went out.  Was is a violent outing (sparks), or was is silent (no
sparking or explosions)?  I've had violent ps failures really screw up some
of my machines before.

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

----- Original Message -----
From: "Gerard Samuel" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 7:38 PM
Subject: [PHP] What's wrong with php??


> Well yesterday, my test box went down because of the powersupply failed.
> I replaced it today, and I just so happened to pull up a phpinfo() page,
> and it would display half the page and hang.
> The test site seems to be operating normally, but phpinfo page isn't
> like it should.
> I tried reinstalling, and its still giving the same behaviour.
> Anyone heard of this before??
>
> Try and see http://www.trini0.org:81/test.php
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi All,
  I tried to cut a corner and use an  alphabetic validation I am using 
elsewhere
  $stuff = "/^[a-zA-Z]+$/";
if(preg_match($stuff, $value))

looks like I forgot about +( )- being in phone number. What is the 
easiest way to allow these 4  characters? Are there any other characters 
that people use?

TIA
Gary

--- End Message ---
--- Begin Message ---
Some people use period '.' in between fields...me for one.  Its an old habit
I have although I forget where I picked that up from.  I am sure it was when
I was working overseas...maybe Asia where I saw all phone numbers using .
between fields.

----- Original Message -----
From: "Gary" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 8:52 PM
Subject: [PHP] Phone number validation


: Hi All,
:   I tried to cut a corner and use an  alphabetic validation I am using
: elsewhere
:   $stuff = "/^[a-zA-Z]+$/";
: if(preg_match($stuff, $value))
:
: looks like I forgot about +( )- being in phone number. What is the
: easiest way to allow these 4  characters? Are there any other characters
: that people use?
:
: TIA
: Gary
:
:
: --
: PHP General Mailing List (http://www.php.net/)
: To unsubscribe, visit: http://www.php.net/unsub.php
:
:


--- End Message ---
--- Begin Message ---
FWIW, In Australia, phone numbers are commonly formatted with brackets for
area codes:

(03) 9876 5432
+61 (3) 9876 5432
+61 3 9876 5432

Also the usual array of +,-,.,etc

I'd include ()'s in your reg exp for sure.

Justin


on 07/04/02 1:47 PM, Jason Cribbins ([EMAIL PROTECTED]) wrote:

> Some people use period '.' in between fields...me for one.  Its an old habit
> I have although I forget where I picked that up from.  I am sure it was when
> I was working overseas...maybe Asia where I saw all phone numbers using .
> between fields.
> 
> ----- Original Message -----
> From: "Gary" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, April 06, 2002 8:52 PM
> Subject: [PHP] Phone number validation
> 
> 
> : Hi All,
> :   I tried to cut a corner and use an  alphabetic validation I am using
> : elsewhere
> :   $stuff = "/^[a-zA-Z]+$/";
> : if(preg_match($stuff, $value))
> :
> : looks like I forgot about +( )- being in phone number. What is the
> : easiest way to allow these 4  characters? Are there any other characters
> : that people use?
> :
> : TIA
> : Gary
> :
> :
> : --
> : PHP General Mailing List (http://www.php.net/)
> : To unsubscribe, visit: http://www.php.net/unsub.php
> :
> :
> 
> 

--- End Message ---
--- Begin Message ---
What I do is strip all non-numeric numbers out and just store the number as
a string of numbers.. Then do validation on those numbers.. Make sure the
right amount of numbers are there, valid country, city codes etc.  Probably
an easier approach :)

Rick

Nothing is more common than unsuccessful men with talent. Genius will not;
unrewarded genius is almost a proverb. Education alone will not; the world
is full of educated derelicts. Persistence and determination alone are
omnipotent." - Calvin Coolidge

> From: "Jason Cribbins" <[EMAIL PROTECTED]>
> Reply-To: "Jason Cribbins" <[EMAIL PROTECTED]>
> Date: Sat, 6 Apr 2002 22:47:46 -0500
> To: <[EMAIL PROTECTED]>, "Gary" <[EMAIL PROTECTED]>
> Subject: Re: [PHP] Phone number validation
> 
> Some people use period '.' in between fields...me for one.  Its an old habit
> I have although I forget where I picked that up from.  I am sure it was when
> I was working overseas...maybe Asia where I saw all phone numbers using .
> between fields.
> 
> ----- Original Message -----
> From: "Gary" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, April 06, 2002 8:52 PM
> Subject: [PHP] Phone number validation
> 
> 
> : Hi All,
> :   I tried to cut a corner and use an  alphabetic validation I am using
> : elsewhere
> :   $stuff = "/^[a-zA-Z]+$/";
> : if(preg_match($stuff, $value))
> :
> : looks like I forgot about +( )- being in phone number. What is the
> : easiest way to allow these 4  characters? Are there any other characters
> : that people use?
> :
> : TIA
> : Gary
> :
> :
> : --
> : 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
> 

--- End Message ---
--- Begin Message ---
Hi, does fopen() support the opening and reading of remote files in
directories protected with .htaccess files like ...

fopen("http://user:[EMAIL PROTECTED]/directory/file.php","r";);

If not, is there an alternative way to do this? Thanks!


--- End Message ---
--- Begin Message ---
Well, php 4.1.2 for windows probably wasn't compiled to work with apache 2.
Apache 2 has changed too much for the php developers to keep on top of it.
If you were using unix/linux, you could compile php to work with apache 2,
but since you're using Windows, you're stuck with using Apache 1.3.24 until
the php group releases a new version for Apache 2.

;-)

Tyler Longren
Captain Jack Communications
[EMAIL PROTECTED]
www.captainjack.com

----- Original Message -----
From: "Steve Magruder, D2 Director" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, April 06, 2002 12:52 PM
Subject: [PHP] PHP on Apache 2.0 -- Does it work?


> Hello,
>
>   I'm currently running PHP 1.1.2 on Apache 1.3.24/Win2K in SAPI mode (and
> this configuration has run incredibly well since last summer, albeit with
> changing PHP and Apache sub-versions).  I couldn't find any info at
php.net
> that indicated whether the current or the next version of PHP (1.2.x) will
> successfully run on Apache 2.0 (just GA'd).
>
>   Any info on this will be greatly appreciated.
>
> Regards,
>    Steve
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---

Hi

I have compiled php -with-apxs option and I read in the archives it
don't create a /usr/bin/php.
But I wish to run 2 scripts I have made by command line, I have the 2
scripts outside the web server
Root.

Is there a way to compile a php binary to use for my scripts?

Or does someone have any idea's what's the best way to go about this
would be...

-------
Chris Kay, Eleet Internet Services
[EMAIL PROTECTED]
-------

--- End Message ---
--- Begin Message ---
Just compile again with --with-apxs

On Sun, 7 Apr 2002, Chris Kay wrote:

>
> Hi
>
> I have compiled php -with-apxs option and I read in the archives it
> don't create a /usr/bin/php.
> But I wish to run 2 scripts I have made by command line, I have the 2
> scripts outside the web server
> Root.
>
> Is there a way to compile a php binary to use for my scripts?
>
> Or does someone have any idea's what's the best way to go about this
> would be...
>
> -------
> Chris Kay, Eleet Internet Services
> [EMAIL PROTECTED]
> -------
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
On Sunday 07 April 2002 13:18, Chris Kay wrote:
> Hi
>
> I have compiled php -with-apxs option and I read in the archives it
> don't create a /usr/bin/php.
> But I wish to run 2 scripts I have made by command line, I have the 2
> scripts outside the web server
> Root.
>
> Is there a way to compile a php binary to use for my scripts?

Yes.

> Or does someone have any idea's what's the best way to go about this
> would be...

>From the manual "The default is to build PHP as a CGI program". 

By using the "--with-apxs" option you're telling it to build an Apache module 
and not a standalone binary.

So just:

./configure; make;

then copy the resulting "php" executable somewhere.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
"Show business is just like high school, except you get paid."
- Martin Mull
*/
--- End Message ---
--- Begin Message ---
try
<?php
    require (includes/footer.php)
?>
Hint: You May or may-not need parenthesis around includes/footer.php.

"Dean Ouellette" <[EMAIL PROTECTED]> wrote in message
005801c1dd8c$4c6e9500$0200a8c0@yoda">news:005801c1dd8c$4c6e9500$0200a8c0@yoda...
> Newbie who has my include working with this
> <?php
> include ('includes/footer.php');
> ?>
>
> Problem is when I try to use this with files in other directories I use
> <?php
> include ('/includes/footer.php');
> ?>
>
> Then get file cannot be found.  Is there a way to do this?
>
> Dean
>


--- End Message ---
--- Begin Message ---
But you will most certainly need quotes.

And no, you don't need the ()'s but it works for exactly the same reason
that (1)+(2) is a valid expression with unneccesary brackets.

-Rasmus

On Sun, 7 Apr 2002, G-no / |{iller wrote:

> try
> <?php
>     require (includes/footer.php)
> ?>
> Hint: You May or may-not need parenthesis around includes/footer.php.
>
> "Dean Ouellette" <[EMAIL PROTECTED]> wrote in message
> 005801c1dd8c$4c6e9500$0200a8c0@yoda">news:005801c1dd8c$4c6e9500$0200a8c0@yoda...
> > Newbie who has my include working with this
> > <?php
> > include ('includes/footer.php');
> > ?>
> >
> > Problem is when I try to use this with files in other directories I use
> > <?php
> > include ('/includes/footer.php');
> > ?>
> >
> > Then get file cannot be found.  Is there a way to do this?
> >
> > Dean
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

--- End Message ---
--- Begin Message ---
I run a site where users can, among other things, adopt virtual pets.  I
have several admisistrators on the site, and I am trying to create a thing
that adds a new pet species through the administrator control panel without
me having to ftp it.  It takes four files: red happy, red sad, blue happy,
and blue sad.  Move_uploaded_file returns true on all 4, but doesn't seem to
be uploading.  Here is my code:
if($HTTP_POST_FILES['redhappy']['type'] != "image/gif"){
print "<b>Error:</b> picture not a gif image";
eval($footertext);
exit;
}
if($HTTP_POST_FILES['redsad']['type'] != "image/gif"){
print "<b>Error:</b> picture not a gif image";
eval($footertext);
exit;
}
if($HTTP_POST_FILES['bluehappy']['type'] != "image/gif"){
print "<b>Error:</b> picture not a gif image";
eval($footertext);
exit;
}
if($HTTP_POST_FILES['bluesad']['type'] != "image/gif"){
print "<b>Error:</b> picture not a gif image";
eval($footertext);
exit;
}
if((move_uploaded_file($HTTP_POST_FILES['redhappy']['tmp_name'],
"/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_red_happy.gi
f")) && (move_uploaded_file($HTTP_POST_FILES['redsad']['tmp_name'],
"/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_red_sad.gif"
)) && (move_uploaded_file($HTTP_POST_FILES['bluehappy']['tmp_name'],
"/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_blue_happy.g
if")) && (move_uploaded_file($HTTP_POST_FILES['bluesad']['tmp_name'],
"/hsphere/local/home/ecritter/ecritters.biz/images/$speciesname_blue_sad.gif
"))){
mysql_query("insert into species(name) values('$speciesname')");
}else{
print "Unable to upload";
}

--- End Message ---
--- Begin Message ---
I'm needing counter for site that receives 60 to 80 hits a minute. Many I
have tried cause excessive server load and need to be deactivated or they
lose data and return to zero without warning. All tried so far have been
written in Perl.

Anyone here know of a PHP counter that would handle HIGH traffic with little
added server load? Would using MySQL to store count be of any benifit?

Thanks

Craig ><>
[EMAIL PROTECTED]
--- End Message ---
--- Begin Message ---
You can try using fopen() and fwrite(), they are the primary file
manipulation tools you should use in this instance.

-----Original Message-----
From: Raymond Lilleodegard [mailto:[EMAIL PROTECTED]]
Sent: Saturday, April 06, 2002 5:52 PM
To: [EMAIL PROTECTED]
Subject: [PHP] How to convert a website to a txtfile....?

Hi!

I have this website with a webshop that customers can order some products.
And when the products are listed up in the cart on the screen, would I like
to get the output
into a new txtfile and save it on the server. Then it is possible to get it
faxed, and that is the goal.

Anyone who has done this before?

Thanks for all help!

Best regards

Raymond Lilleodegard



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

--- End Message ---
--- Begin Message ---
At 06.04.2002  17:51, you wrote:
>Hi!
>
>I have this website with a webshop that customers can order some products.
>And when the products are listed up in the cart on the screen, would I like
>to get the output
>into a new txtfile and save it on the server. Then it is possible to get it
>faxed, and that is the goal.
>
>Anyone who has done this before?
Assuming you have a Linux box running,
I did the following, writing the data you got from cart to a .txt file
using fopen(), fputs()
then translate this with a2ps (takes time to get the commandline, so I post 
it here)

a2ps -q -r --footer="nothing" -B --borders=1 --font-size=10.0 --tabsize=3
(cutted here, space between -- parameters)
--left-title="Your Title" -oout1.ps YourInput.txt

Then use Ghostscript to make a faxfile (as above)
gs -q -dBATCH -sDEVICE=faxg3 -sOUTPUTFILE=send -sPAPERSIZE=a4 -dNOPAUSE out1.ps

then sendfax (package mgetty+sendfax) to send this file
I used sendfax, as it is easy to configure, and the commandline is not so 
big ;-)
the commands to a2ps, gs and sendfax are transmitted via exec()
HTH Oliver

--- End Message ---
--- Begin Message ---
Okay I have the following code so far.

         $sql = "SELECT stass_warrior FROM staff_assignments WHERE 
stass_pos = $pos_id AND stass_weekend = $initiation";
         if (!$query = mysql_query($sql))        error(mysql_error());
         $query = mysql_fetch_row($query);

         $sql = "SELECT war_id, CONCAT(war_lname, ', ', war_fname) FROM 
warrior, staff_roster WHERE war_id != 1 AND staff_weekend = $initiation AND 
staff_warrior=war_id ORDER BY war_lname";
         if (!$res = mysql_query($sql))  error(mysql_error());

         tr();
         echo TTT . '<th class="format" width="25%">' . $row[1] . '</th>' . B;
         echo TTT . '<td class="format">' . B;
         echo TTT . '<select name="position_' . $n . '[]" size="5" 
multiple>' . B;
         while($rec = mysql_fetch_row($res))     {
                 ($query[0] == $rec[0] ? $selected =" selected" : $selected 
= "");
                 printf("\t\t\t\t<option value=\"%s_%s\"%s>%s</option>\n", 
$pos_id, $rec[0], $selected, $rec[1]);
         }
         echo TTT . '</select>' . B;
         echo TTT . '</td>' . B;
         trc();

Now my problem is with the multiple feature of the drop down menu.
The first query to the db resulting in the $query variable may contain more 
then one result.
However only the last result will appear with the selected option.

I need some code that is is going to display the selected option next to 
all the correct results in the drop down.
Understand what I am needing?

Thanks for your help
Phillip


--- End Message ---

Reply via email to