Js|web|web Service |web Server In recent years, Linux in the server market accounted for a growing proportion, in addition to Linux for free and security, but also because of the increasingly rich application services on Linux. Most common services have a better solution on Linux. Linux has done even better with the most widely used Web services on intenet. No one can say how many Web sites there are on the Internet, but in many sites, the use of PHP and JSP development site undoubtedly occupies a great market share. Here's how to set up a Web server that supports Jsp+php+mysql on Linux.
For Web services, Apache is undoubtedly the preferred choice. Database to choose MySQL, which is enough for the general application, of course, Linux can also install Oracle, DB2 and other large databases, but they are expensive. As for the development of language support, JSP and PHP is undoubtedly the most mainstream and most widely used web development language. All of these software can be found on the following websites:
resin:http://www.caucho.com/
jdk:http://java.sun.com/
apache:http://www.apache.org
Mysql:http://www.mysql.com
Php:http://www.php.net
Mm. mysql:http://mmmysql.sourceforge.net/
Download the corresponding software from the above website, the author downloads the following software:
Use the following command to enter the command line for MySQL:
[Root@terry root]#/usr/local/terry_yu/mysql/bin/mysql-uroot-p
Enter Password:
Welcome to the MySQL Monitor. Commands end With or G.
Your MySQL Connection ID is 1 to server version:4.0.15
Type ' help, ' or ' h ' for help. Type ' C ' to clear the buffer.
Mysql> quit
Bye
The above information indicates that MySQL has successfully run.
Exit the currently logged on environment and log back in so that the environment variable you just set will take effect, and then test with the following command:
[Root@terry root]# Java-version
Java Version "1.4.2_01"
Java (TM) 2 Runtime environment, Standard Edition (build 1.4.2_01-b06)
Java HotSpot (TM) Client VM (build 1.4.2_01-b06, Mixed mode)
Seeing similar information indicates that the JDK environment is good. In fact, in the above/etc/profile, we not only set the JDK environment variables, but also set the resin and JDBC environment variables, these are the following installation resin necessary settings.
Third, the installation of MySQL JDBC
MySQL's JDBC related environment variables are already set up in the front, so the rest is only installed with the following command:
It should be noted that when compiling Apache must join the DSO support, if not, please add the--ENABLE-MODULE=SO option to recompile Apache
# TAR-XZPVF Apache_1.3.28.tar.gz
# CD apache_1.3.28/
#./configure--prefix=/usr/local/terry_yu/apache--enable-module=most
--enable-shared=max
# make
# make Install
See the above information indicates Apache support DSO mode. This can use the way of DSO to the PHP and resin modules added in.
V. Installation of PHP
Install PHP is simpler, we first installed PHP.
# TAR-XZPVF Php-4.3.3.tar.gz
# CD PHP-4.3.3/
#./configure--with-mysql=/usr/local/terry_yu/mysql
--with-apxs=/usr/local/terry_yu/apache/bin/apxs
# make
# make Install
# CP Php.ini-dist/usr/local/lib/php.ini
The configuration file for editing PHP is/usr/local/lib/php.ini, which modifies the register_globals variable to on and the default is off. You need to change it to on. Otherwise, PHP can not read directly to the post or get data phenomenon.
Edit Apache's configuration file/usr/local/terry_yu/apache/conf/httpd.conf, and add the following line at the end of the file:
AddType application/x-httpd-php. php. php3
Start Apache:
#/usr/local/terry_yu/apache/bin/apachectl Start
You can then test the installation of PHP with a simple PHP file that contains the following line:
? Phpinfo ();?>
Save it as a/usr/local/terry_yu/apache/htdocs/info.php, and then browse through the browser, and if you view the page with the "PHP Version4.3.3" title, it means that the integration of PHP and Apache is successful. And you can see PHP-related options on this page, which should have subkeys about MySQL, indicating that PHP has built-in support for MySQL. This means that the Php+mysql+apache environment has been successful, followed by the installation of resin to support the JSP environment.
Six. Install resin
Http://www.caucho.com/download/resin-3.0.3.tar.gz
The downloaded resin installation package should be able to run directly when it is untied. The author will untie it and put it in the/usr/local/terry_yu directory.
If you set up the relevant environment variables before installing the JDK, you will be able to see the resin page from the http://localhost:8080/, which means that the individual resin is running successfully. Then, in order to integrate resin and Apache, we need to recompile to generate the Mod_caucho call to Apache.
# Cd/usr/local/terry_yu/resin
#./configure--with-apache=/usr/local/terry_yu/apache
# make
# make Install
Modify/usr/local/terry_yu/resin/conf/resin.conf, approximately on line 159th (the resin version of the installation is different, the contents of the configuration file may vary), the <document-directory> Modified to its own Apache DocumentRoot value.
Modify/usr/local/terry_yu/apache/conf/ httpd.conf, when compiling resin, the installer has modified httpd.conf, but not quite right, it should be changed to a configuration similar to the following, if you complete the installation by this article can copy the content directly:
<ifmodule mod_caucho.c>
Resinconfigserver localhost 6802
<Location/caucho-status>
SetHandler Caucho-status
</Location>
</IfModule>
After the modification, after restarting the resin, it takes effect:
Access to http://localhost/caucho-status/through the browser, if the following page shows that resin and Apache have been successfully integrated.
Then test the JSP access to the database, under the/usr/local/apache/htdocs/with JSP to write a simple JSP file to connect the MySQL database of this computer:
vi/usr/local/terry_yu/apache/htdocs/testdb.jsp
You can paste it directly by entering the following:
Through the browser to access Http://localhost/testdb, if you see a blank page without any error messages, it means that the MySQL database of JSP connected to this computer is successful, so we have completed a Web server supporting Jsp+php+mysql.
Note: All of the above installations are done on red Hat Linux9.0, and the software used is currently (September 2003) the latest version.
This article describes how to set up a web Server that supports both JSP and PHP on Linux, demonstrating the installation and simple testing process for MySQL, JDK, JDBC, Apache, PHP, resin, and so on.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.