[PHP] Patch for Suexec for Virtual Hosts to use PHP with FastCGI

2005-10-07 Thread Jason Kovacs
CGI
   
   AddHandler php-fastcgi .php
   Action php-fastcgi /fcgi-bin/php-fcgi

 
Please respond with your comments on my method, and if it's generally correct 
and others are interested in using it, I can post my changes to suexec.c.
 
Thanks,
Jason Kovacs


Re: [PHP] fckeditor and PDF and pesky users

2005-10-14 Thread Jason Kovacs

Richard Lynch said the following on Friday, October 14, 2005 3:39 PM:



So...

Do I:

A) Attempt to hack fckEditor to "allow" a PDF to get uploaded, and
then display a link to the PDF instead of alink to the fckEditor
output.

B) Give them a separate, possibly confusing, input to upload files to
tie in as links to the fckEditor area


I've had success with this, creating a seperate utility to upload documents
to the filesystem and keeping track of them in mysql.  I chose to allow
displaying the PDF's and Doc's through links in the FCKEditor content,
because I have never found a way to embed the PDF data into pages.

I added a custom drop-down menu to FCKEditor's Link window that fills
in the URL upon selecting the menu item, but this url consisted of just a
path to a redirect.php script where I set a GET variable to the ID of the
document, then passing through the PDF or DOC data.  Though you could
link the full path to the PDF in the URL, I just had my documents stored
behind the web-accessible address.  Every time a new document was
uploaded, I decided to write the URL's statically to a file that the
FCKEditor script (changed fck_link.html to fck_link.php) will read into
Javascript arrays, as opposed to accessing the DB every time this Link
window was viewed.  I added about 50 lines of Javascript code to
fck_link.php to do what I wanted in setting the URL from the Select list.

I must warn you though, every time that I upgrade FCKEditor, I have to
reapply the changes I've done and there is the possibility that the
FCKEditor scripts may change to cause compatibility problems.  Let me
know if you are interested in this route and I can post my alterations to
FCKEditor, but the PDF file management is up to you.  I've had many
non-technical users working with this utility just fine for about 6 months,
so it works and though its not the most graceful implementation from a
developer's standpoint, it makes the user interface easiest to work with.

-Jason Kovacs

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



[PHP] PHP5+FastCGI Segmentation Fault

2005-10-17 Thread Jason Kovacs
Hello,

I have Apache 2, PHP5 (cgi-fcgi), FastCGI, and Suexec on FC4 64-bit, and it 
works for the most part, 
but some 3rd-party PHP software written for PHP4 will break and in my error_log 
I've seen the message:

"FastCGI: (dynamic) server /.../php-fcgi terminated due to uncaught signal '11' 
(Segmentation fault)",

causing it to flood the error_log with messages that it could not remain 
running for 30 sec and its restart
was backed off to 600 seconds, then reports an Internal Server Error.

Is this normal or expected from some PHP scripts, or is there a 
misconfiguration in my setup? 
How do I troubleshoot this?  Any help would be appreciated, thanks.

-Jason Kovacs


Re: [PHP] fckeditor and PDF and pesky users

2005-10-17 Thread Jason Kovacs

Richard Lynch said the following on Monday, October 17, 2005 3:30 PM:

On Fri, October 14, 2005 6:03 pm, Jason Kovacs wrote:

Richard Lynch said the following on Friday, October 14, 2005 3:39 PM:



I added a custom drop-down menu to FCKEditor's Link window that fills
in the URL upon selecting the menu item, but this url consisted of
just a
path to a redirect.php script where I set a GET variable to the ID of
the
document, then passing through the PDF or DOC data.  Though you could
link the full path to the PDF in the URL, I just had my documents
stored
behind the web-accessible address.  Every time a new document was
uploaded, I decided to write the URL's statically to a file that the
FCKEditor script (changed fck_link.html to fck_link.php) will read
into
Javascript arrays, as opposed to accessing the DB every time this Link
window was viewed.  I added about 50 lines of Javascript code to
fck_link.php to do what I wanted in setting the URL from the Select
list.


Sweet!


I must warn you though, every time that I upgrade FCKEditor, I have to
reapply the changes I've done and there is the possibility that the
FCKEditor scripts may change to cause compatibility problems.  Let me
know if you are interested in this route and I can post my alterations
to
FCKEditor,


