Configuration of Apache Server To Support ASP 9783748780717, 3748780710

195 45 502KB

English Pages [25]

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Configuration of Apache Server To Support ASP
 9783748780717, 3748780710

Citation preview

Dr. Hedaya Mahmood Alasooly

Configuration of Apache Server To Support ASP

BookRix GmbH & Co. KG 80331 Munich

Configuration of Apache Server To Support ASP Configuration of Apache Server To Support ASP BY Dr. Hedaya Mahmood Alasooly [email protected]

1. OVERVIEW: 1. OVERVIEW: The paper aim is to configure Apache Server to support ASP. Two methods were tested. The first, by installing Bundle::Apache::ASP, and the second, by installing SUN ONE ASP Server. Two possible options for connecting to a Microsoft Access database with Sun ONE ASP for UNIX or Linux, using the using SequeLink, and using the Sun ONE ASP Database Publisher tool to migrate an Access database to MySQL, were studied. The paper is composed from the following parts, 1. Setting up working environment when working with CodeCharge Studio program, software for building web applications. 2. Connecting to databases in ASP. 3. ASP program example. 4. Configuring apache server to support ASP by installing Bundle::Apacahe::ASP. 5. Configuring apache server to support ASP by installing Sun ONE ASP.

2 SETTING UP WORKING ENVIROMENT WHEN WORKING WITH CODECHARGE STUDIO PROGRAM (SOFTWARE FOR BUILDING WEB APPLICATIONS): 2 SETTING UP WORKING ENVIROMENT WHEN WORKING WITH CODECHARGE STUDIO PROGRAM (SOFTWARE FOR BUILDING WEB APPLICATIONS): The CodeCharge Studio is a good program for building web application. Considering that there are several different programming languages that CodeCharge Studio generates, plus upwards of a dozen possible databases, there are obviously many configurations that could be used. Each combination of language and database has its own unique merits. 2.1 PHP SETUP: A common configurations for the development of PHP applications is as follows: Development Environment (for the development and testing of applications): A Windows desktop computer with an installation of CodeCharge Studio: Local or remote MySQL database. MyODBC driver (required during the design mode, but not during run-time). Apache Web server. PHP 4.0b3 or higher. Server Environment (for hosting the final application): A Linux server. MySQL database (local or remote). Apache Web server. PHP 4.0b3 or higher. Note that the MyODBC driver is needed only during the application design stage. The generated code can access the database directly without an ODBC driver. You can obtain the MyODBC driver from www.mysql.com. For PHP, the following table provides a list of applicable operating system, web server, database, and language version options. PHP Setup Server Operating System Unix/Linux, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP Web Server Apache, Internet Information Services (IIS) 4.0 or 5.0, Personal Web Server Scripting Engine/Language PHP 4.0b3 or higher Database Server MySQL, PostgreSQL, Microsoft Access, MS SQL Server, Oracle, DB2, FoxPro, or other database via ODBC The following is a list of steps that should be performed to setup and test the environment where the PHP pages will be published. 1. Install and configure the web server software: The PHP engine can be installed on a wide variety of web servers including IIS, PWS, and Apache. The procedure for installing the PHP engine varies depending on the web server that you are going to use. The PHP engine can be downloaded from http://www.php.net where you will also find information on how to perform the installation. You can also download the free Apache web server along with its documentation from http://www.apache.org. 2. Test the Web Server After installing the web server software, you should run a test to make sure that the server is functioning properly. For a server that has been installed on the local machine, the root URL http://localhost/ or http://127.0.0.1/ can be used to test the server. 3. Setup the Database It is common to use the MySQL database when publishing in PHP. You can download MySQL from

http://www.mysql.com where you will also find documentation for the database as well as a link to download the MyODBC driver which can be used to make an ODBC connection to a MySQL database during design time. 4. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup. 2.2 PERL SETUP: A common configuration for the development of Perl applications is as follows: Development Environment (for the development and testing of applications): A Windows desktop computer with an installation of CodeCharge Studio: Local or remote MySQL database MyODBC driver Apache Web server Perl 5.0 or higher Server Environment (for hosting the final application): A Linux server MySQL database (local or remote) Apache Web server Perl 5.0 or higher Note that the MyODBC driver is needed only during the application design stage. The generated code can access the database directly without an ODBC driver. You can obtain MyODBC driver from www.mysql.com For PERL, the following table provides a list of applicable operating system, web server, database, and language version options. PERL Setup Server Operating System Unix/Linux, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP. Web Server Apache, Internet Information Services (IIS) 4.0 or 5.0, Personal Web Server. Scripting Engine/Language PERL 5.0 or higher (i.e., some popular distributions of PERL include ActiveState PERL, Mod_PERL for Apache, and Indigo PERL). Database Server MySQL, PostgreSQL, Microsoft Access, MS SQL Server, Oracle, DB2, FoxPro, or other database via ODBC. The following is a list of steps that should be performed to setup and test the environment where the Perl pages will be published. 1. Install and configure and test the web server software The Perl language comes in many distributions as shown in the table above. Among the most popular are ActivateState Perl and Indigo Perl. You can also find more distributions at http://www.perl.com. Depending on the distribution of Perl you decided to use, the accompanying documentation should contains information on how to install, configure and test the server. Note that the Perl distribution is installed on top of a web server such as Apache or IIS. 2. Setup the Database Database connections in Perl require special modules known as database interfaces. It is common to use the MySQL database when publishing in Perl. You can download MySQL from http://www.mysql.com where you will also find documentation for the database as well as a link to download the MyODBC driver which can be used to make an ODBC connection to a MySQL database. 3. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup. 2.3. ASP SETUP:

