php-general Digest 25 Jun 2004 18:12:37 -0000 Issue 2842

Topics (messages 189034 through 189068):

Re: a stupid question
        189034 by: David Robley
        189059 by: Alicia Riggs

R: [PHP] MYSQL Query results in pages
        189035 by: Alessandro Vitale

How? First big letter
        189036 by: Labunski
        189037 by: "Miguel J. Jiménez"
        189038 by: Labunski

Re: a 4 days diary
        189039 by: Alireza Balouch

[Newbie Guide] For the benefit of new members
        189040 by: Ma Siva Kumar

Date Select
        189041 by: Tom Chubb
        189044 by: pete M
        189065 by: Gerben

Re: [PHP-DB] Date Select
        189042 by: jeffrey_n_Dyke.Keane.com
        189043 by: Tom Chubb

Form Submission
        189045 by: Shaun
        189047 by: Matt M.
        189048 by: Shaun
        189049 by: Matt M.
        189050 by: Marek Kilimajer

Re: problems with system() call
        189046 by: Jason Wong

gd2 functions without gd2?
        189051 by: Edward Peloke

Re: Streaming
        189052 by: Stephen Craton

No MySQL in Fedora?
        189053 by: Jough P
        189054 by: Marek Kilimajer

socket_bind
        189055 by: Josh Close
        189056 by: bbonkosk.tampabay.rr.com
        189057 by: Josh Close

How to force mod_php to load php.ini ?
        189058 by: Nico Sabbi
        189060 by: Marek Kilimajer

Understanding behavior of 'directories below files'
        189061 by: KEVIN ZEMBOWER
        189064 by: Michael Sims
        189067 by: KEVIN ZEMBOWER

mail sent but not received?!
        189062 by: Bing Du
        189066 by: Stut

TIFF images
        189063 by: Dan Joseph

string function that adds before and after
        189068 by: Gabe

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 ---
Blake Schroeder wrote:

> Hey
> 
> I cant figureout the syntax please help
> 
> echo "Some text".aFunction()."some more text";
> 
> The function is not working.
> 
> Thanks
> 
> -B
What is it you expect, and what is actually happening?

-- 
David Robley

What do batteries run on?

--- End Message ---
--- Begin Message ---
Your problem is the paren's

echo "'some text' $aFunction 'some more text'";


You need double quotes for the entire string, but single quotes around
the text so it knows it is text.  


Alicia Riggs
Professional Services Group
Senior Web Development Engineer
214-550-7452


