Re: [PHP] Can't find the server path when, in http.conf, using Alias and DirectoryIndex

2009-08-27 Thread Paul Gardiner

Torben Wilson wrote:

2009/8/26 Paul Gardiner li...@glidos.net:

Paul Gardiner wrote:

I want to write a simple indexing script to display a
directory full of photos as a gallery of thumbnails.
(There are various solutions out there for this, but
they're all a bit more complicated than I need).

I've added a file in /etc/apache2/conf.d that
looks like this:

Alias /photos /home/public/photos
Directory /home/public/photos
   AllowOverride None
   Order allow,deny
   Allow from all

   DirectoryIndex /cgi-bin/index.php
/Directory


I use Alias so that I can leave the photos where they are
and not have to move them to DocumentRoot. I use DirectoryIndex
so that the script doesn't have to be in with the photos. My
problem is that the running script seems to have no way to
work out the photos are in /home/public/photos.

$_SERVER[REQUEST_URI] is /photos/, but I can't see how to
derive the server path from that, since $_SERVER[DOCUMENT_ROOT]
is /srv/www/htdocs.

$_SERVER[PHP_SELF] is /cgi-bin/index.php, so no use either.


How can I do this? Is there a way to interrogate the alias,
or can I set a variable in the conf file that PHP can pick up?

I've sussed it. If I use this apache2 conf file, where I
tag the server path onto the end of the index url:

Alias /photos /home/public/photos
Directory /home/public/photos
   AllowOverride None
   Order allow,deny
   Allow from all

   DirectoryIndex /cgi-bin/index.php/home/public/photos
/Directory

then the script can pick up the path as $_SERVER[PATH_INFO]

P.


Hi Paul,

Glad you got it working.


Actually, since posting, I've given up on that method,
partly because I realised that in doing so I was opening up
a security hole and being close to allowing enumeration of
any apache-readable directory on my server, via direct use
of the url http:/host/cgi-bin/index.php/path/.  I've
found a much better way (using SetEnv):

Alias /photos /home/public/photos
Directory /home/public/photos
   AllowOverride None
   Order allow,deny
   Allow from all

   SetEnv GalleryPath /home/public/photos
   DirectoryIndex /cgi-bin/index.php
/Directory

And then the script can pick up the path as $_SERVER['GalleryPath']


I would add one note: I don't know if this is
what your actual code contains or if it's just in your emails, but not
quoting string indices in arrays is a Bad Idea (TM). i.e. I'd
recommend avoiding the use of something like $_SERVER[PATH_INFO] and
instead use $_SERVER['PATH_INFO']. While the unquoted version will
work much of the time, it's untrustworthy. In this case, PHP sees the
label PATH_INFO and looks for a constant named PATH_INFO.


Thanks for the advice. I've always been a little uncertain of that. I
don't generally leave the quotes out, but I had been tending to, just
for accessing $_SERVER (not sure why - some example code I must have
read I think). Anyway, I'll put the quotes in.

What about the case of including an array within a string, e.g.,

  $line = trtd$array['name']td$array['address'];

I've read something about that not working with the quotes in place.
Is that best avoided too?

Cheers,
Paul.


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



Re: [PHP] Can't find the server path when, in http.conf, using Alias and DirectoryIndex

2009-08-26 Thread Paul Gardiner

Paul Gardiner wrote:

I want to write a simple indexing script to display a
directory full of photos as a gallery of thumbnails.
(There are various solutions out there for this, but
they're all a bit more complicated than I need).

I've added a file in /etc/apache2/conf.d that
looks like this:

Alias /photos /home/public/photos
Directory /home/public/photos
AllowOverride None
Order allow,deny
Allow from all

DirectoryIndex /cgi-bin/index.php
/Directory


I use Alias so that I can leave the photos where they are
and not have to move them to DocumentRoot. I use DirectoryIndex
so that the script doesn't have to be in with the photos. My
problem is that the running script seems to have no way to
work out the photos are in /home/public/photos.

$_SERVER[REQUEST_URI] is /photos/, but I can't see how to
derive the server path from that, since $_SERVER[DOCUMENT_ROOT]
is /srv/www/htdocs.

$_SERVER[PHP_SELF] is /cgi-bin/index.php, so no use either.


How can I do this? Is there a way to interrogate the alias,
or can I set a variable in the conf file that PHP can pick up?


I've sussed it. If I use this apache2 conf file, where I
tag the server path onto the end of the index url:

Alias /photos /home/public/photos
Directory /home/public/photos
AllowOverride None
Order allow,deny
Allow from all

DirectoryIndex /cgi-bin/index.php/home/public/photos
/Directory

then the script can pick up the path as $_SERVER[PATH_INFO]

P.


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



[PHP] Can't find the server path when, in http.conf, using Alias and DirectoryIndex

2009-08-23 Thread Paul Gardiner

I want to write a simple indexing script to display a
directory full of photos as a gallery of thumbnails.
(There are various solutions out there for this, but
they're all a bit more complicated than I need).

I've added a file in /etc/apache2/conf.d that
looks like this:

Alias /photos /home/public/photos
Directory /home/public/photos
AllowOverride None
Order allow,deny
Allow from all

DirectoryIndex /cgi-bin/index.php
/Directory


I use Alias so that I can leave the photos where they are
and not have to move them to DocumentRoot. I use DirectoryIndex
so that the script doesn't have to be in with the photos. My
problem is that the running script seems to have no way to
work out the photos are in /home/public/photos.

$_SERVER[REQUEST_URI] is /photos/, but I can't see how to
derive the server path from that, since $_SERVER[DOCUMENT_ROOT]
is /srv/www/htdocs.

$_SERVER[PHP_SELF] is /cgi-bin/index.php, so no use either.


How can I do this? Is there a way to interrogate the alias,
or can I set a variable in the conf file that PHP can pick up?

Cheers,
Paul.


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



[PHP] PHP4, APACHE, SCO INFORMIX

2001-04-30 Thread Paul Gardiner

Hi Everyone,

Firstly, apologies for cross posting but I wanted to make sure this got to
the relevant people.

I am continually getting people asking me off list for information regarding
building the above combination. I don't mind as it's encouraging to see PHP
spreading to this type of platform. All I ask is that if anyone requires
help then please direct it to the PHP-Install list so others may benefit
from the replies given. I will try to compile a complete install guide when
I get time and perhaps one of the PHP associated sites would be able to host
it. It maybe an idea for others to contribute with their particular build so
that a centrally managed install guide could be set up and perhaps free up
some of the traffic on the lists?

Best regards,
- Paul -


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PDFlib 4.0.0.... any experiences..

2001-04-20 Thread Paul Gardiner

Hi Stewart,

Try again my friend. I've just been there and version 4 is definately
available. I won't ask why your vision is blury - you know what they say,
hairy palms and all that! ;o)

Thanks Dean for the info, I'll give it a whirl when I've got some free time.

Best regards,
- Paul -

- Original Message -
From: "Taylor, Stewart" [EMAIL PROTECTED]
To: "'Grimes, Dean'" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Friday, April 20, 2001 1:39 PM
Subject: RE: [PHP] PDFlib 4.0.0 any experiences..


 Dean,

 I too want to instal pdflib4, however I can't see a reference to pdflib4
on
 the web page you've given (unless my visions not working correctly of
 course).  All the links are for pdflib3.3

 Are they on this actual page or are they hidden somewhere.


 -Stewart

 -Original Message-
 From: Grimes, Dean [mailto:[EMAIL PROTECTED]]
 Sent: 20 April 2001 13:23
 To: 'David Bouw'; [EMAIL PROTECTED]
 Subject: RE: [PHP] PDFlib 4.0.0 any experiences..


 I just sent a post yesterday on how to get this to work. I does work well.
 Here is the post I sent yesterday:


 Try using the new pdflib-4.0.0  It works great.
 Here is what you have to do:

 Goto: http://www.pdflib.com/pdflib/download/index.html

 and download the source for unix.

 Unzip and untar.

 cd to pdflib-4.0.0/bind/php/ext/pdf

 copy * php-4.0.4pl1/ext/pdf --- You may want to remove the current
contents
 of this directory first...

 cd pdflib-4.0.0
 configure --enable-php
 make - you will get an error indicating that a makefile was not found ...
 just ignore it.
 make install

 Link the newly created libraries to the /usr/lib directory:
 ln -s /usr/local/lib/libpdf* /usr/lib

 Next just rebuild PHP as normal only add --with-pdflib.

 Have fun...


 Dean



 -Original Message-
 From: David Bouw [mailto:[EMAIL PROTECTED]]
 Sent: Thursday, April 19, 2001 6:08 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PDFlib 4.0.0 any experiences..


 Hi there,

 Months ago I had a bad time getting PDFlib 3.0.0 to compile with PHP..
After
 I succeeded I was so glad I promised myself to never touch it again.. :-)

 Well, I now have a barcode font which I need to embed into a PDF