A common configuration for the development of ASP applications is as follows: Development Environment (for the development and testing of applications): A Windows desktop computer with an installation of CodeCharge Studio A local MS Access database (or a copy of a remote MS Access database) or a local or remote SQL server PWS or IIS Web Server with VBScript 5.5 support or higher Server Environment (for hosting the final application): A Windows server, such as Windows NT Server or Windows 2000 Server. An MS SQL database IIS Web Server with VBScript 5.5 support or higher For ASP and Templates, the following table provides a list of applicable operating system, web server, database, and language version options. ASP Setup Server Operating System Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP Web Server Internet Information Services (IIS) 4.0 or 5.0, Personal Web Server Scripting Engine/Language ASP 3.0 with VBScript 5.5+ Database Server Microsoft Access, MS SQL Server, Oracle, MySQL, PostgreSQL, DB2, FoxPro, or other database via ODBC The following is a list of steps that should be performed to setup and test the environment where the ASP pages will be published. 1. Install and configure the web server software Some versions of Windows such as Windows NT Server, Windows 2000 Server and Windows XP Professional have the option of installing IIS server during the operating system installation process. Alternatively, the server can be installed later from the operating system setup CD. If your version of Windows does not allow the installation of IIS (e.g. Windows 98), you can install Personal Web Server (PWS) which is a scaled down version of IIS Server. . 2. Test the Web Server After installing the web server software, you should run a test to make sure that the server is functioning properly. For a server that has been installed on the local machine, the URL http://localhost/ or http://127.0.0.1/ can be used to test the server. When you type in this address, you should be able to see the default page in the root directory of the server. In particular, you should test a .asp page since this is the language you will be generating pages in. By default, the IIS server will bring up the .asp page (http://localhost/localstart.asp). 3. Setup the Database Once you confirm that you have a fully functional web server, you should then make sure that you have a suitable database to use. In the case of ASP, the easiest database to use would be Access. In order for the web pages to be able to use the Access database, the security settings for the database have to be setup correctly. Make sure that the database file is not opened in exclusive mode by any other user. Using Windows Explorer, right-click on the database file and open the properties dialog. Under the security tab, make sure everyone has access to the file or at the least the IUSR_MachineName account should have Read and Write Permissions on the file. The IUSR_MachineName account is the account which is used by the web server to access the database. If you are using a different database such as MS SQL server or Oracle, make sure that you have an account in the database with which you can access the required tables. 4. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup. 2.3 .NET SETUP: A common configuration for the development of ASP.NET applications is as follows:

Development Environment : (for the development and testing of applications): A Windows 2000 or Windows XP desktop computer with an installation of CodeCharge Studio. A local MS Access database (or a copy of a remote MS Access database) or MSDE (recommended) or remote SQL server. IIS Web Server 5.0 or higher. Microsoft .NET SDK 1.0.3705 (Service Pack 2 is highly recommended) or later. Optional - if using an ODBC connection - ODBC.NET Managed Provider. Optional - if using an Oracle connection Oracle.NET Managed Provider. Server Environment (for hosting the final application): A Windows 2000 or higher server computer. IIS Web Server 5.0 or higher. Microsoft .NET SDK 1.0.3705 (Service Pack 2 is highly recommended) or later Optional - if using an ODBC connection - ODBC.NET Managed Provider Optional - if using an Oracle connection - Oracle.NET Managed Provider For ASP.Net (C# and VB.Net) projects, the following provides a list of applicable operating system, web server, database, and language version options. .NET Setup Server Operating System Windows 2000, Windows XP, Windows .Net Server Web Server Internet Information Services (IIS) 5.0, (requires installation of the Microsoft .Net SDK 1.0.3705 or later) Scripting Engine/Language C# or Visual Basic.NET Database Server Microsoft Access, MS SQL Server, Oracle, MySQL, PostgreSQL, DB2, FoxPro, or other database via ODBC The following is a list of steps that should be performed to setup and test the environment where the .Net pages will be published. These steps don't have to be followed strictly in the order in which they are presented here. 1. Install and configure the web server software In order to publish .Net pages, you need to have an installation of the IIS 5.0 server. The IIS server is available on Windows 2000 and XP Professional operating systems as well as the Windows .Net server which is still in development as of this publishing. In addition to the IIS 5.0 server, you also must download and install the .Net Framework. This can either be the .Net Framework redistributable or the .Net Framework SDK (http://www.asp.net/). 2. Test the Web Server After installing the web server software, you should run a test to make sure that the server is functioning properly. For a server that has been installed on the local machine, the URL http://localhost/ or http://127.0.0.1/ can be used to test the server. When you type in this address, you should be able to see the default page in the root directory of the server. In order to test whether the .Net Framework was successfully installed, you need to test a .aspx page. Please refer to the documentation that accompanies the .Net Framework for information on how to test that the installation was successful. 3. Setup the Database: Once you confirm that you have a fully functional web server, you should then make sure that you have a suitable database to use. In the case of .Net, the easiest database to use would be Access. In order for the web pages to be able to use the Access database, the security settings for the database have to be setup correctly. Make sure that the database file is not opened in exclusive mode by any other user. Using Windows Explorer, right-click on the database file and open the properties dialog. Under the security tab, make sure everyone has access to the file or at the least the IUSR_MachineName account should have Read and Write Permissions on the file. The IUSR_MachineName account is the account which is used by the web server to access the database. If you are using a different database such as MS SQL server or Oracle, make sure that you have an account in the database with which you can access the required tables. Also, if you intend to use an ODBC connection, you need to download and install the ODBC.Net managed provider as indicated in the table above.

4. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup. 2.4 COLDFUSION SETUP: A common configuration for the development of ColdFusion applications is as follows: Development Environment (for the development and testing of applications): A Windows desktop computer with an installation of CodeCharge Studio A local MS Access database (or a copy of a remote MS Access database) or a local or remote SQL server PWS or IIS Web Server with ColdFusion server Server Environment (for hosting the final application): A Windows server, such as Windows NT Server or Windows 2000 Server. An MS SQL database IIS Web Server with ColdFusion server For ColdFusion, the following table provides a list of applicable operating system, web server, database, and language version options. ColdFusion Setup Server Operating System Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP, Unix/Linux. Web Server Internet Information Services (IIS) 4.0 or 5.0, Personal Web Server, Apache server. Scripting Engine/Language ColdFusion 4.0.1, 4.5, ColdFusion 5.x, ColdFusion MX. Database Server Microsoft Access, MS SQL Server, Oracle, MySQL, PostgreSQL, DB2, FoxPro, or other database via ODBC. The following is a list of steps that should be performed to setup and test the environment where the ColdFusion pages will be published. 1. Install and configure the web server software In order to deploy ColdFusion pages, you need a web server which also has the ColdFusion engine installed. The minimal ColdFusion version you can use is 4.0.1. This means that you can use any version higher than this i.e. 4.5, 5.0 and MX. Each of these different versions can be installed on a varying number of web servers ranging from Microsoft IIS and PWS to Apache and Netscape Server. 2. Test the Web Server After installing the web server software and the ColdFusion engine, you should run a test to make sure that the server is functioning properly. Please refer to the ColdFusion server documentation which includes directions on how to test whether the server is working correctly. 3. Setup Database Database connections in ColdFusion can be made using ODBC DSN's or data sources that are configured in the ColdFusion Administrator panel. 4. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup. 2.5 JSP SETUP: A common configuration for the development of Java applications is as follows: Development Environment (for the development and testing of applications): A Windows desktop computer with an installation of CodeCharge Studio Local or remote MySQL database

MyODBC driver Tomcat server JDK 1.3 or higher Ant build tool Server Environment (for hosting the final application): A Linux server MySQL database (local or remote) MySQL JDBC driver Tomcat Web server JDK 1.3 or higher For JSP and Java Servlets, the following table provides a list of applicable operating system, web server, database, and language version options. Java Servlets and JSP Setup Server Operating System Unix/Linux, Windows 95, Windows 98, Windows NT, Windows 2000, Windows XP Web Server Tomcat, Resin, BEA Weblogic, IBM Websphere, Macromedia JRun, Apache+ Tomcat, Internet Information Services (IIS) + Tomcat, or other Web Server that supports Servlet API version 2.2. Database Server MySQL, PostgreSQL, Oracle, DB2, MS SQL Server, Informix, or other database via JDBC or JDBC-ODBC Bridgeþ The following is a list of steps that should be performed to setup and test the environment where the JSP pages or Java Servlets will be published. 1. Install and configure the web server software The Servlet engine is implemented by a variety of web servers including Tomcat, Resin, Sun ONE, Weblogic, and WebSpheher. The procedure for installing the Servlet engine depends on the web server that you are going to use. You can download the free Tomcat web server along with its documentation from http://jakarta.apache.rg/tomcat/. 2. Test the Web Server After installing the web server software, you should run a test to make sure that the server is functioning properly. For a server that has been installed on the local machine, the root URL http://localhost:8080/ or http://127.0.0.1:8080/ can be used to test the server. Please refer to the documentation for the server you have installed for information on how to confirm that the installation was successful. 3. Setup the Database It is common to use the MySQL database when publishing in JSP. You can download MySQL from http://www.mysql.com/ where you will also find documentation for the database as well as a link to download the MyODBC driver which can be used to make an ODBC connection to a MySQL database during design time. The MySQL JDBC driver can be downloaded from http://www.mysql.com/products/connector-j/. 4. Create and Test a CodeCharge Project CodeCharge Studio comes with a number of example projects which you can easily generate and publish as a way of testing that you have a functional setup.

3. CONNECTING TO DATABASES IN ASP: 3. CONNECTING TO DATABASES IN ASP: This section takes you through the two basic steps required for connecting to a database from an ASP page: creating a connection string, and opening a database connection. A connection string provides information required by the server to establish the connection. Within a connection string, you can use one of three ways to specify information about a database: a system DSN, a DSN-less connection string, and a file DSN. A database connection is opened by using the ADO Connection object. 3.1 CREATING CONNECTION STRINGS: When you want to connect to a database from an ASP page, the first step is to create the connection string. This provides information (in the form of parameters and their values) that is required for the server to establish the connection. Exactly what you must include in a connection string depends on the type of database and the approach you use to specify its parameters. Some servers supports the following three approaches to specifying parameters in a connection string: System DSN: With a system DSN, all you need to provide in the connection string is the name of the DSN that your system administrator has configured for the database on the ASP Server. File DSNs: A file DSN is similar to a system DSN, except the database information is contained in a file (*.dsn) that can be stored in the root directory for a virtual host, rather than being stored centrally by the ASP Server. File DSNs are useful in shared Web hosting environments because a system administrator does not need to configure each file DSN; users can configure their own. DSN-less connection strings: With a DSN-less connection string, you specify all of the required database information in the connection string. Connection strings must be constructed according to the requirements of the ODBC driver being used. Once you have created the connection string in your ASP page, you can add the code needed to open a database connection. a. Using System DSNs in Sun One Server: Using a system DSN is one way to specify database information in a connection string. Before you can use a system DSN in a connection string your administrator must first add it. This saves information about all parameters required for connecting to the database. All you need to provide in the connection string is the name of the DSN that your system administrator has configured for the database. In this case, use the following syntax: connect_string = "dsn=[dsn_name]" where [dsn_name] is the name your system administrator defined for the DSN. In Sun One Server, you must use system DSNs for connecting to Microsoft Access and Microsoft SQL Server 6.5 databases. You cannot use DSN-less connection strings or file DSNs for connecting to these databases. b. Using DSN-less Connection Strings Using a DSN-less connection is one way to specify the information (in the form of parameters and their values) that is needed to establish a database connection. Unlike system DSNs and file DSNs, which incorporate this information by reference, DSN-less connection strings include all required database parameters. The following example shows a DSN-less connection string for a MySQL database: connect_string = "Driver={Mysql}; Server=[server_name]; Port=[port_number]; Database= [database_name]; UID=[username]; PWD=[password]" where [server_name] is the name of the database server, [port_number] is the port for the database server, [database_name] is the name of the database, and [username] and [password] are the username and password required for accessing the database.

Different types of databases can require that you specify different parameters. Connection strings must be constructed according to the requirements of the ODBC driver being used. With Sun ONE ASP for UNIX or Linux you cannot use DSN-less connection strings or file DSNs for connecting to Microsoft Access or Microsoft SQL Server 6.5 databases; you must use system DSNs for connecting to these databases. 3.2 OPENING THE DATABASE CONNECTION: The ADO Connection object opens and closes database connections by using ODBC drivers. Other ADO objects act as containers for storing information that is passed to and from the database. The most common container is a Recordset object, which stores the results of a SELECT SQL query. “Creating Connection Strings” explains the first step to take to connect an ASP page to a database. After creating the connection string, your next step is to use the ADO control to open a database connection. To open a database connection, you first add code for creating an instance of the ADO connection object, as shown in the following example: set dbConn = server.createObject("ADODB.connection") Next, you add code to call the Connection object Open method, which takes the connect_string parameter, as shown in the next example: dbConn.open connect_string This sends a request to the ODBC Manager to create an instance of the ODBC driver specified by the connection string that you previously created. ADO then passes the remainder of the connection string to the ODBC driver, which uses this information for connecting to the database. Once you have established the connection, you can use the other ADO objects to retrieve, display, and manipulate data on your Web page. If desired, you can also use FrontPage to create connection strings and display data on a Web page. 3.3 ADO CONPONENT: ADO enables client applications to access and manipulate data in a database server from a variety of different vendors in the same manner. With ADO, data is updated and retrieved using a variety of existing methods (including SQL). In ADO, the Recordset object is the main interface to data. An example of the minimal VBScript code to generate a recordset from an ODBC data source is as follows: set rstMain = CreateObject("ADODB.Recordset") rstMain.Open "SELECT * FROM authors", "DATABASE=pubs;UID=sa;PWD=;DSN=Publishers" ADO provides two objects for managing connections with data sources (Connection and Command), two objects for managing the data returned from a data source(Field and Recordset) and three secondary objects (Parameters, Properties, and Errors) for managing information about ADO. “ADO Command Object” The Command object defines a specific command to execute against a data source. “ADO Connection Object” Represents an open connection to a data source. “ADO Error Object” Provides specific details about each ADO error. “ADO Field Object” Represents a column of data with a common data type. “ADO Parameter Object” Represents a parameter or argument associated with a Command object based on a parameterized query or stored procedure. “ADO Property Object” Represents a dynamic characteristic of an ADO object that is defined by the provider. “ADO Recordset Object” Represents the entire set of records from a database table or the results of an executed command. 3.4 MIGRATING AN ACCESS DATABSE TO MYSQL OR DBASE IN SUN ONE SERVER: Microsoft Access databases are compatible with Sun ONE Active Server Pages running on Windows, but these databases do not run on UNIX or Linux systems. There are several options for connecting to a Microsoft Access database with Sun ONE ASP for UNIX or Linux, as described below. Use SequeLink.

Use the Sun ONE ASP Database Publisher tool to migrate an Access database to MySQL If you use FrontPage, you can easily migrate your Microsoft Access database to dBASE by using the Microsoft Access Export Table feature. You can then import the resulting folder of files to your FrontPage Web and use the Database Results Wizard. The dBASE database management system is relatively easy to learn and use. If you have moved a dBASE-based Web application to UNIX and then find that Sun ONE ASP cannot open the database, make sure that the file extensions of your dBASE files are in all capital letters (that is, *.DBF).

4 ASP PROGRAM EXAMPLE: 4 ASP PROGRAM EXAMPLE: Create Access database guestbook.mdb database, with one table tblComments, that has two fields name and description, and fill the table with some data. Then we need to start web page, open up your favorite text editor and type the following HTML.

My First ASP Page

Next you can begin writing the ASP to connect to the database. First we need to create the variables that we are going to use in the script.

Now call the file you have created 'guestbook.asp' and save it in the same directory folder as the database, don't forget the '.asp' extension. 4.1 SETTING UP SYSTEM DSN ON WINDOWS: First you need to open the 'ODBC Data Source Administrator', in Windows 98 you will find it in the 'Control Panel' under '32bit ODBC', in Windows 2000 you will find it under 'Control Panel', 'Administration Tools' and it will be called 'Data Sources ODBC'. Once you open the ODBC Data Source Administrator select the tab 'System DSN' and click on the 'Add' button at the right hand side of the dialog box. You will now see another dialog box asking you to select a driver for the data source. Select the 'Microsoft Access Driver (*.mdb)' driver from the list and then click on the next finish button and the bottom of the dialog box. In the next dialog box 'ODBC Microsoft Access Setup', you will need to set a name for the data source, this will be the name you call from your ASP scripts, I called this 'guestbook' to fit in with the database example. You will also need to click on the 'Select...' button in the middle on the left. From here you will be asked to 'Select Database', browse your hardrive for the database, i.e 'guestbook.mdb'. Next hit the OK button and you should now see your new ODBC Data Source. If you are willing setup system DSN for MYSQL database in windows, then you need to first download and install the MyODBC driver which can be obtained from http://www.mysql.com/downloads/apimyodbc.html. Then setup system DSN in same procedure as shown before.

5. CONFIGURING APACHE SERVER TO SUPPORT ASP by INSTALLING BUNDLE::APACHE::ASP: 5. CONFIGURING APACHE SERVER TO SUPPORT ASP by INSTALLING BUNDLE::APACHE::ASP: 1. Install the following RPMS: httpd, httpd-devel, apr, apr-devel, mod_perl, mod_perl-devel. 2. Install Bundle::Apache::ASP, using webmin, or CPAN module #perl –MCPAN –e shell #install Bundle::apache::asp The perquisites will be installed also. If you don’t know where the downloaded Apache-ASP saved, download Apache-ASP from ftp://ftp.duke.edu/pub/perl/modules/by-module/Apache/ and extract it, and install it #cd Apache-ASP #perl Makefile.PL #make #make test #make install 3. You will need to change mod_perl version 1 to mod_perl version 2. Download mod_perl 2 from http://perl.apache.org/download/index.html, and extract it, and change directory to its folder to install it. 4. RedHat Linux system installs the httpd binary, the apxs and apr-config scripts (the latter two are needed to build mod_perl) all in different locations, therefore configure mod_perl 2.0 as: perl Makefile.PL MP_APXS=/path/to/apxs MP_APR_CONFIG=/another/path/to/apr-config In our case, write, # perl Makefile.PL MP_APXS=/usr/sbin/apxs # make #make test #make install 5. Install Apache2::comapt #perl –MCPAN –e shell #install Bundle::apache::asp 6. Copy the site folder from Apache-ASP by, #cp -rpd ./site /var/www/html/asp 7. Change permissions on the asp folder, #chmod 755 -R /var/www/html/asp 8. Add to /etc/httpd/config/httpd.conf PerlModule Apache::ASP PerlModule Apache2::Compat

SetHandler perl-script PerlHandler Apache::ASP PerlSetVar Global . PerlSetVar StateDir /tmp/asp



Options FollowSymLinks AllowOverride All

Also change AllowOverride to All in , and comment “AllowOverride” in 9. Make, #service httpd restart Now test the configuration by executing the script http://localhost/asp/eg/response.asp Observation: By this way, Apache server cant compile the VB and Java codes in ASP script, and from the FAQ in apache-asp site, it is said that the solution is Sun One Server.



6. CONFIGURING APACHE SERVER TO SUPPORT ASP USING SUN ONE ACTIVE SERVER PAGES: 6. CONFIGURING APACHE SERVER TO SUPPORT ASP USING SUN ONE ACTIVE SERVER PAGES: Sun ONE Active Server Pages enables ASP developers to connect with several types of databases from within an ASP application. It provides the built-in ADO Connection object that developers can use to initiate a database connection, along with a set of ODBC drivers that enable the ASP Server and ODBC Manager to establish and maintain the connection.. To make it easier for developers to connect an ASP application to a database, the system administrator can add a system DSN (data source name) to the ASP Server. DSNs store information about a database that the ASP Server and ODBC Manager use for connecting to it. Developers can use the system DSN in connection strings on ASP pages to incorporate database information by reference, rather than specifying the complete set of information in each string. You can access DSN configuration settings on the Global Data Source Names tab of the Sun ONE ASP Administration Console Databases page. This tab displays the list of system DSNs that are currently configured for the ASP Server. It also provides access to settings for adding a new DSN to the ASP Server, and for removing, editing, and testing an existing DSN. 1. Download the ASP Server from Sun Java System Active Server Pages http://www.sun.com/software/chilisoft/index.xml 2. Install the httpd, libstdc++, compat-libstdc++, compat-libstdc++-devel, libstdc++-devel. 3. Install it by extracting it and writing ./install.sh 4. Fellow the instruction, choose to detect the most known web servers, and by that it will be linked to Apache Web server.. 5. Go to http://127.0.0.1:5100, Sun ONE ASP Administration Console, user:admin password: root. 6. Start the ASP and Web servers 7. Put the asp script in /var/www/html, i.e. hello.asp 8. Now you can reach to your scripts, i.e. hello.asp by http://linux1.localdomain.msft/hello.asp 9. Put the guestbook.asp and guestbook.mdb access file in /vat/www/html 10. We not that the script cant be executed because Sun ONE Server does not support access. Observation : Sun ONE ASP Server can’t connect to access database in normal way. 6.1 REWRITING THE ACCESS DATABASE TO MYSQL: 1. Now create same database using MySQL. 2. Create in ASP server DSN for this MYSQL database guest book, using Sun ONE ASP Administration Console Databases page, and call the DSN guestbook, and change the guestbook.asp to use guestbook DSN by considering adoCon.Open "DSN=guestbook". 3. Test the configuration by browsing http://localhost/guestbook.asp Observation: Script will be executed. 6.2 PUBLISHING THE ACCESS DATABASE to MYSQL IN SUN ONE ASP: 1. Install the Publisher Wizard from Sun ONE site to the window system that include the access database 2. Publish the access database, guestbook.mdb to the Linux server, fellow the guidelines in this issue from SUN ONE ASP documentation. The procedure is straight forward.. 3. Guestbook Mysql database will be created in the linux machine. 4. Create, using Sun ONE ASP Administration Console Databases page, DSN for this MYSQL database guestbook, and call the DSN guestbook, and change the guestbook.asp to use guestbook DSN by considering adoCon.Open "DSN=guestbook". 5. Test the configuration by browsing http://localhost/guestbook.asp Observation: Script will be executed. 6.3 USING SEQUELINK IN THE COMPUTER THAT INCLUDE THE ACCESS FILE:

a. SequeLink Two-Tier Architecture: SequeLink Server is often installed on the same server on which the database engine resides, and the SequeLink Client is often installed on the same workstation as the user application. This is a two-tier architecture because only two machines are needed for the configuration. Data Access Architecture: 1 SequeLink Clients can be configured to connect directly to a specific SequeLink Server or retrieve connection information from an LDAP directory. 2 User applications use the SequeLink Client to connect to the SequeLink Server. Applications make SQL calls from the SequeLink Client to the SequeLink Server using standard APIs, such as ODBC, ADO, JDBC, or .NET. 3 The SequeLink data access service passes the SQL request to the database engine. 4 The database engine processes the SQL request and passes results back to the SequeLink data access service. 5 The SequeLink data access service returns the results directly to the SequeLink Client and the user application. b. SequeLink n-Tier Architecture For maximum flexibility and centralized access, SequeLink Client can be installed on a middle-tier server between the client and a database server. 1 In a three-tier architecture, a user application (for example, a web browser) may invoke components residing on the Web/Application Server that need to load the SequeLink Client to gain access to the data store on the Database Server. 2 A SequeLink Client is installed on the Web/Application Server. Applications make SQL calls from the Web/Application Server running the SequeLink Client to the SequeLink Server using standard APIs, such as ODBC, ADO, JDBC, or .NET. c. To Configure SequeLink, 1. On the database server to which SequeLink Server 5.3 is installed, create a DSN using Windows’ administrative tools (Start > Settings > Control Panel > Administrative Tools > Data Sources (ODBC). 2. Start SequeLink Server 5.3 for ODBC Sockets (Start > SequeLink Server 5.3 for ODBC Sockets > SequeLink Manager Snapin. 3. Connect to the SequeLink Service if you’re not already connected, and then expand SequeLink 5.3 Manager. 4. Expand SequeLink Services > SLSocket53 > Configuration. 5. Right-click Data Source Settings, and then select New > Data source. 6. Name the new data source by typing the name of the DSN you created in step 1 (for example, "guestbook"), expand the node, and then click the Advanced folder. 7. Double-click DataSourceSOCODBCConnStr. 8. In the Value box, change the value to the connection string you created in step 1 (for example, "DSN=guestbook"), and then click OK. 9. Expand the User Security node, and then double-click Data Source Logon Method. 10. Select OSIntegrated. 11. Configure the SequeLink DSN in Linux ASP Server. You will be asked to specify the ServerDataSource. This is the name of the DSN you just configured (for example, "guestbook"). Change the guestbook.asp to use guestbook DSN from adoCon.Open "DSN=guestbook". and change the guestbook.asp to use guestbook DSN from adoCon.Open "DSN=guestbook" 12. Test the configuration by browsing http://localhost/guestbook.asp Observation: Script will be executed. 6.4 SUPPORTING MULTIPLE VIRTUAL DOMAINS: 1. Create two users, i.e., mtituser, motuser, and I choosed their home directory /var/www/mtituser, /var/www/motuser/ 2. Create in /etc/httpd/conf/httpd.conf two named servers, mtit.gov1.ps1, mot.gov1.p1. For example, NameVirtualHost 10.12.1.251 # # Virtual hosts # # Virtual host linux1.localdomain.msft

ServerSignature email DirectoryIndex index.php index.html index.htm index.shtml

Options all

AllowOverride none XBitHack on

Options all AllowOverride none

LogLevel debug HostNameLookups off

# Virtual host mot.gov1.ps1

DocumentRoot /var/www/motuser/public_html ServerName mot.gov1.ps1 ServerSignature email

Options all AllowOverride none XBitHack on

Options all AllowOverride none

# Virtual host mtit.gov1.ps1

DocumentRoot /var/www/mtituser/public_html ServerName mtit.gov1.ps1 ServerSignature email

Options all AllowOverride none XBitHack on

Options all AllowOverride none

Then if you want to enable users to have their websites, create the user, i.e. hedaya and create in its home directory a directory public_html, which includes its website, and then set in httpd.conf UserDir "enable" hedaya UserDir public_html 3. Now from the Sun ONE ASP Administration Console (http://localhost:5100), you can enable the asp support to each virtual host and restart the asp and web server. You can restart the web server by # service httpd restart 4. When I worked with Fedora Core 1, I got no problem to restart the httpd service. But when I worked with Enterprise 4 server, I got error when I started the httpd service, so I had to do the following commands to resolve the problem # chcon -R -h -t httpd_sys_content_t /opt/casp/INSTALL/ # chcon -h -t shlib_t /opt/casp/module/linux2_i686_optimized/apache_2.0.x/20020903/standard/*.so # chcon -h -t shlib_t / opt/casp/server/lib/linux2_i686_optimized/libcasp2ap.so # chcon -h -t shlib_t opt/casp/server/lib/linux2_i686_optimized/libaspdisp.so 6.5 USING COMMAND-LINE: Sometimes you got problem to access web server from the administration console, so you have to use the command lines while you are in the Sun ONE ASP installation directory (/opt/casp by default). Please refer to ASP documentation for more information. Some of the useful commands that can be used, a- Restart the asp server:

To restart the asp server, # ./configure-server function=enginectl engine=asp-server-3000 restart b-Change the Web Server: In certain cases you might want to change the Web server with which Sun ONE Active Server Pages is configured to run. This association is referred to as the ASP Server-to-Web server linkage, and was specified during the installation of Sun ONE ASP. To change the ASP Server-to-Web server linkage, from the Sun ONE ASP installation directory (/opt/casp by default), type the following at the command prompt: #./configure-server At the prompt, select Configure Sun ONE ASP. Select Change the Web server-to-Sun ONE ASP association. At the prompt, select the Web server you want to change, or select Cancel to exit. c- Add ASP Server: This functionality is used to add an ASP engine to an installation. # ./configure-server function=add-server webserver_conf=/etc/httpd/conf/httpd.conf webserver_binary=/usr/bin/httpd start_asp_onboot=no d- Delete ASP server: This functionality is used to delete an ASP engine from an installation. #./configure-server function=delete-server engine=asp-server-3000 e- Reconfigure ASP Server: This functionality is used to reconfigure an ASP engine within the installation. #./configure-server function=change-server engine=asp-server-3000 webserver_conf=/etc/httpd/conf/httpd.conf or #./configure-server function=change-server engine=asp-server-3000 webserver_conf=/etc/httpd/conf/httpd.conf webserver_binary=/usr/bin/httpd f- Add/Remove ASP in Virtual Hosts: This is to enable and disable ASP in virtual hosts. For your ASP engine to be accessible to any virtual host. #./configure-server function=configure-engine engine=asp-server-3000 mode=add 'section=virtual hosts' key='allow_all' value='yes' Your ASP engine will be accessible only on virtual host mtit.gov1.ps1 #./configure-server function=configure-engine engine=asp-server-3000 mode=add 'section=virtual hosts' key='allow_all' value='no' #./configure-server function=configure-engine engine=asp-server- mode=add 'section=virtual hosts' key='mtit.gov1.ps1' g-Add/Remove ASP in Applications (Virtual Folders): This functionality is used to add and remove applications. #./configure-server function=configure-engine engine=asp-server-3000 mode=add 'section=applications' key=/tmp value=/tmp Your ASP engine will associate the /tmp virtual URI with the /tmp local directory h- Show Database Types: This functionality is used to display a list of supported database types and the corresponding DSN attributes. #./configure-server function=show_dbinfo i- List all DSNs: This functionality is used to display a list of all DSN names that have been configured (excluding template DSNs). The scriptable interface (configure-server) is described in the following table. #./configure-server function=list_dsns . . . j-View Specific DSNs: This functionality is used to show keys and values for all attributes in the DSN. #./configure-server function=view_dsn name=mysql_test k-Add/Edit DSNs: This functionality is used to create a new DSN or modify an existing one. #./configure-server function=new_dsn name=mysql_test type=MySQL Server=test Database=mysql Port=3306 User=root Password=root l- Uninstalling Sun ONE ASP:

To uninstall Sun ONE ASP, from the Sun ONE Active Server Pages installation directory (/opt/casp by default), type the following at the command prompt: #./uninstall

7 CONCLUSION: 7 CONCLUSION: The paper aimed is to configure Apache Server to support ASP. Two methods were tested. The first, by installing Bundle::Apache::ASP, and the second, by installing Sun ONE ASP. It is found that using the first method, Apache server cant compile Visual Basic and Java Codes in the ASP script, so it was necessary to install the Sun ONE ASP, which is the second method. But, Microsoft Access databases are compatible with Sun ONE Active Server Pages running on Windows, but these databases do not run on UNIX or Linux systems. Two options for connecting to a Microsoft Access database with Sun ONE ASP for UNIX or Linux were tested, using the using SequeLink, and using the Sun ONE ASP Database Publisher tool to migrate an Access database to MySQL. Both methods were succeeded. Using the Database Publisher Tool is much better, as you will need in this case one server only.

8 REFERENCES: 8 REFERENCES: [1] http://www,apache-asp.org web site. [2] http://www.sun.com/software/chilisoft web site. [3] http://www.apache.org web site.

Publisher: BookRix GmbH & Co. KG Implerstraße 24 80331 Munich Germany

Publication Date: April 19th 2021 https://www.bookrix.com/-kf086886aac2de5 ISBN: 978-3-7487-8071-7 BookRix-Edition, publishing information We thank you for choosing to purchase this book from BookRix.com. We want to invite you back to BookRix.com in order to evaluate the book. Here you can discuss with other readers, discover more books and even become an author yourself. Thank you again for supporting our BookRix-community.