-----Original Message-----
From: Blake Schroeder [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 24, 2004 4:45 PM
To: PHP List
Subject: [PHP] a stupid question


Hey

I cant figureout the syntax please help

echo "Some text".aFunction()."some more text";

The function is not working.

Thanks

-B

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

--- End Message ---
--- Begin Message ---
Here is a nice trick guys...

if you want to page the result of this query :

SELECT * FROM user;

turn it into this one:

SELECT SQL_CALC_FOUND_ROWS * FROM user LIMIT $offset,$limit;

so in the end all you have to do is to perform one single query and even
before fetching the rows you can call the mysql_num_rows() function and it
will return the number of total rows rather than just $limit.

cheers,

Alessandro


-----Messaggio originale-----
Da: Matt Matijevich [mailto:[EMAIL PROTECTED]
Inviato: giovedi 24 giugno 2004 21.41
A: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Oggetto: Re: [PHP] MYSQL Query results in pages


[snip]
Is this right? Is there other efficent way to do it?
What about if data changes (i.e. new records are added) while the user
browses through pages?
[/snip]

on each page do a:

SELECT count(*) FROM table WHERE your_condition

this will give you your total number of results

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

--- End Message ---
--- Begin Message ---
Hello, how to make the firs letter of the word Big?

for example I have:
$colour = "car is red";

but I need:
$colour = "Car is big".

Thank you very much,
I would look for the answer myself using google,
but I have no time for it.
I hope there is an easy solution for this.

Lab.

--- End Message ---
--- Begin Message ---
Use ucfirst()

Labunski wrote:

Hello, how to make the firs letter of the word Big?

for example I have:
$colour = "car is red";

but I need:
$colour = "Car is big".

Thank you very much,
I would look for the answer myself using google,
but I have no time for it.
I hope there is an easy solution for this.

Lab.




-- Miguel J. Jiménez ISOTROL, S.A. (Área de Internet) Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA) mjjimenez AT isotrol DOT com --- http://www.isotrol.com ICQ# 12670750 TLFNO. 955036800 ext. 111

--- End Message ---
--- Begin Message ---
Thank you very much! That helps!

As I sad before, I would look for it myself , but I wasn't sleepinng all the
night,
this way I think it would be a liittle bit difficult to find it.
Thank you once more,
Lab.


<Miguel J. Jiménez> wrote in message news:[EMAIL PROTECTED]
> Use ucfirst()
>
> Labunski wrote:
>
> >Hello, how to make the firs letter of the word Big?
> >
> >for example I have:
> >$colour = "car is red";
> >
> >but I need:
> >$colour = "Car is big".
> >
> >Thank you very much,
> >I would look for the answer myself using google,
> >but I have no time for it.
> >I hope there is an easy solution for this.
> >
> >Lab.
> >
> >
> >
>
> -- 
> Miguel J. Jiménez
> ISOTROL, S.A. (Área de Internet)
> Avda. Innovación nº1, 3ª - 41020 Sevilla (ESPAÑA)
> mjjimenez AT isotrol DOT com   ---   http://www.isotrol.com
> ICQ# 12670750
> TLFNO. 955036800 ext. 111

--- End Message ---
--- Begin Message ---
since there aren't much data you can do something like this:

1 . make db table
tableName
   id   INT
  title VARCHAR(30)
  Data TEXT
  timestamp  VARCHAR(30)


2. just dump the data you get from the user into a db..

3. when you are ready to get the data back for view from database you can
simply use SQL
 and ask for the right time and date..

SELECT * FROM myTable WHERE timestamp BETWEN xxxxx AND yyyyy

where xxxxx and yyyyyy is the timastamp value




"Pierre" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi all,
> I have to code a 4 days diary for a client, schedule every 30 mn and with
a
> system of rdv accepted by mail. I really don't know how to start to draw a
> cool diary and to code it correctly to be the most reusable as possible.
POO
> or not? If you have there any examples of this style of coding this is
could
> great or just maybe an idea of how I can start my code to have a good one?
> Just a good direction and way of coding to not have many surprises...
> I hope I was clear
>
> Thx all
>
> Pierre

--- End Message ---
--- Begin Message ---
=======================================
Please feel free to add more points and send 
to the list.
=======================================

1. If you have any queries/problems about PHP 
try http://www.php.net/manual/en first. You 
can download a copy and use it offline also. 

Please also try 
http://www.php.net/manual/faq.php 
for answers to frequently answered questions 
about PHP (added by Christophe Chisogne).

2. Try http://www.google.com next. Searching 
for "php YOUR QUERY" may fetch you relevant 
information within the first 10 results.

3. There is a searchable archive of the 
mailing list discussion at 
http://phparch.com/mailinglists. Many of the 
common topics are discussed repeatedly, and 
you may get answer to your query from the 
earlier discussions. 

For example: One of the repeatedly discussed 
question in the list is "Best PHP editor". 
Everyone has his/her favourite editor. 
You can get all the opinions by going through 
the list archives. If you want a chosen list 
try this link : 
http://www.thelinuxconsultancy.co.uk/phpeditors/
(contributed by Christophe Chisogne).

4. Not sure if PHP is working or you want 
find out what extensions are available to 
you?

Just put the following code into a file with 
a .php extension and access it through your 
webserver:

<?php
phpinfo();
?> 

If PHP is installed you will see a page with 
a lot of information on it. If PHP is not 
installed (or not working correctly) your 
browser will try to download the file.

(contributed by Teren and reworded by Chris W 
Parker)

5. If you are stuck with a script and do not 
understand what is wrong, instead of posting 
the whole script, try doing some research 
yourself. One useful trick is to print 
the variable/sql query using print or echo 
command and check whether you get what you 
expected. 

After diagnosing the problem, send the 
details of your efforts (following steps 1, 
2 & 3) and ask for help.

6. PHP is a server side scripting language. 
Whatever processing PHP does takes place 
BEFORE the output reaches the client. 
Therefore, it is not possible to access 
users' computer related information (OS, 
screen size etc) using PHP. Nor can you 
modify any the user side settings. You need 
to go for JavaScript and ask the question in 
a JavaScript list.