document..
 I did this a long time ago, but have forgotten what the exact settings
were
 that I used to accomplish this...

 With some searching I suddenly saw that PDFlib 4.0.0 was available.. !!
When
 I looked at the documentation I got a tinteling feeling in my stomach..
 Finally the package comes with all the Tif/Png etc libraries which you
first
 had to download seperately and try to compile with PDFlib.. Further this
 package has also been adapted to PHP (they even talk about it in the
 manual!!!) and it seems that you can also load the pdf as some kind of
 library when starting the script via the 'dl' function.. ( which I don't
yet
 have any experience with..)

 My question: Who has got some experience with this..? I grabbed a tarball
of
 php-4.0.4pl1 and pdflib4.0.0..
 Compiled both and tried to load the library via de dl option.. PHP can't
 seem to find this..

 I am now busy to try and do it the old way and compile PHP with the PDFlib
 option enabled..
 (did copy the /ext/pdf directory from pdflib to my php!)
 But if possible I would rather use the option in which the library is
loaded
 into PHP as an library.. Speed isues aren't important, I want an easy and
 flexible way the change PDFlib versions without needing to recompile
 anything..
 I also read that this was possible with the GD library..

 I will be glad if I can hear anyone with some experiences with this new
 PDFlib.. I look forward getting this to work!

 Thanks in advance..
 With kind regards
 David Bouw


 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO

2001-04-17 Thread Paul Gardiner

Hello again Dean, Chris,

Snap I'm afraid. I didn't spend too much time on it but it's on the list of
things to do. If I manage to get any further I'll let you know.

If this is urgent though Chris, let me know your exact configure/build
procedure and which versions you're using of the tiff, jpeg etc and also how
you built these. As there's not as many of us on SCO it maybe better if we
put our heads together to get it sorted - you know what they say :o)

Best regards,
- Paul -

- Original Message -
From: "Grimes, Dean" [EMAIL PROTECTED]
To: "'Chris Fry'" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, April 17, 2001 1:36 PM
Subject: RE: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO


 I had the exact same problem Haven't had time to work it though.

 -Original Message-
 From: Chris Fry [mailto:[EMAIL PROTECTED]]
 Sent: Monday, April 16, 2001 3:26 AM
 To: [EMAIL PROTECTED]
 Subject: [PHP] PHP4.0.4pl1+PdfLib3.03+SCO


 Pdflib 3.03 compiles OK and builds a static library -
 /usr/local/lib/libpdf.a.

 PHP fails to configure - cannot find PDF_show_boxed in the library -
 pdflib extension requires pdflib 3.x.

 This command is in the library and the header file. Configure finds my
 tiff  jpeg library (--with-tiff-dir=/usr/local
 --with-jpeg-dir=/usr/local) but is either not finding the library
 (--with-pdflib=/usr/local) or is not able to find PDF_show_boxed in the
 library.

 Can anyone help??

 Chris

 --
 Chris Fry
 Quillsoft Pty Ltd
 Specialists in Secure Internet Services and E-Commerce Solutions
 10 Gray Street
 Kogarah
 NSW  2217
 Australia

 Phone: +61 2 9553 1691
 Fax: +61 2 9553 1692
 Mobile: 0419 414 323
 eMail: [EMAIL PROTECTED]
 http://www.quillsoft.com.au

 You can download our Public CA Certificate from:-
 https://ca.secureanywhere.com/htdocs/cacert.crt

 **

 This information contains confidential information intended only for
 the use of the authorised recipient.  If you are not an authorised
 recipient of this e-mail, please contact Quillsoft Pty Ltd by return
 e-mail.
 In this case, you should not read, print, re-transmit, store or act
 in reliance on this e-mail or any attachments, and should destroy all
 copies of them.
 This e-mail and any attachments may also contain copyright material
 belonging to Quillsoft Pty Ltd.
 The views expressed in this e-mail or attachments are the views of
 the author and not the views of Quillsoft Pty Ltd.
 You should only deal with the material contained in this e-mail if
 you are authorised to do so.

 This notice should not be removed.



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]