Click to See Complete Forum and Search --> : server-side Javascripting & Apache


JKeenan
January 31st, 2006, 06:16 PM
is it possible to have server-side javascripting under Apache? Something like ASP?

I can't get this to produce anything to the response page

<%
var EmailNotifyStr;
var PathInfo;
var PhysicalPath;
var fso;
var thisFile;
var FolderObj;
var OutputFileStr;
var OutFileObj;
var OutTextFile;
var TristateUseDefault = -2;
var ForWriting = 2;
var ForAppending = 8;

fso = new ActiveXObject("Scripting.FileSystemObject");
PathInfo = Request.ServerVariables("PATH_INFO");
PhysicalPath = Server.MapPath(PathInfo);
//PhysicalPath is this response file's complete path, including filename

thisFile = fso.GetFile(PhysicalPath);
FolderObj = thisFile.ParentFolder;
//FolderObj now contains the folder (directory path) of this response file

//getting info from request form
EmailNotifyStr = Request.Form("EmailNotify");

OutputFileStr = FolderObj.Path + "\\NameAddresses.txt";

// for testing -------------
Response.Write("<p>OutputFileStr : " + OutputFileStr + "</p>");
Response.Write("<p>EmailNotify : " + EmailNotifyStr + "</p>");
Response.Write("<p>PhysicalPath : " + PhysicalPath + "</p>");
// for testing -------------

OutFileObj = fso.OpenTextFile(OutputFileStr, ForAppending , true, 0);
OutFileObj.WriteLine(EmailNotifyStr ) ;
OutFileObj.Close();

Session.Abandon;
%>

PeejAvery
January 31st, 2006, 11:11 PM
Well, JavaScript cannot be run on the server but it looks like you are doing filesystem work in ASP. PHP can do that. Can you fully explain what it is you want to do on the server-side?

JKeenan
February 1st, 2006, 11:42 AM
yes it was ASP until I found out that the server is based on Apache, not IIS... I'll look into PHP, thanks

PeejAvery
February 1st, 2006, 03:43 PM
yes it was ASP until I found out that the server is based on Apache, not IIS... I'll look into PHP, thanks
Take a look at Apache:ASP (http://www.apache-asp.org). It may make reprogramming to PHP not necessary for you.

Also, describe what exactly you want to do server-side in PHP. We can help.