On the other hand, you can access the 
information that is SENT by the user's 
browser when a client requests a page from 
your server. You can find details about 
browser, OS etc as reported by 
this request. - contributed by Wouter van 
Vliet and reworded by Chris W Parker.

7. Provide a clear descriptive subject line. 
Avoid general subjects like "Help!!", "A 
Question" etc. Especially avoid blank 
subjects. 

8. When you want to start a new topic, open a 
new mail composer and enter the mailing list 
address [EMAIL PROTECTED] instead of 
replying to an existing thread and replacing 
the subject and body with your message.

9. It's always a good idea to post back to 
the list once you've solved your problem. 
People usually add [SOLVED] to the subject 
line of their email when posting solutions. 
By posting your solution you're helping the 
next person with the same question. 
[contribued by Chris W Parker]

10. Ask smart questions 
http://catb.org/~esr/faqs/smart-questions.html
[contributed by Jay Blanchard)

11. Do not send your email to the list with 
attachments. If you don't have a place to 
upload your code, try the many pastebin 
websites (such as www.pastebin.com).
[contributed by Burhan Khalid]


-- 
Integrated Management Tools for leather 
industry
----------------------------------
http://www.leatherlink.net

Ma Siva Kumar,
BSG LeatherLink (P) Ltd,
Chennai - 600106

--- End Message ---
--- Begin Message ---
How can I query a MySQL table to get the latest results from a date field?
Basically, I am inserting several records at a time at the end of each week.
I want to have a page that displays the results for the last week only.
The date format in the field is YYYY-MM-DD

--- End Message ---
--- Begin Message ---
select * from table where week(date_field) = ( week(now()) -1 )

Tom Chubb wrote:
How can I query a MySQL table to get the latest results from a date field?
Basically, I am inserting several records at a time at the end of each week.
I want to have a page that displays the results for the last week only.
The date format in the field is YYYY-MM-DD


--- End Message ---
--- Begin Message ---
select * from table where TO_DAYS(date_field) > ( TO_DAYS(NOW()) -7 )

this will give the entries of the last 7 days (and the ones that are in the
future)

"Tom Chubb" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> How can I query a MySQL table to get the latest results from a date field?
> Basically, I am inserting several records at a time at the end of each
week.
> I want to have a page that displays the results for the last week only.
> The date format in the field is YYYY-MM-DD
>

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


>How can I query a MySQL table to get the latest results from a date field?
>Basically, I am inserting several records at a time at the end of each
week.
>I want to have a page that displays the results for the last week only.
>The date format in the field is YYYY-MM-DD


if you want the latest row -
      select * from table order by max(date_column) limit 1;

if you want rows in a range of dates there are lots o ways, and instead of
showing one or two, I'd suggest taking a look at the manual on dates
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing
what fits your needs best.  Seems like you may want to look at BETWEEN

And if you don't want to use those, you are always free to use
      select * from table where date_column < 'yyyy-mm-dd' and date_column
< 'yyyy-mm-dd' order by date_col desc

HTH
Jeff

