Re: mod_perl and current directory (was Re: Newbie Q on Apache::Include)
Actually I haven't got this to work. I'm yet trying to figure how to load the module (PerlModule Apache::SSI) in the .htaccess with it actuall residing in the /perl/ directory rather than the standard lib directories. Why? It's a module, not a CGI script. I'm not sure whether the company that's hosting my web site will want to install any non-critical module (They ahve done me a favor allowing me to run mod_perl ... ) So I want to see if I have any options installing it under my directory tree. If you don't want to put it in your standard @INC paths, you can put it under APACHE_HOME/lib/perl/ which is automatically added to @INC by mod_perl. - Perrin
Re: mod_perl and current directory (was Re: Newbie Q on Apache::Include)
At 10:50 AM 1/29/2003, Perrin Harkins wrote: [EMAIL PROTECTED] wrote: I'm not sure whether the company that's hosting my web site will want to install any non-critical module (They ahve done me a favor allowing me to run mod_perl ... ) So I want to see if I have any options installing it under my directory tree. Okay. You need to modify @INC then. Take a look here for examples: http://perl.apache.org/docs/1.0/guide/config.html#The_Startup_File Tks. Dr
Newbie Q on Apache::Include
Hi, Can someone direct me to a good tutorial for Apache::Include? Rgds
mod_perl and current directory (was Re: Newbie Q on Apache::Include)
You can do this. Technically I think you can POST to a file, but you don't need to. You can do this lots of ways, including post-processing the output of a CGI script with a module like CGI::SSI. What I Tks that way worked except for the #config sizefmt of mod_include would suggest is writing a script that you will run under Apache::Registry, and calling Apache::Include-virtual('/uri/of/file') to do the includes. From the documentation of the Apache::Include I couldn't make out whether it handled other features like set which I am using. But your siggestion led me to search on CPAN and found Apache::SSI. That was reasonably well-documented and I was planning on using it except the module couldn't be found. Is it true what was said in one of the other threads -with mod_perl (Apache 1.3.27) the current working directory is different from the dir where the script lies? If so how does one use code organized uder one's own directory? (Need to know this as my host does not want to install modules for me.) Rgds Dr
Re: mod_perl and current directory (was Re: Newbie Q on Apache::Include)
At 06:54 PM 1/28/2003, Perrin Harkins wrote: [EMAIL PROTECTED] wrote: Tks that way worked except for the #config sizefmt of mod_include That should work fine. What's broken with it? (Frankly I'm so eagar to not just get my feet wet in mod_perl (just started on it today), but drown in it I didn't follow up on this prob.) !--#config sizefmt=Mb -- works with mod_include Got a [an error occurred while processing this directive] (well actually the errmsg that I had set) with CGI::SSI. As I said I didn't really follow-up to see if this is a prob. From the documentation of the Apache::Include I couldn't make out whether it handled other features like set which I am using. It does not implement SSI, it just integrates an extra tag (#perl) into mod_include. Everything that works in your current mod_include pages should continue to work. Oh kinda like embedding perl code in an shtml? But your siggestion led me to search on CPAN and found Apache::SSI. Apache::SSI is good too. It will use more RAM, but it is slightly faster than mod_include. Actually I haven't got this to work. I'm yet trying to figure how to load the module (PerlModule Apache::SSI) in the .htaccess with it actuall residing in the /perl/ directory rather than the standard lib directories. Tks Dr
[QUESTION]PerlHandler and PerlLogHandler Phase
Hi! I am been working on modperl for some time this is the first time I am posting a question on the mailing list. Please bear with me if I miss something or give too much information. I have been working on a project that can be described as an online library. The modperl portion of it adds a header,navigation bar and a footer and display the content file of the book which I shall try to draw below. The URI is used to determine what ModPerl nav. bar to generate. These URI are always in the format /en/book/bookname/ch01p01.html. I have used the following in my configuration file Location /en/book PerlHandler MyApache::StartBook PerlLogHandler MyApache::ActivityLogger /Location Things would have been great if the ch01p01.html was just one long html file without images,stylesheets and a number of script src=. calls. The general format of these html files are as follows. script Javascript Global Variables set, the content file to open. chapterNum=01 chapterPage=01 /script trtd script scr=js/bookconfig.js script scr=js/+chapterNum+P+chapterPage+.js script scr=js/chapnav.js script scr=js/footer.js /td/tr Here is the layout -- ModPerl Gen Header(Nav. Bar for suhjects in library) --- ModPerl| Contents of the course Gen. | which contains html,stylesheets, Nav Bar| images,audio files,java class files for selected | in a directory below the html file book | [-JS Nav bar mainly images] | [!-Footer with current page number] -- ModPerl Footer (Copyrights info.) - Here are the problems/Questions that I face: 1. Since in this case each requests for a html file has multiple files that need to be downloaded by the client. Am I right to assume that the handler will act on each and every file requested file below my /en/course URI? 2.If the answer to the above question is YES? The Handler will add headers,footers for everything. What do I need to do to apply the handler logic just to the requested page and return the remaining files that are needed to complete the requested page as they are? 3. When I move these JS files outside the /en/course URI they seem to work? But now when I put them with in? It just displays the Javascript code like simple text on the browser. 4. In the Logging Phase, I need to store the last requested page as a bookmark. So if the user logs out, and logs back in it takes him to the same page. Since the html files are made up of some many requests to other files, it stores the last file it requested. It may be path to an image file,style sheet file etc... Is there any way I can circumvent this problem? Thank You very much for you help in advance. I apologize if the email is too detailed. Mark __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com
Re: [QUESTION]PerlHandler and PerlLogHandler Phase
Thanks Thomas, Question: Here are the problems/Questions that I face: 1. Since in this case each requests for a html file has multiple files that need to be downloaded the client. Am I right to assume that the handler will act on each and every file requested file below my /en/course URI? Answer: Add something like return DECLINED unless $r-content_type() eq 'text/html'; near the top of your handler. This way only html-documents get handled by your handler, the rest falls through to the default apache handler. This one did work for most of the cases. Which is the first war among many battles? I also have cases where the book content has pop up windows to display meaning of words that do not need the entire header to be displayed .i.e. the handler should not be act on such a request. Question: Is there a way I can put them in a directory and when the uri matches that directory, i disable the handler? If so how can I do it? Mark __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com
RE: [QUESTION]PerlHandler and PerlLogHandler Phase
Thanks Rob for your reply. --- Rob Bloodgood [EMAIL PROTECTED] wrote: Question: 2.If the answer to the above question is YES? The Handler will add headers,footers for everything. What do I need to do to apply the handler logic justto the requested page and return the remaining files that are needed to complete the requested page as they are? Answer: In the Eagle book (as well as a Perl Journal article) there is an example of a Apache::Header/Apache::Footer. CPAN doesn't show them right now. But you could implement them as filters using Apache::Filter to mark up each document on its way out, based on URI. Reply: I shall look into this. There is some database entries that have to take place as the web pages are being servered. Question: 3. When I move these JS files outside the /en/course URI they seem to work? But now when I put them with in? It just displays the Javascript code like simple text on the browser. Answer: SCRIPT SRC=/en/course/one.js/SCRIPT ... or you could template them in directly, since you're playing w/ the content already. Reply: Most of the books are already existing in that format. To Change them would be a lot of code rewriting,testing and deploying. Question: 4. In the Logging Phase, I need to store the last requested page as a bookmark. So if the user logs out, and logs back in it takes him to the same page. Since the html files are made up of some many requests to other files, it stores the last file it requested. It may be path to an image file,style sheet file etc... Is there any way I can circumvent this problem? Answer: You could use a cookie, issued with each document, noting what url they are on right now?? Logging it (storing it) and then reading it back are bound to be way too much work. Reply: I kind of figured this portion out. Though its is not a clean way to do it. In the ActivityLogger.pm, I plan to use $r-the_request instead of $r-uri. The PerlLogHandler being called on every request will be overwriting the same data in the database. Let us assume that the web page request has 5 more files that it depends. Would not the PerlLogHandler be called when each file is being server. HTH! L8r, Rob __ Do You Yahoo!? Great stuff seeking new owners in Yahoo! Auctions! http://auctions.yahoo.com
Re: What hapened to AxKit.com?
At 02:42 PM 10/3/2001 -0700, you wrote: Does anyone have factual information about the AxKit website? Here's what I got after trying to join their email list: After 10 days (232 hours), your message could not be fully delivered. It failed to be received by the following address(es): [EMAIL PROTECTED] (host: sergeant.org) (queue: network) Problems usually are due to service interruptions at the receiving machine. Less often, they are caused by the communication system. Your message follows:
Re: ANNOUNCE: Apache::OpenIndex
At 03:02 PM 9/27/2001 -0700, you wrote: George Sanderson wrote: Apache::OpenIndex (OpenIndex-1.00.tar.gz) was uploaded to CPAN on 14Sep2001 and is currently released. This was my first module. I enjoyed journey. OpenIndex provides a file manager for an Apache modperl web site using a web browser. It is a extensive rewrite of the Apache::AutoIndex module (written by Philippe M. Chiasson), which in turn was a remake of the autoindex Apache module. OpenIndex also provides the same functionality as autoindex, therefore it can be used to both manage and navigate a web site. A demo is available at: http://www.xorgate.com/Apache/OpenIndex/demo ++ | George Sanderson [EMAIL PROTECTED] | http://www.xorgate.com ++ George, I get a You don't have permission to access /Apache/OpenIndex/demo/ on this server message. -r Someone created a file with a .test extension which interferes with a test environment that I have set up. Normally my web files don't end with .test so, I have not had this problem in the past. If you log in using: http://www.xorgate.com/Apache/OpenIndex/demo/.XOI username=openindex password=07sep01 You should be able to access all files after you login, regardless of the filtering.
Re: Post processing Perl output through PHP
I am having a nightmare trying to get some PHP into the output of a Perl script. PHP. I've heard rumours of Apache 2.0 allowing multiple filters, which would be perfect when it's out, but not yet obviously. Add PHP support to your server, and use subrequests to get the results of the processing. Or, run PHP on another server, and use LWP to fetch pages from that server which will be included the output fromt he main server. Running PHP elsewhere is out of the question, as both the PHP and Perl code uses data stored on the system. By 'Add PHP support', if you mean adding PHP such that I can write and serve .php documents, then this is already in place, as most of the site is in PHP!, but if you mean something other than this... please explain more ? 'and use subrequests to get the results' Sorry for sounding stupid, but what exactly do you mean... ? I am calling the PHP CGI binary from inside Perl to get output, and it works fine from a shell, but not through Apache. Do you mean using lynx to fetch a page on the server to a file and use that.. ? That is the only solution I have found to date, calling lynx -dump with a http://localhost/ address to get Apache to return the PHP file to me, with all the correct PHP expansion. I can then read this output using the perl script and include it in my perl output, back to the browser. The problem comes in that I want to specify a host of different PHP commands in my Perl output, and get Apache to process them on the way back, so using this trick, I have to create (from the perl script) a bunch of temporary files containing PHP, somewhere (now globally writable) under the DOCUMENT_ROOT tree, fetch them using lynx again needing to use a writable area (although /tmp is fine here), and then include them in my output, and then clean up the files! There must be an easier way !!! Please help me... I've spent over 20 hours reading nearly every forum on phpbuilder.net and a whole host of other sites now, and I've found two others who have exactly the same problem as me, and having emailed them, they never found an elegant solution... they ended up re-writing all their code in one or the other. But I've got over 40,000 lines of Perl, and the entire rest of the site is in PHP, so this is an unbelievable task if I have to resort to it !?!?!? Help ??? J.
RE: Post processing Perl output through PHP
I'm not entirely sure if I'm getting what you're asking here - I get the impression you want the Perl program to call the php script, such as http://localhost/script.php3 and get the results from that script which you then push into the results of your perl script, correct? The reason I'm not sure is the part where you create a bunch of files in your tmp directory and then process those. Are you saying you're getting perl to create PHP code, and getting Apache to process those, and then returning the results, or that you're getting perl to create a batch command essentially? This is the problem.. I'm not just fetching a local php page, I am actually using Perl to generate a bunch of PHP commands, which I then want Apache to process on the way back to the client. Until a stable 2.0 Apache is out and I can use SetOutputFilter, I am left with (what I think is the only choice left...) creating a temporary file, under DOCUMENT_ROOT, putting the generated PHP into it, using LWP or friends to fetch that page throuh Apache, which will then parse the PHP with mod_php, and send that output back to the client via 'print $fetched_contents;' Either way, the 'simple' way to do this is using LWP, as suggested by someone else on the list. Even if it's running on the same server, LWP will work just fine. LWP is a perl module that you can get on CPAN to do http requests for you. That is, directly in your perl program instead of using lynx, you can call to get another web page like so (untested): Ironically, having tried the suggestion from Darren, I discover that I don't have LWP installed. My sysadmin however, will install anything for me as long as I provide him with an RPM for it. I don't mean to sound lazy, and I have just checked rpmfind.net, but I can't quickly put my hands on an rpm which includes LWP::Simple for Red Hat 7.0 Assuming I sort this out, I think I will have found a way out, by creating a file with my PHP in, as described above. On another note, Apache.org mentions the 'forthcoming' stable release of 2.0. Does anybody have any idea of how long this will be... From what I read on the net, and the Apache FAQ, it will be very simple to specify that a certain directory will be filtered through another module, ie getting perl script output filtered through PHP by Apache before returning to the client. Perhaps somebody has experience with the beta release of Apache 2.0 ??? James.
Post processing Perl output through PHP
Hi all, I am having a nightmare trying to get some PHP into the output of a Perl script. PHP. I've heard rumours of Apache 2.0 allowing multiple filters, which would be perfect when it's out, but not yet obviously. I've tried calling the CGI PHP from inside Perl in a few ways: == #!/usr/bin/perl $result = `/usr/bin/php -q EOF ?php echo Hello World; ? EOF `; print Content-Type: text/html\n\n; print PHP output was $result\n;exit; == I've also tried running this command as a system() call in Perl, and sending the output of /usr/bin/php to a temporary file, then using Perl to open and read the contents of that file. Both methods work if I call the script myself at a shell prompt. In the case of the file creation, an 11 byte file is duly created. However, when I call the perl script from a web browser, I lose the PHP output. The code given above doesn't help narrow it down, but in the case of the file creating version, I notice back at a shell prompt that the call to /usr/bin/php has made a 0 byte file... which obviously explains why I see nothing once Perl copies it to the output. So, that means there is something about /usr/bin/php that is making it generate absolutely no output when called via apache and the perl script. I am guessing that this has to do with the environment variables, as I can see no other way in which /usr/bin/php would be aware of a difference in its environment. So, my question is, does anybody know how to persuade PHP to give me the output when called in this way... perhaps by forging an environment variable from Perl first, or some clever command line switch... Alternatively, and much preferred, some way of parsing the whole of the perl output through PHP before returning to the browser. Then I could just print PHP tags in my Perl output and Apache/mod_php would handle the rest on the way back... For reasons that really aren't worth going into, I need to access some messy PHP functions from Perl, and I can't rewrite the PHP functions in Perl because I have .php pages that need them, and I can't rewrite the Perl scripts in PHP either. If I can't find a way of doing this, I will probably tear all my hair out and then sit down to rewrite a separate copy of every routine in Perl, and have two copies of all the code in two different languages... nightmare come true ! Please please help me !!! James [EMAIL PROTECTED]
Apache with MOD_PERL
Hello, I will install apache_1.3.20.tar.gz and mod_perl-1.25.tar.gz on the HP-UX OS. I have installed all perl modules e.g libwww-perl-5.48.tar.gz URI MIME-Base64 HTML-Parser libnet Digest::MD5 HTML::Tagset Finally I am doing following: $gzip -d apache_x.xx.tar.gz $tar xfv apache_x.xx.tar $gzip -d mod_perl-x.xx.tar.gz $tar xfv mod_perl-x.xx.tar $cd mod_perl-x.xx $perl Makefile.PL \r APACHE_PREFIX=/usr/local/apache \r APACHE_SRC=/usr/local/apache_x.xx/src \r DO_HTTPD=1 \r USE_APACI=1 \r EVERYTHING=1 $make $make install The mod_Perl doesn' t work correct. I get only The Apache ENVIROMENT, Is that correct? AUTH_TYPE=Basic CONTENT_LENGTH=13 CONTENT_TYPE=application/x-www-form-urlencoded DOCUMENT_ROOT=/www GATEWAY_INTERFACE=CGI/1.1 HTTP_ACCEPT=application/vnd.ms-excel, application/msword, application/vnd.ms-powerpoint, image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */* HTTP_ACCEPT_ENCODING=gzip, deflate HTTP_ACCEPT_LANGUAGE=de HTTP_CONNECTION=Keep-Alive HTTP_COOKIE=SITESERVER=ID=c656f1fb69a804a4fec64e2f5effab5c HTTP_HOST=fu2207.zff.zf-group.de:3000 HTTP_REFERER=http://fu2207/test.html HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) PATH=/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/nettladm/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/upgrade/bin:/opt/hpxt/enware/bin:/sbin:/usr/sbin:/opt/langtools/bin:/opt/imake/bin:/opt/aCC/bin:/opt/CC/bin:/opt/networker/bin:/opt/hparray/bin:/usr/system/bin QUERY_STRING= REMOTE_ADDR=197.239.33.4 REMOTE_HOST=fn0676 REMOTE_PORT=1879 REMOTE_USER=f26748 REQUEST_METHOD=POST REQUEST_URI=/usr-mgr/test.pl SCRIPT_FILENAME=/www/usr_manager/cgi/test.pl SCRIPT_NAME=/usr-mgr/test.pl SERVER_ADDR=197.239.33.6 SERVER_ADMIN=[EMAIL PROTECTED] SERVER_NAME=fu2207.ttt.de SERVER_PORT=80 SERVER_PROTOCOL=HTTP/1.1 SERVER_SIGNATURE= Apache/1.3.20 Server at fu2207.ttt.de Port 3000 SERVER_SOFTWARE=Apache/1.3.20 (Unix) mod_perl/1.25 TZ=MET-1METDST Thanks a lot for you help Best Regards Hasan -- Machen Sie Ihr Hobby zu Geld bei unserem Partner 11! http://profiseller.de/info/index.php3?ac=OM.PS.PS003K00596T0409a -- GMX - Die Kommunikationsplattform im Internet. http://www.gmx.net
Child keeps seg faulting
I have the following config: Solaris 2.7, perl 5.6, php4 and mod_perl 1.25 compiled statically into Apache 1.3.19. This exact same config works flawlessly on several Suse machines and a few Red Hat machines. After building and testing the server, I get the following error when trying to execute the printenv cgi script that comes with Apache: [Wed Apr 25 14:58:04 2001] [notice] Apache/1.3.19 (Unix) PHP/4.0.4pl1 mod_perl/1.25 \ configured -- resuming normal operations [Wed Apr 25 14:58:07 2001] [notice] child pid 11107 exit signal Segmentation Fault (11) [Wed Apr 25 14:59:06 2001] [notice] child pid 11108 exit signal Segmentation Fault (11) Anyone have any ideas? Thanks, CC
Problem building on Solaris 2.7
I am trying to build mod_perl 1.25 as a DSO on Solaris 2.7 and when I execute perl Makefile.PL, it says I will probably get core dumps and to upgrade to perl 5.6. I am running Perl 5.005_03, the latest considered stable on Solaris 2.7. I cannot upgrade to 5.6 due to heavy perl code already on this machine. Can anyone point me in the right direction? Thanks, CC
PUT handling (somewhat off-topic)
I apologize in advance, because this isn't directly related to mod_perl. But I really wasn't sure where to ask. Posting to comp.infosystems.www.servers.unix didn't produce any result. There doesn't seem to be a mailing list for discussion of Apache generally. I am trying to get apache to invoke a CGI program in response to PUT requests. This is a FAQ. The FAQ instructions are very clear and straightforward and don't work for me. I have the following in the VirtualHost section in my httpd.conf: Script PUT /cgi-bin/Put /cgi-bin is ScriptAliased correctly. /cgi-bin/Put has permissions set propserly and runs correctly from the shell and also when I send Apache a GET request for it. When I send Apache a PUT request using 'telnet', the request is received. However, my PUT script does not run. Instead, Apache fabricates a 200 response that looks like this: HTTP/1.1 200 OK Date: Tue, 05 Sep 2000 08:57:12 GMT Server: Apache/1.3.6 (Unix) mod_perl/1.19 Connection: close Content-Type: text/html the body of the response is empty. I know that /cgi-bin/Put isn't being run because it would have produced a 206 response, not a 200 response, because it would have produced a nonempty body, and because it would have written a log to /tmp/Put.err, which it didn't do. The access log entry looks like this: 209.152.205.5 - - [05/Sep/2000:04:57:12 -0400] "PUT /~mjd/p/index.html HTTP/1.0" 200 0 "-" "-" There is no entry in the error log. I get the same behavior when I put the 'Script' directive into a Directory section and send a PUT request for a file in the directory. I don't want Apache to respond to the PUT request itself. I want it to run /cgi-bin/Put and have /cgi-bin/Put generate the response. The on-line manual and the FAQ all say that the Script PUT /cgi-bin/Put directive that I have should do that, but it isn't doing it. Does anyone have any suggestions about what might be wrong, or about a more appropriate forum in which to ask?
Passing a hash to a cgi outside a form?
Hi there! Sorry for this question which might sound easy to you, but, does anyone know : How can a CGI pass and receive a hash without a form? Please have a look at the following simple scripts : This is test.cgi --- #!/usr/bin/perl use CGI; $list-{'value1'} = 'apple';$list-{'value2'} = 'fruit'; print "Location: test2.cgi?list=$list \n\n";-- This is test2.cgi -- #!/usr/bin/perl use CGI qw (:standard); print header; $list = param('list'); foreach (keys %{$list}){ print "KEY IN LIST = ",$_,br;} -- Thank you for your help !