Please do!


but the PDF file management is up to you.


Oh yeah.  That's for sure.


I've had many
non-technical users working with this utility just fine for about 6
months,
so it works and though its not the most graceful implementation from a
developer's standpoint, it makes the user interface easiest to work
with.


It certainly sounds like a very good solution.

Be really nifty if fckEditor folks took a look at it and considered
adding it as a feature.

We can't be the only ones needing this kind of thing.


Here's my changes to FCKEditor, and it works on version 2.0 RC3, but should
work for other later versions too unless drastic changes have been made by
it's developers to the affected scripts.   I tried to clean it up for you as
much as possible and took out my customizations using doc ID's and broadened
it to use string URL's, which you'll need to write along with the doc
entry's Title to a static JS file that gets read by FCKEditor (using php).
The code also handles grouping uploaded documents into 1-level-deep groups,
so this is something you'll have to keep track of in your upload utility.
If that's not something you need or can easily figure out, just take out the
JS code that deals with Option Groups and flatten the document data array.

FCKEditor Customization Notes for linking Documents
---
By Jason Kovacs - 2005-05-04

1. Install the FCKeditor utility to /path/to/public_html/js/FCKeditor/.

2. The directory /path/to/public_html/js/data/ must be created and have
permissions of 777.

3. Set up the Document Upload utility to write static data to the file
/path/to/public_html/js/data/fck_link_docdata.js
  with the following structure:
---
var documentGroups = ["Group 1","Group 2"];
var documentData =
[
[
 ["Doc Title 1","URL"],
 ["Doc Title 2","URL"]
],
[
 ["Doc Title 1","URL"],
 ["Doc Title 2","URL"]
]
];
---

4. Rename ./js/FCKeditor/editor/dialog/fck_link.html to fck_link.php and
Edit it to have these changes:

4a. Below , insert:
<!-- 
</tt><tt><?
</tt><pre style="margin: 0em;">
@readfile("/path/to/public_html/js/data/fck_link_docdata.js");
?>
//-->

4b. Insert the following two Table rows above the  for "Protocol":

 
  Documents
  
Select a Document File
  
 


5. Edit ./js/FCKeditor/editor/dialog/fck_link/fck_link.html to have these
changes:

5a. Add these lines after "LoadSelection() ;" in the window.onload
function() call:
// Load the Documents select menu with optgroups/options from the included
data arrays.
LoadDocumentData() ;

5b. Before the SetLinkType function, add the following:

function LoadDocumentData()
{
var sUrl = GetE('txtUrl').value;
var docSelectObj = GetE('cmbLinkDocument');
for(var i=0; i < documentGroups.length; i++)
{
 optGroup = document.createElement('optgroup');
 optGroup.label = documentGroups[i];
 docSelectObj.appendChild(optGroup);
 for(var j=0; j < documentData[i].length; j++)
 {
  var objOption = document.createElement("option");
  objOption.innerHTML = documentData[i][j][0];
  objOption.value = documentData[i][j][1];
  if(objOption.value == sUrl) objOption.selected = true;
   optGroup.appendChild(objOption);
 }
}
}

5c. Change the line in the function SetLinkType from:
window.parent.SetTabVisibility( 'Advanced' , (linkType != 'anchor&

[PHP] Using .htaccess files with PHP CGI

2005-10-18 Thread Jason Kovacs
I am using PHP5 as a CGI and I can't seem to figure out
how to set INI values through httpd.conf or .htaccess files.
Since PHP isn't built as a module, the php_admin_value
and php_value directives don't exist.

If I had a module version of PHP along side the CGI, this
would not help because as far as I know Apache won't parse
those php directives and pass them to the CGI instance.

I know I can call the CGI binary using a Handler and pass
var=value arguments using the '-d' flag, but I want to be able
to set them differently per Virtual Host.

Specifically, I want to set 'session.save_path' for each virtual
host to a directory other than the one set in php.ini that only
apache can read/write to since my suexec'd php cgi binary
can only write session data to a directory owned by the
virtual host user.

How can this be done?  Any help would be appreciated, thanks.

-Jason Kovacs