--- End Message ---
--- Begin Message ---
Jeffrey,
Thanks for this,
I've just realised that it's always the same no of inserts, so perhaps I
should just order by date then my previous sort field and then limit the
result to 20?
(It's all 20 results that I need displayed)
Thanks,
Tom


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 25 June 2004 12:15
To: Tom Chubb
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP-DB] Date Select





>How can I query a MySQL table to get the latest results from a date field?
>Basically, I am inserting several records at a time at the end of each
week.
>I want to have a page that displays the results for the last week only.
>The date format in the field is YYYY-MM-DD


if you want the latest row -
      select * from table order by max(date_column) limit 1;

if you want rows in a range of dates there are lots o ways, and instead of
showing one or two, I'd suggest taking a look at the manual on dates
http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html, and seeing
what fits your needs best.  Seems like you may want to look at BETWEEN

And if you don't want to use those, you are always free to use
      select * from table where date_column < 'yyyy-mm-dd' and date_column
< 'yyyy-mm-dd' order by date_col desc

HTH
Jeff

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

--- End Message ---
--- Begin Message ---
Hi,

I have a form on my page. The form action is linked to itself so that the
values entered will refresh the page accordingly. Is it possible to add
another button to the form that utilises my JavaScript popup function and
takes the values from the same form?

function openQueryWindow(URL) {
  var args
="left=150,top=100,width=742,height=402,toolbar=no,location=no,directories=n
o,status=nos,menubar=no,scrollbars=yes,resizable=yes";
  var newWindow = window.open(URL, "query", args);
  newWindow.focus();
}

Thanks for your help

--- End Message ---
--- Begin Message ---
> another button to the form that utilises my JavaScript popup function and
> takes the values from the same form?

This is not a php question.  

All you need to do is loop through the form fields on you page and add
them to the end of your url.

--- End Message ---
--- Begin Message ---
"Matt M." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> > another button to the form that utilises my JavaScript popup function
and
> > takes the values from the same form?
>
> This is not a php question.
>
> All you need to do is loop through the form fields on you page and add
> them to the end of your url.

Hi,

Thanks for your reply, the problem here is that if I loop through the values
and them to the URL when the other button is pressed to submit the form the
form action will still kink to itself rather than opening a new popup
window...

--- End Message ---
--- Begin Message ---
> Thanks for your reply, the problem here is that if I loop through the values
> and them to the URL when the other button is pressed to submit the form the
> form action will still kink to itself rather than opening a new popup
> window...

<input type="submit" name="submit" value="Submit" onclick="return false;" />

that should stop form submission if they click your butto, also not
much point of having that button on the page though.

Anyway, this really does not have anything to do with php.  Search for
javascript help.

--- End Message ---
--- Begin Message --- Shaun wrote --- napísal::
"Matt M." <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]

another button to the form that utilises my JavaScript popup function

and

takes the values from the same form?

This is not a php question.

All you need to do is loop through the form fields on you page and add
them to the end of your url.


Hi,

Thanks for your reply, the problem here is that if I loop through the values
and them to the URL when the other button is pressed to submit the form the
form action will still kink to itself rather than opening a new popup
window...


How is the button defined? It should be type="button", not type="submit". And check for javascript errors, still the new window should be opened.

--- End Message ---
--- Begin Message ---
On Friday 25 June 2004 13:20, Jim Rainville wrote:

> system("write_port 0xffffffff");
>
> When I call this from the script the port does not get written to.

1) Enable FULL error reporting
2) Use /full/path/to/write_port

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
A bachelor is a selfish, undeserving guy who has cheated some woman out
of a divorce.
                -- Don Quinn
*/

--- End Message ---
--- Begin Message ---
I have a small image resize function which works great on my local server as
I have the gd2 library.  It uses the imagecreatetruecolor function which
makes the thumbnails look good, without it, they look bad.  The problem is,
my webhost is not going to upgrade to gd2 so....is there anyway I can pull
out the necessary functions or do they require a certain php version?

Thanks,
Eddie

 WARNING:  The information contained in this message and any attachments is
