The unit needs a php project, but there is only one domain name. The server operating system is redhat 4.7 and tomcat has been deployed. It is impossible to redo or merge it, but it must share the same host. I thought of using apache http server. jk connected to tomcat, installed php and mysql, it took a lot of time, and finally succeeded, the records are as follows:
1. Redhat4.7 installs yum
Redhat4.7 does not have yum installed by default. It is indeed better to install software with yum than rpm. It’s convenient and you don’t have to worry about dependencies, but sometimes the package can’t be found.
Redhat5 has yum installed by default, just configure it directly
Download yum wget http://www.parallels.com.cn/downloads/Prima/Tools/yum_forAS4.tar.gz
Unzip tar xzvf yum_forAS4.tar. gz
Enter the directory cd yum_forAS4 #
Installation rpm -ivh *.rpm
cd /etc/yum.repos.d/
vi CentOS-Base.repo
# CentOS-Base.repo [base] name=CentOS-4.7 - Base - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/os/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #released updates [updates] name=CentOS-4.7 - Updates - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/updates/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #additional packages that may be useful [extras] name=CentOS-4.7 - Extras - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/extras/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #packages used/produced in the build but not released [addons] name=CentOS-4.7 - Addons - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/addons/$basearch/ gpgcheck=1 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #additional packages that extend functionality of existing packages [centosplus] name=CentOS-4.7 - Plus - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/centosplus/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4 #contrib - packages by Centos Users [contrib] name=CentOS-4.7 - Contrib - mirrors.ustc.edu.cn baseurl=http://vault.centos.org/4.7/contrib/$basearch/ gpgcheck=1 enabled=0 gpgkey=http://vault.centos.org/RPM-GPG-KEY-CentOS-4
yum makecache
yum is installed, you can use yum -y in the future install
2. Install apache, php, mysql
yum -y install httpd httpd-devel php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-mcrypt php-gd php-xml php-mbstring php-ldap php- pear php-xmlrpc mysql-connector-odbc mysql-devel libdbi-dbd-mysql
Install them all with one command. The php-mcrypt package is not installed. There will be a warning in phpMyAdmin, so install it.
Look for the following packages at http://rpm.pbone.net/:
libmcrypt-2.5.7-5.el4.i386.rpm
php-common-5.3.10-2.el4.remi.i386.rpm
php-mcrypt-4.3.9-1.el4.i386.rpm
Install the above package.
The apache configuration file is installed in /etc/httpd/conf, and the WEB directory is installed in /var/www/
Start: service httpd start
Stop: service httpd stop
mysql Start service mysqld start Stop service mysql stop
Set mysql account and password (omitted)
3. Compile and install tomcat connectors
wget tomcat-connectors-1.2.37-src.tar.gz
cd tomcat-connectors-1.2.37-src
cd native
Read the BUILDING.txt file carefully, as mentioned in the article If you need apxs, this program is installed in the httpd-devel package. To find the location of apxs, use
rpm -ql httpd-devel
...
/usr/sbin/apxs
...
In fact, apache http server can The executable files are placed in the /usr/sbin/ directory, which is in the PATH environment variable.
./configure --with-apxs=/usr/sbin/apxs
make
generated two directories, apache-1.3 and apache-2.0, in the current directory. We are using apache2.0
cd apache-2.0
cp mod_jk.so /etc/httpd/modules/
4. Configure jk.
(1) Create workers.properties configuration file
cd /etc/httpd/conf
vi workers.properties # Define 1 real worker using ajp13
worker.list=worker1
# Set properties for worker1 (ajp13)
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
Add the following line under the loading module paragraph
# Load mod_jk module # Update this path to match your modules location LoadModule jk_module modules/mod_jk.so # Where to find workers.properties # Update this path to match your conf directory location (put workers.properties next to httpd.conf) JkWorkersFile /etc/httpd/conf/workers.properties # Where to put jk shared memory # Update this path to match your local state directory or logs directory JkShmFile /var/log/httpd/mod_jk.shm # Where to put jk logs # Update this path to match your logs directory location (put mod_jk.log next to access_log) JkLogFile /var/log/httpd/mod_jk.log # Set the jk log level [debug/error/info] JkLogLevel info # Select the timestamp log format JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " # Send everything for context /examples to worker named worker1 (ajp13) JkMount /examples/* worker1Restart apache
Test:
It can be accessed through the tomcat port, and the same content can also be accessed through the apache port.
If you use a firewall, remember to open port 8009 of lo
-A INPUT -i lo -p tcp -m tcp --dport 8009 -j ACCEPT
Okay, put it here, and you won’t be unable to find it next time you configure it .

Thedifferencebetweenunset()andsession_destroy()isthatunset()clearsspecificsessionvariableswhilekeepingthesessionactive,whereassession_destroy()terminatestheentiresession.1)Useunset()toremovespecificsessionvariableswithoutaffectingthesession'soveralls

Stickysessionsensureuserrequestsareroutedtothesameserverforsessiondataconsistency.1)SessionIdentificationassignsuserstoserversusingcookiesorURLmodifications.2)ConsistentRoutingdirectssubsequentrequeststothesameserver.3)LoadBalancingdistributesnewuser

PHPoffersvarioussessionsavehandlers:1)Files:Default,simplebutmaybottleneckonhigh-trafficsites.2)Memcached:High-performance,idealforspeed-criticalapplications.3)Redis:SimilartoMemcached,withaddedpersistence.4)Databases:Offerscontrol,usefulforintegrati

Session in PHP is a mechanism for saving user data on the server side to maintain state between multiple requests. Specifically, 1) the session is started by the session_start() function, and data is stored and read through the $_SESSION super global array; 2) the session data is stored in the server's temporary files by default, but can be optimized through database or memory storage; 3) the session can be used to realize user login status tracking and shopping cart management functions; 4) Pay attention to the secure transmission and performance optimization of the session to ensure the security and efficiency of the application.

PHPsessionsstartwithsession_start(),whichgeneratesauniqueIDandcreatesaserverfile;theypersistacrossrequestsandcanbemanuallyendedwithsession_destroy().1)Sessionsbeginwhensession_start()iscalled,creatingauniqueIDandserverfile.2)Theycontinueasdataisloade

Absolute session timeout starts at the time of session creation, while an idle session timeout starts at the time of user's no operation. Absolute session timeout is suitable for scenarios where strict control of the session life cycle is required, such as financial applications; idle session timeout is suitable for applications that want users to keep their session active for a long time, such as social media.

The server session failure can be solved through the following steps: 1. Check the server configuration to ensure that the session is set correctly. 2. Verify client cookies, confirm that the browser supports it and send it correctly. 3. Check session storage services, such as Redis, to ensure that they are running normally. 4. Review the application code to ensure the correct session logic. Through these steps, conversation problems can be effectively diagnosed and repaired and user experience can be improved.

session_start()iscrucialinPHPformanagingusersessions.1)Itinitiatesanewsessionifnoneexists,2)resumesanexistingsession,and3)setsasessioncookieforcontinuityacrossrequests,enablingapplicationslikeuserauthenticationandpersonalizedcontent.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
