Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to set up a Web server that supports JSP+PHP when Linux is on the shelf

Shulou Source: shulou.com Published: 2022-06-01 22:00:47 09月28日 Update

This article mainly introduces "how to set up a Web server that supports JSP+PHP on Linux shelves". In daily operation, I believe many people have doubts about how to set up Web servers that support JSP+PHP on Linux shelves. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to set up Web servers that support JSP+PHP on Linux shelves." Next, please follow the editor to study!

For Web services, apache is undoubtedly the first choice. MySQL is selected for database, which is enough for general applications. Of course, large databases such as oracle and DB2 can also be installed under Linux, but they are expensive. As for the support for development languages, JSP and PHP are undoubtedly the most mainstream and widely used web development languages. 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 software as follows:

Mysql-4.0.15.tar.gz

Apache_1.3.28.tar.gz

Php-4.3.3.tar.gz

Resin-3.0.3.tar.gz

Mysql-connector-java-3.1.0-alpha.tar.gz

J2sdk-1_4_2_01-linux-i586.bin

First, install MySQL

The installation of MySQL is relatively simple, but the compilation process can be a bit long, with the following steps:

# tar-xzpvf mysql-4.0.15.tar.gz

# adduser-s / bin/false mysql

#. / configure-prefix=/usr/local/terry_yu/mysql-enable-assembler

-with-innodb-with-charset=gb2312

# make

# make install

# / usr/local/terry_yu/mysql/bin/mysql_install_db

# chown-R root / usr/local/terry_yu/mysql/

# chown-R mysql/ usr/local/terry_yu/mysql/var

# chgrp-R mysql/ usr/local/terry_yu/mysql/

# / usr/local/terry_yu/mysql/bin/mysql_install_db

Modify / etc/ld.so.conf by adding the following line at the end:

/ usr/local/terry_yu/mysql/lib/mysql/lib

Then execute the following command:

# ldconfig

Start MySQL with the following command

/ usr/local/terry_yu/mysql/bin/mysqld_safe &

Change the root password for MySQL with the following command:

/ usr/local/terry_yu/mysql/bin/mysqladmin-uroot password abcdefg

You can enter the command line of MySQL with the following command:

[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 message indicates that MySQL has run successfully.

Second, install JDK

# chmod 755 j2sdk-1_4_2_01-linux-i586.bin

#. / j2sdk-1_4_2_01-linux-i586.bin

# mv j2sdk1.4.2_01/ / usr/local/terry_yu/

# cd / usr/local/terry_yu/

# ln-s j2sdk1.4.2_01/ jdk

# ln-s jdk/jre/ jre

# vi / etc/profile

JAVA_HOME=/usr/local/terry_yu/jdk

RESIN_HOME=/usr/local/terry_yu/resin

CLASSPATH=.:../$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$RESIN_HOME/lib:/usr/ local/terry_yu/jdbc

PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin

Log out of the current login environment, log in again, so that the environment variable you just set will take effect, and then test it 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 a similar message indicates that the JDK environment is ready. In fact, in the / etc/profile above, we set not only the environment variables for JDK, but also the environment variables for Resin and JDBC, which are necessary to install Resin later.

3. Install JDBC of MySQL

The relevant environment variables for MySQL's JDBC have been set previously, so the rest is just installed by the following command:

# tar-xzpvf mysql-connector-java-3.1.0-alpha.tar.gz

# mv mysql-connector-java-3.1.0-alpha / usr/local/terry_yu/

# cd / usr/local/terry_yu/

# ln-s mysql-connector-java-3.1.0-alpha/ jdbc

Fourth, install Apache

Http://apache.linuxforum.net/dist/httpd/apache_1.3.28.tar.gz

It should be noted that DSO support must be added when compiling apache. If not, 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

Take a look at the modules compiled into apache:

# / usr/local/terry_yu/apache/bin/httpd-l

Compiled-in modules:

Http_core.c

Mod_so.c

Seeing the above information shows that apache supports DSO mode. In this way, php and resin modules can be added in the way of DSO.

5. Install PHP

It's easy to install PHP. Let's install PHP first.

# 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

At this point, the study on "how to set up a Web server that supports JSP+PHP on Linux shelves" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Tags: Support commands environment services servers variables learning compilation information methods for websites software data databases more modules languages help applications Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL vpn Linux MariaDB Shulou Technology