intended only for the use of the individual or entity to which it is
addressed.  This message may contain information that is privileged,
confidential and exempt from disclosure under applicable law.  It may also
contain trade secrets and other proprietary information for which you and
your employer may be held liable for disclosing.  You are hereby notified
that any unauthorized dissemination, distribution or copying of this
communication is strictly prohibited.  If you have received this
communication in error,  please notify [EMAIL PROTECTED] by E-Mail and then
destroy this communication in a manner appropriate for privileged
information.

--- End Message ---
--- Begin Message ---
What I'm basically trying to do is make the database display out the
information from it's tables as soon as it possibly can without the need for
refreshing. For example:

Someone enters in some text, and it's put into the database. As soon as
possible, the text is shown in a page that wasn't refreshed and has been
shown at all times, on several computers. They don't all have to be
synchronized, just that it shows as soon as it possibly can without
refreshing.

This may be an HTTP push method, the name sounds similar to what I'm trying
to do. What exactly is it and how do you utilize it?

Thanks for all the help!
 
Thanks,
Stephen Craton
http://www.melchior.us

-----Original Message-----
From: Curt Zirzow [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 25, 2004 12:53 AM
To: PHP List
Subject: Re: [PHP] Streaming

* Thus wrote Stephen Craton:
> So my question is, does anyone know how the phpOpenChat system works? 
> Can anyone provide some insight into the world of "streaming" and 
> avoiding the refresh game?

"streaming"
<?php
echo "data streamed to browser";
?>

It is very unclear how you mean streaming, if you're talking about a HTTP
push method, then thats a whole nother ballpark.



Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about.  No, sir.  Our model is the trapezoid!

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

--- End Message ---
--- Begin Message --- Greetings all, just installed Fedora with the bundled PHP Version 4.3.4. Upon calliing mysql_* functions I get errors like:
Fatal error: Call to undefined function: mysql_pconnect() blah blah blah


A call to phpinfo() reveals it was configured with:
--with-mysql=shared,/usr'

And doing a "locate mysql.so" from the command line reveals mysql.so is not anywhere to be found.

I looked at the mysql docs at php.net so see how to properly install mysql.so and couldn't find anything. Am I dense? Do I need more coffee?

So I added the line: extension=mysql.so to one of the config files, copied mysql.so over from the production server and restarted apache as a hack to try to see if it worked. It didn't.

Please let me know how you'd go about troubleshooting or solving this

Thanks!!
--Jough

--- End Message ---
--- Begin Message ---
Install php-mysql package

Jough P wrote --- napísal::
Greetings all, just installed Fedora with the bundled PHP Version 4.3.4. Upon calliing mysql_* functions I get errors like:
Fatal error: Call to undefined function: mysql_pconnect() blah blah blah


A call to phpinfo() reveals it was configured with:
--with-mysql=shared,/usr'

And doing a "locate mysql.so" from the command line reveals mysql.so is not anywhere to be found.

I looked at the mysql docs at php.net so see how to properly install mysql.so and couldn't find anything. Am I dense? Do I need more coffee?

So I added the line: extension=mysql.so to one of the config files, copied mysql.so over from the production server and restarted apache as a hack to try to see if it worked. It didn't.

Please let me know how you'd go about troubleshooting or solving this

Thanks!!
--Jough


--- End Message ---
--- Begin Message ---
I'm trying to do socket_bind() and it works fine from the command line as
root, but when I try to use it through apache I get this error

Warning: socket_bind() unable to bind address [13]: Permission denied in
......

Is there a way to have this run through apache?

-Josh

--- End Message ---
--- Begin Message ---
I think all sockets less then 1024 need superuser permission to bind.  And because 
Apache typically runs as nobody you don't have permission, so either run apache as 
root (DANGER!) or choose a socket above 1024.

-Brad

----- Original Message -----
From: Josh Close <[EMAIL PROTECTED]>
Date: Friday, June 25, 2004 10:18 am
Subject: [PHP] socket_bind

> I'm trying to do socket_bind() and it works fine from the command 
> line as
> root, but when I try to use it through apache I get this error
> 
> Warning: socket_bind() unable to bind address [13]: Permission 
> denied in
> ......
> 
> Is there a way to have this run through apache?
> 
> -Josh
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
Thanks, changing the port worked.

-Josh

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 25, 2004 9:22 AM
> To: [EMAIL PROTECTED]
> Cc: PHP (E-mail)
> Subject: Re: [PHP] socket_bind
> 
> 
> I think all sockets less then 1024 need superuser permission 
> to bind.  And because Apache typically runs as nobody you 
> don't have permission, so either run apache as root (DANGER!) 
> or choose a socket above 1024.
> 
> -Brad
> 
> ----- Original Message -----
> From: Josh Close <[EMAIL PROTECTED]>
> Date: Friday, June 25, 2004 10:18 am
> Subject: [PHP] socket_bind
> 
> > I'm trying to do socket_bind() and it works fine from the command 
> > line as
> > root, but when I try to use it through apache I get this error
> > 
> > Warning: socket_bind() unable to bind address [13]: Permission 
> > denied in
> > ......
> > 
> > Is there a way to have this run through apache?
> > 
> > -Josh
> > 
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 
> 
> 

--- End Message ---
--- Begin Message ---
Hi,
is there a way configure mod_php4 (for apache) so as to be *absolutely* sure 
that it will always load all definitions in php.ini when  apache starts up?
Maybe with some directive in http.conf ?

Almost every time I reboot my pc apache and php start, but php is not
running with /etc/php.ini, so I have to execute

/etc/init.d/httpd restart

Thanks,

Nico Sabbi - Officine Digitali - Bologna
Tel. 051 - 4187565

--- End Message ---
--- Begin Message --- Nico Sabbi wrote --- napísal::
Hi,
is there a way configure mod_php4 (for apache) so as to be *absolutely* sure that it will always load all definitions in php.ini when apache starts up?
Maybe with some directive in http.conf ?


Almost every time I reboot my pc apache and php start, but php is not
running with /etc/php.ini, so I have to execute

/etc/init.d/httpd restart

Thanks,

Nico Sabbi - Officine Digitali - Bologna
Tel. 051 - 4187565


This is most likely a configuration issue. Next time you restart, run phpinfo() script and find out what php.ini is used, or where is it being looked for. It's mentioned right in the top box.

--- End Message ---
--- Begin Message ---
I'm a system administrator who's dabbled a bit in PHP, but am not very experienced in 
it. My PHP developer came to me with a behavior which neither of us can understand.

If you go to this URL, you'll get a broken version of the main home page on our site: 
http://www.hcpartnership.org/index.php/search . We can't understand this, because 
'index.php' is a file, not a directory. (The correct web page is just at 
http://www.hcpartnership.org/index.php.) 

Here's another example:
http://www.hcpartnership.org/path_test.php/search : does not generate a 404 error
http://www.hcpartnership.org/path_test.html/search : generates a 404 error
This is despite the fact that both of these two files are empty:
www:/var/www/hcpartnership/htdocs# ls -l path*
-rw-r--r--    1 rmcpeak  wwwadmin        0 Jun 25 10:09 path_test.html
-rw-r--r--    1 rmcpeak  wwwadmin        0 Jun 25 10:10 path_test.php
www:/var/www/hcpartnership/htdocs# 

Can anyone explain to me why this is happening? Is this a danger? Can this be turned 
off? Is this controlled in the .php code, in the php.ini file or in the Apache 
configuration, or elsewhere?

We didn't even know how to describe this problem well, so our searches of the archives 
of this mailing list and Google weren't successful. Let me know  if we overlooked 
something.

Thanks so much for your suggestions and thoughts.

-Kevin Zembower

-----
E. Kevin Zembower
Unix Administrator
Johns Hopkins University/Center for Communications Programs
111 Market Place, Suite 310
Baltimore, MD  21202
410-659-6139

--- End Message ---
--- Begin Message ---
KEVIN ZEMBOWER wrote:
> If you go to this URL, you'll get a broken version of the main home
> page on our site: http://www.hcpartnership.org/index.php/search . We
> can't understand this, because 'index.php' is a file, not a
> directory. (The correct web page is just at
> http://www.hcpartnership.org/index.php.)

Hopefully someone with more experience than me will answer this, but I did some
research and thought I'd post my findings.

First of all, I tested this on one of my servers and the same thing happened.  I
requested an existing PHP file and appended another directory name after it, and got
the page I requested.  It was "broken" the same way your example is, because the
page used relative URI's for the src attribute of all the img tags, and the browser
believed it was in a different directory than it really was, and requested images
that did not exist.

The output of php_info() showed this additional information to be in the
$_SERVER['PATH_INFO'] variable.  After doing some research I discovered that
PATH_INFO is part of the CGI spec.  Web servers will make this additional
information available to the CGI script as an environment variable.  Further reading
indicated to me that Apache passes all of this information to a script handler and
the script handler decides what to do with it.  Apache 2.x provides a configuration
directive to force it to return a 404 when given a path like the above, but 1.x does
not.  I believe that you can disable this behavior in PHP by configuring it with
"--disable-path-info-check".  I'd be interested to know if this does correct this.
I personally see it as a problem for people who aren't intending to use it and use
relative URI's for images.  Not that it would come up very often, but still...

More info:
http://www.php.net/manual/en/configure.php
http://httpd.apache.org/docs-2.0/en/mod/core.html#acceptpathinfo

HTH

--- End Message ---
--- Begin Message ---
Michael, thank you for finding out this information. I think you're right on the money.

Unfortunately, when I tried to implement the --disable-path-info-check on my PHP 
system, it didn't work. Reading the fine print at 
http://www.php.net/manual/en/configure.php showed:
--disable-path-info-check
If this is disabled, paths such as /info.php/test?a=b will fail to work. Available 
since PHP 4.3.0. For more information see the Apache Manual. 

Alas:
www:/etc/php4/cgi# php4 -v
4.1.2
www:/etc/php4/cgi# 

which is the version with Debian 3.0 (woody).

Thanks, again, for researching this and finding the answers that I couldn't.

-Kevin

>>> Michael Sims <[EMAIL PROTECTED]> 06/25/04 12:25PM >>>
KEVIN ZEMBOWER wrote:
> If you go to this URL, you'll get a broken version of the main home
> page on our site: http://www.hcpartnership.org/index.php/search . We
> can't understand this, because 'index.php' is a file, not a
> directory. (The correct web page is just at
> http://www.hcpartnership.org/index.php.)

Hopefully someone with more experience than me will answer this, but I did some
research and thought I'd post my findings.

First of all, I tested this on one of my servers and the same thing happened.  I
requested an existing PHP file and appended another directory name after it, and got
the page I requested.  It was "broken" the same way your example is, because the
page used relative URI's for the src attribute of all the img tags, and the browser
believed it was in a different directory than it really was, and requested images
that did not exist.

The output of php_info() showed this additional information to be in the
$_SERVER['PATH_INFO'] variable.  After doing some research I discovered that
PATH_INFO is part of the CGI spec.  Web servers will make this additional
information available to the CGI script as an environment variable.  Further reading
indicated to me that Apache passes all of this information to a script handler and
the script handler decides what to do with it.  Apache 2.x provides a configuration
directive to force it to return a 404 when given a path like the above, but 1.x does
not.  I believe that you can disable this behavior in PHP by configuring it with
"--disable-path-info-check".  I'd be interested to know if this does correct this.
I personally see it as a problem for people who aren't intending to use it and use
relative URI's for images.  Not that it would come up very often, but still...

More info:
http://www.php.net/manual/en/configure.php 
http://httpd.apache.org/docs-2.0/en/mod/core.html#acceptpathinfo 

HTH

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

--- End Message ---
--- Begin Message ---
Hi,

I've been pulling my hair out over this problem for a while...

----------------
<?php
$msg = "Hi, this is a test";
$to = "[EMAIL PROTECTED]";
$sbj = "test message from my.edu";

$rev = mail($to,$sbj,$msg);

echo "mail from my.edu result is $rev";
?>
--------------

Since the result of the mail() returned is 1, the message should have been
delivered fine.  but I did not get anything.  Where can I look for more
clues of what the problem might be, like possible log, or turn on some
debug level in php?  I've also tried mail($to,$sbj,$msg, "-f [EMAIL PROTECTED]"),
no workie either.

Any help would be greatly appreciated!

Bing

--- End Message ---
--- Begin Message ---
On Fri, 25 Jun 2004 11:08:26 -0500 (CDT), Bing Du <[EMAIL PROTECTED]> wrote:
> Since the result of the mail() returned is 1, the message should have been
> delivered fine.  but I did not get anything.  Where can I look for more
> clues of what the problem might be, like possible log, or turn on some
> debug level in php?  I've also tried mail($to,$sbj,$msg, "-f [EMAIL PROTECTED]"),
> no workie either.

Can you send email to that address from that server?

On unixy systems the mail log is usually in (shocker) /var/log/maillog.

For a Windows system make sure you have the mail settings in php.ini
setup correctly (see http://php.net/mail for full info).

-- 
Stuttle

--- End Message ---
--- Begin Message ---
Hi Everyone,

        Last week I posted about having a problem displaying TIFFs thru PHP.
This week I'm back to issues, tho slightly different.  I'll start over with
my case.

I have a docroot:

/usr/local/apache/htdocs-chm/

I have an images dir:

/usr/local/apache/chm-images/

These are sensitive documents that I cannot have out where the public can
get to them.

I was using ImageMagick, however it took a multipage tiff and turned it
into:

1.TIFF

1.JPG.0
1.JPG.1
1.JPG.2
1.JPG.3

Sometimes they are 1.JPG, sometimes only 2 pages, sometimes 10 pages.  We've
decided to go with a TIFF viewer plug-in, and just use those.  I am using
the follow PHP script to handle this:

<?
        session_cache_limiter('private');

        include( $_SERVER['DOCUMENT_ROOT'] . "/master.include.php" );

        $blah = "/usr/local/apache/chm-images/" . $_GET['id'] . ".TIFF";

        header("Content-type: image/tiff");
        header("Content-Transfer-Encoding: binary");

        $_GET['id'] = str_replace( ".", "", $_GET['id'] );
        $_GET['id'] = str_replace( "/", "", $_GET['id'] );

        readfile( $blah );
?>

If the TIFF is a single pager, it works fine.  If it's a multipager, I get
an invalid file format error.  I'm really at a loss as what to do.  I'm
willing to explore other solutions to display the TIFF images also.

Can anyone please help?

-Dan Joseph

--- End Message ---
--- Begin Message --- What I'm trying to do is find a substring in a much longer string and insert another string before and after the substring. For example:

string to find: weather

string to search in: "This is the worst weather ever. Weather around here is terrible."

string to add before: <strong>
string to add after: </strong>

I can't do a simple search and replace, because I need to maintain the case sensitivity of the word that's in the searched string. So I was hoping to find something that would locate the string to find, add something before and after it (which that something before and after could be different from each other), then continue the search to see if another instance exists. And so on and so forth....

There's a number of functions in PHP that will give me the position of the *first* instance of the matched string, but it doesn't look like the function would keep searching after the first match. Anyway, am I overlooking a function that already has the functionality that I'm searching for? Or does anyone have any ideas how I can accomplish this efficiently since my search strings can be quite long?

Thanks!
--- End Message ---

Reply via email to