In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the CentOS 7 on the PHP5 how to install suPHP, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.
PHP on CentOS 7 runs as apache or nobody by default. In this way, due to the large permissions required to run PHP, there may be security risks and may be affected by other users of the server.
View the PHP information through phpinfo as follows:
Apache runs php
As you can see, PHP is currently running as part of Apache, rather than running a separate process for each script. If you want the PHP script to run as the current user instead of Apache, you can do so by deploying suPHP. Next, I'll show you how to install suPHP on CentOS 7.
First configure the environment required to install suphp:
Yum-y groupinstall 'Development Tools'
Yum-y install apr-devel
Yum-y install httpd-devel
Download the suphp installation package:
Mkdir temp
Cd temp
Wget http://suphp.org/download/suphp-0.7.2.tar.gz
Tar zxvf suphp-0.7.2.tar.gz
Download and install the suphp patch:
Wget-O patchingsuphp.patch https://www.webhostinghero.com/downloads/php/suphp.patch
Patch-Np1-d suphp-0.7.2 < patchingsuphp.patch
Cd suphp-0.7.2
Autoreconf-if
Run. / configure:
. / configure-- prefix=/usr/-- sysconfdir=/etc/-- with-apr=/usr
/ bin/apr-1-config-with-apache-user=apache-with-setid-mode=owner
-- with-logfile=/var/log/httpd/suphp_log
Compile and install:
Make
Make install
Create a suphp.conf under the Apache configuration directory
Vi / etc/httpd/conf.d/suphp.conf
And write:
LoadModule suphp_module modules/mod_suphp.so
Create a suphp.conf configuration file under the / etc directory:
Vi / etc/suphp.conf
And write the contents of the configuration file as follows:
[global]
; Path to logfile
Logfile=/var/log/httpd/suphp.log
; Loglevel
Loglevel=info
; User Apache is running as
Webserver_user=apache
; Path all scripts have to be in
Docroot=/
; Path to chroot () to before executing script
; chroot=/mychroot
; Security options
Allow_file_group_writeable=true
Allow_file_others_writeable=false
Allow_directory_group_writeable=true
Allow_directory_others_writeable=false
; Check wheter script is within DOCUMENT_ROOT
Check_vhost_docroot=true
; Send minor error messages to browser
Errors_to_browser=false
; PATH environment variable
Env_path=/bin:/usr/bin
; Umask to set, specify in octal notation
Umask=0077
; Minimum UID
Min_uid=100
; Minimum GID
Min_gid=100
[handlers]
; Handler for php-scripts
XMui httpdMutual suphp = "php:/usr/bin/php-cgi"
; Handler for CGI-scripts
XMuiSuphpMuthcgil = "executeParticipation self"
If you want the domainname directory to run as user user, change the directory owner attribute to user, as follows:
Chown-R [user]. [user] / var/www/html/ [domainname]
Finally, find the appropriate domain name in the Apache configuration file and open suphp:
SetHandler None
SuPHP_Engine on
SetHandler x-httpd-suphp
SuPHP_AddHandler x-httpd-suphp
Finally, restart the Apache file. Through the info.php test, you can find that the Server API running the domain name has changed from Apache to CGI/FastCGI, as shown in the following figure:
At this point, we have completed that CentOS is set up for a domain name access to run through suphp instead of the default Apache Handler. Other domain names need to be set, just follow the above steps.
Thank you for reading this article carefully. I hope the article "how to install suPHP on PHP5 on CentOS 7" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.