设为首页 收藏本站
查看: 675|回复: 0

[经验分享] RedHat Enterprise AS 5+SELinux---LAMP

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2018-5-11 10:02:32 | 显示全部楼层 |阅读模式
  Install LAMP
  编译环境:RedHat Enterprise AS 5.1 开启SELlinux(我个人认为,它既然被REDHAT用上了,肯定就有它的道理,没有理由关掉它啊,嘿嘿)
  安装所需要的软件均为最新的源代码包:
  GD及库相关
  curl-7.17.1.tar.gz     libpng-1.2.24.tar.bz2   zlib-1.2.3.tar.gz
  freetype-2.3.5.tar.gz  libxslt-1.1.22.tar.gz   jpegsrc.v6b.tar.gz
  gd-2.0.36RC1.tar.bz2   libxml2-2.6.30.tar.gz
  PHP相关软件
  phpMyAdmin-2.11.3-all-languages.tar.bz2
  php-5.2.5.tar.bz2
  suhosin-patch-5.2.5-0.9.6.2.patch
  ZendOptimizer-3.3.0-linux-glibc21-i386.tar.gz
  APACHE相关软件
  httpd-2.2.6.tar.bz2
  mysql相关软件
  mysql-5.1.22-rc.tar.gz
  一、安装GD库及其它库文件
  1.install zlib
  tar xzvf  zlib-1.2.3.tar.gz
  cd  zlib-1.2.3
  ./configure
  make
  make install
  2. install libpng
  tar xjvf libpng-1.2.24.tar.bz2
  cd libpng-1.2.24
  cp ./scripts/makefile.std makefile
  make
  make install
  3.install freetype
  tar xzvf freetype-2.3.5.tar.gz
  cd freetype-2.3.5
  ./configure
  make
  make install
  4.install jpeg
  tar xzvf jpegsrc.v6b.tar.gz
  cd jpeg-6b
  mkdir -p /usr/local/man/man1
  ./configure --enable-shared --enable-static
  make
  make install
  5.install curl
  tar xzvf curl-7.17.1.tar.gz
  cd curl-7.17.1
  ./configure
  make
  make install
  6.install libxml2
  tar xzvf libxml2-2.6.30.tar.gz
  cd libxml2-2.6.30
  ./configure
  make
  make install
  7.install libxslt
  tar xzvf libxslt-1.1.22.tar.gz
  cd libxslt-1.1.22
  ./configure --with-libxml
  make
  make install
  8.install gd
  tar xjvf gd-2.0.36RC1.tar.bz2
  cd gd-2.0.36RC1
  ./configure --jpeg --with-png --with-zlib --with-freetype
  make
  make install
  二、安装mysql数据库
[root@Kevin soft]# mkdir /httpd

[root@Kevin soft]# tar xzvf mysql-5.1.22-rc.tar.gz

[root@Kevin soft]# cd mysql-5.1.22-rc

[root@Kevin mysql-5.1.22-rc]# groupadd mysql

[root@Kevin mysql-5.1.22-rc]# useradd -g mysql mysql

[root@Kevin mysql-5.1.22-rc]#  ./configure \

  > --prefix=/httpd/mysql --sysconfdir=/httpd/mysql --enable-assembler \
  > --with-unix-socket-path=/tmp/mysql.sock --with-mysqld-user=mysql \
  > --with-mysqld-ldflags=-a-static --with-innodb --with-extra-charsets=all \
  > --with- --with-collation=gb2312_chinese_ci \
  > --enable-thread-safe-client
[root@Kevin mysql-5.1.22-rc]# make

[root@Kevin mysql-5.1.22-rc]# make install

[root@Kevin mysql-5.1.22-rc]# cp support-files/my-medium.cnf /etc/my.cnf

[root@Kevin mysql-5.1.22-rc]# ./scripts/mysql_install_db --user=mysql

  Installing MySQL system tables...
  OK
  Filling help tables...
  OK
  To start mysqld at boot time you have to copy
  support-files/mysql.server to the right place for your system
  PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
  To do so, start the server, then issue the following commands:
  /httpd/mysql/bin/mysqladmin -u root password 'new-password'
  /httpd/mysql/bin/mysqladmin -u root -h Kevin password 'new-password'
  See the manual for more instructions.
  You can start the MySQL daemon with:
  cd /httpd/mysql ; /httpd/mysql/bin/mysqld_safe &
  You can test the MySQL daemon with mysql-test-run.pl
  cd mysql-test ; perl mysql-test-run.pl
  Please report any problems with the /httpd/mysql/bin/mysqlbug script!
  The latest information about MySQL is available on the web at
  http://www.mysql.com
  Support MySQL by buying support/licenses at http://shop.mysql.com
[root@Kevin mysql-5.1.22-rc]#cd /httpd/mysql

[root@Kevin mysql]# chown -R root .

[root@Kevin mysql]# chown -R mysql var

[root@Kevin mysql]# chown -R mysql var/.

[root@Kevin mysql]# chown -R mysql var/mysql/.

[root@Kevin mysql]# chgrp -R mysql .

[root@Kevin mysql]#cd /soft/mysql-5.1.22-rc

[root@Kevin mysql-5.1.22-rc]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld

[root@Kevin mysql-5.1.22-rc]# chmod 700 /etc/rc.d/init.d/mysqld

[root@Kevin mysql-5.1.22-rc]# chkconfig --add mysqld

[root@Kevin mysql-5.1.22-rc]# chmod +x /etc/rc.d/init.d/mysqld

[root@Kevin mysql-5.1.22-rc]# /httpd/mysql/bin/mysqld_safe --user=mysql &

[1] 5321

[root@Kevin mysql-5.1.22-rc]# 071223 09:12:27 mysqld_safe Logging to

  '/httpd/mysql/var/Kevin.err'.
  071223 09:12:28 mysqld_safe Starting mysqld daemon with databases from
  /httpd/mysql/var
  kconfig --level 345 mysqld on
[root@Kevin mysql-5.1.22-rc]# service mysqld stop

  Shutting down MySQL..071223 09:18:54 mysqld_safe mysqld from pid file
  /httpd/mysql/var/Kevin.pid ended
[  OK  ]

[1]+  Done                    /httpd/mysql/bin/mysqld_safe --user=mysql

  ln -s /httpd/mysql/bin/mysql /sbin/mysql
[root@Kevin mysql-5.1.22-rc]# ln -s /httpd/mysql/bin/mysqladmin /sbin/mysqladmin

[root@Kevin mysql-5.1.22-rc]#  PATH=&PATH:/httpd/mysql/bin

[1] 25129

  bash: PATH:/httpd/mysql/bin: No such file or directory
[1]+  Done                    PATH=

[root@Kevin mysql-5.1.22-rc]# export PATH

[root@Kevin mysql-5.1.22-rc]# echo "/httpd/mysql/lib/mysql" >> /etc/ld.so.conf

[root@Kevin mysql-5.1.22-rc]# ldconfig

  edit the file /etc/my.cnf
[root@Kevin mysql-5.1.22-rc]# vi /etc/my.cnf

  add this two line under the [mysqld]
  log = /var/log/mysqld/log.log
  and touch the file
[root@Kevin mysql-5.1.22-rc]# mkdir /var/log/mysqld

[root@Kevin mysql-5.1.22-rc]# touch /var/log/mysqld/log.log

[root@Kevin mysql-5.1.22-rc]# chown -R mysql.mysql /var/log/mysqld

[root@Kevin mysql-5.1.22-rc]# service mysqld start

  Starting MySQL.                                            [  OK  ]
[root@Kevin mysql-5.1.22-rc]#

  set password for mysql root
[root@Kevin mysql-5.1.22-rc]# mysqladmin -u root -p password 'password'

  insert the root password before , push enter
  三、安装APACHE服务器
[root@Kevin soft]# tar xjvf httpd-2.2.6.tar.bz2

[root@Kevin soft]# cd httpd-2.2.6

[root@Kevin httpd-2.2.6]#  ./configure --prefix=/httpd/apache --enable-so --enable-track-vars

  --enable-mods-shared=all --enable-cache --enable-disk-cache --enable-mem-cache
  --enable-rewrite --with-mpm=worker --enable-ssl --with-zlib --enable-suexec
  --with-suexec-caller=daemon
[root@Kevin httpd-2.2.6]# make

[root@Kevin httpd-2.2.6]# make install

[root@Kevin httpd-2.2.6]# cp support/apachectl /etc/rc.d/init.d/httpd

  edit the file /etc/rc.d/init.d/httpd  and add this in it
[root@Kevin httpd-2.2.6]# vim /etc/rc.d/init.d/httpd

  # Startup script for the Apache Web Server
  # chkconfig: 2345 85 15
  # description: Apache is a World Wide Web server .It is used to server
  # HTML files and CGI.
  # processname: httpd
  # pidfile: /httpd/apache/log/httpd.pid
  # config: /httpd/apache/conf/httpd.conf
[root@Kevin httpd-2.2.6]# chkconfig --add httpd

[root@Kevin httpd-2.2.6]# chmod 755 /etc/rc.d/init.d/httpd

[root@Kevin httpd-2.2.6]# chkconfig --level 345 httpd on

[root@Kevin httpd-2.2.6]# vim /httpd/apache/conf/httpd.conf

[root@Kevin httpd-2.2.6]# service httpd start

  httpd: Syntax error on line 75 of /httpd/apache/conf/httpd.conf: Cannot load
  /httpd/apache/modules/mod_deflate.so into server:

  /httpd/apache/modules/mod_deflate.so: cannot restore segment prot after>  Permission denied
  提示这个错误是因为我开启了SELINUX,解决方法如下:(后面也会出现这种问题,按照同样的方法解决即可)
[root@Kevin ~]# tail /var/log/message

  日志提示信息如下:
  Dec 23 10:32:52 Kevin setroubleshoot:      SELinux is preventing
  /httpd/apache/bin/httpd from loading /httpd/apache/modules/mod_deflate.so

  which requires text>  sealert -l dea1fd12-6af0-493c-9767-e76b9d8bd3b3
  其中For complete SELinux messages.run …… 意思就是说为了完成SELlinux,运行后面的命令
  然后我们运行日志里提示的命令,再从中找有用的信息。
[root@Kevin httpd-2.2.6]# sealert -l dea1fd12-6af0-493c-9767-e76b9d8bd3b3

  Summary
  SELinux is preventing /httpd/apache/bin/httpd from loading

  /httpd/apache/modules/mod_deflate.so which requires text>  Detailed Description
  The /httpd/apache/bin/httpd application attempted to load

  /httpd/apache/modules/mod_deflate.so which requires text>  is a potential security problem. Most libraries do not need this
  permission.
  Libraries are sometimes coded incorrectly and request this permission.
  The
  http://people.redhat.com/drepper/selinux-mem.html web page explains how to
  remove this requirement.  You can configure SELinux temporarily to allow

  /httpd/apache/modules/mod_deflate.so to use>  until the library is fixed. Please file a
  http://bugzilla.redhat.com/bugzilla/enter_bug.cgi against this package.
  Allowing Access
  If you trust /httpd/apache/modules/mod_deflate.so to run correctly, you
  can
  change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
  /httpd/apache/modules/mod_deflate.so"
  The following command will allow this access:
  chcon -t textrel_shlib_t /httpd/apache/modules/mod_deflate.so
  上面这一段,Allowing Acces意思就是说允许访问(因为最开始的时候是提示权限拒绝),
  这正是我们要找的内容 ,继续往下看,如果你相信,mod_deflate.so是可信的,你可以
  改变这个文件的context为textrel_shlib_t.,用chcon -t textrel_shlib_t /httpd/apache/
  modules/mod_deflate.so 这个命令。
  用下面的命令将会允许这个访问:chcon -t textrel_shlib_t /httpd/apache/modules/mod_deflate.so
  Additional Information
  Source Context                root:system_r:unconfined_t:SystemLow-SystemHigh
  Target Context                root:object_r:etc_runtime_t
  Target Objects                /httpd/apache/modules/mod_deflate.so [ file ]
  Affected RPM Packages
  Policy RPM                    selinux-policy-2.4.6-104.el5
  Selinux Enabled               True
  Policy Type                   targeted
  MLS Enabled                   True
  Enforcing Mode                Enforcing
  Plugin Name                   plugins.allow_execmod
  Host Name                     Kevin
  Platform                      Linux Kevin 2.6.18-53.el5xen #1 SMP Wed Oct 10
  17:06:12 EDT 2007 i686 i686
  Alert Count                   1
  Line Numbers
  Raw Audit Messages
  avc: denied { execmod } for comm="httpd" dev=sda2 egid=0 euid=0
  exe="/httpd/apache/bin/httpd" exit=-13 fsgid=0 fsuid=0 gid=0 items=0
  path="/httpd/apache/modules/mod_deflate.so" pid=23414
  scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 sgid=0
  subj=root:system_r:unconfined_t:s0-s0:c0.c1023 suid=0 tclass=file
  tcontext=root:object_r:etc_runtime_t:s0 tty=pts0 uid=0
[root@Kevin httpd-2.2.6]# chcon -t textrel_shlib_t /httpd/apache/modules/mod_deflate.so

  再重新启动APACHE服务,又有一个同样的问题出现了,这次是mod_ssl.so,解决方法同上,我也
  把信息贴出来。
[root@Kevin httpd-2.2.6]# service httpd start

  httpd: Syntax error on line 89 of /httpd/apache/conf/httpd.conf: Cannot load
  /httpd/apache/modules/mod_ssl.so into server:

  /httpd/apache/modules/mod_ssl.so: cannot restore segment prot after>  Permission denied
[root@Kevin ~]# tail /var/log/message

  Dec 23 10:35:52 Kevin setroubleshoot:      SELinux is preventing
  /httpd/apache/bin/httpd from loading /httpd/apache/modules/mod_ssl.so which

  requires text>  013a3462-7caf-4619-a80c-4c3863537004
[root@Kevin httpd-2.2.6]# sealert -l 013a3462-7caf-4619-a80c-4c3863537004

  Summary
  SELinux is preventing /httpd/apache/bin/httpd from loading

  /httpd/apache/modules/mod_ssl.so which requires text>  Detailed Description
  The /httpd/apache/bin/httpd application attempted to load

  /httpd/apache/modules/mod_ssl.so which requires text>  a
  potential security problem. Most libraries do not need this permission.
  Libraries are sometimes coded incorrectly and request this permission.
  The
  http://people.redhat.com/drepper/selinux-mem.html web page explains how to
  remove this requirement.  You can configure SELinux temporarily to allow

  /httpd/apache/modules/mod_ssl.so to use>  the library is fixed. Please file a
  http://bugzilla.redhat.com/bugzilla/enter_bug.cgi against this package.
  Allowing Access
  If you trust /httpd/apache/modules/mod_ssl.so to run correctly, you can
  change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
  /httpd/apache/modules/mod_ssl.so"
  The following command will allow this access:
  chcon -t textrel_shlib_t /httpd/apache/modules/mod_ssl.so
  Additional Information
  Source Context                root:system_r:unconfined_t:SystemLow-SystemHigh
  Target Context                root:object_r:etc_runtime_t
  Target Objects                /httpd/apache/modules/mod_ssl.so [ file ]
  Affected RPM Packages
  Policy RPM                    selinux-policy-2.4.6-104.el5
  Selinux Enabled               True
  Policy Type                   targeted
  MLS Enabled                   True
  Enforcing Mode                Enforcing
  Plugin Name                   plugins.allow_execmod
  Host Name                     Kevin
  Platform                      Linux Kevin 2.6.18-53.el5xen #1 SMP Wed Oct 10
  17:06:12 EDT 2007 i686 i686
  Alert Count                   1
  Line Numbers
  Raw Audit Messages
  avc: denied { execmod } for comm="httpd" dev=sda2 egid=0 euid=0
  exe="/httpd/apache/bin/httpd" exit=-13 fsgid=0 fsuid=0 gid=0 items=0
  path="/httpd/apache/modules/mod_ssl.so" pid=23436
  scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 sgid=0
  subj=root:system_r:unconfined_t:s0-s0:c0.c1023 suid=0 tclass=file
  tcontext=root:object_r:etc_runtime_t:s0 tty=pts0 uid=0
[root@Kevin httpd-2.2.6]# chcon -t textrel_shlib_t /httpd/apache/modules/mod_ssl.so

[root@Kevin httpd-2.2.6]# service httpd start

[root@Kevin httpd-2.2.6]#

  OK,可以看到成功启动了。不信还可以用命令查看一下httpd的进程
[root@Kevin httpd-2.2.6]# ps -ef | grep httpd

  看看有没有相关的进程,如果没有,我说如果,那就看看日志里说什么,根据日志来判断问题所在,进而解决。
  -------------------------------------------------------------------------------------------------
  四、安装PHP
[root@Kevin soft]# gunzip suhosin-patch-5.25-0.9.6.2.patch.gz

[root@Kevin soft]# tar xjvf php-5.2.5.tar.bz2

[root@Kevin php-5.2.5]# patch -p1 < ../suhosin-patch-5.2.5-0.9.6.2.patch

[root@Kevin php-5.2.5]#  ./configure --prefix=/httpd/php --with-apxs2=/httpd/apache/bin/apxs \

  > --with-mysql=/httpd/mysql --with-curl --enable-ftp \
  > --with-libxml-dir --enable-soap --with-xsl --with-gd --with-jpeg-dir --with-zlib \
  > --with-freetype-dir --enable-mbstring --with-iconv --disable-ipv6 \
  > --with-mysql-sock=/tmp/mysql.sock --enable-magic-quotes \
  > --enable-force-cgi-redirect --enable-short-tags --disable-debug
[root@Kevin php-5.2.5]# make

  Build complete.
  Don't forget to run 'make test'.
[root@Kevin php-5.2.5]# make test

  这个过程会报错,不过没关系,继续
[root@Kevin php-5.2.5]# make install

  同样出现上面的SELunix的问题,同样的方法解决
  /soft/php-5.2.5/sapi/cli/php: error while loading shared libraries:

  /usr/local/lib/libxslt.so.1: cannot restore segment prot after>  Permission denied
  /soft/php-5.2.5/sapi/cli/php: error while loading shared libraries:

  /usr/local/lib/libxslt.so.1: cannot restore segment prot after>  Permission denied
  make: [test] Error 127 (ignored)
[root@Kevin ~]# tail /var/log/messages

  Dec 23 12:23:56 Kevin setroubleshoot:      SELinux is preventing
  /soft/php-5.2.5/sapi/cli/php from loading /usr/local/lib/libxslt.so.1.1.22

  which requires text>  sealert -l 732b8a74-391c-4243-8474-3bfc7aa88fee
[root@Kevin php-5.2.5]# sealert -l 732b8a74-391c-4243-8474-3bfc7aa88fee

  Summary
  SELinux is preventing /soft/php-5.2.5/sapi/cli/php from loading

  /usr/local/lib/libxslt.so.1.1.22 which requires text>  Detailed Description
  The /soft/php-5.2.5/sapi/cli/php application attempted to load

  /usr/local/lib/libxslt.so.1.1.22 which requires text>  a
  potential security problem. Most libraries do not need this permission.
  Libraries are sometimes coded incorrectly and request this permission.
  The
  http://people.redhat.com/drepper/selinux-mem.html web page explains how to
  remove this requirement.  You can configure SELinux temporarily to allow

  /usr/local/lib/libxslt.so.1.1.22 to use>  the library is fixed. Please file a
  http://bugzilla.redhat.com/bugzilla/enter_bug.cgi against this package.
  Allowing Access
  If you trust /usr/local/lib/libxslt.so.1.1.22 to run correctly, you can
  change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
  /usr/local/lib/libxslt.so.1.1.22"
  The following command will allow this access:
  chcon -t textrel_shlib_t /usr/local/lib/libxslt.so.1.1.22
  Additional Information
  Source Context                root:system_r:unconfined_t:SystemLow-SystemHigh
  Target Context                system_u:object_r:lib_t
  Target Objects                /usr/local/lib/libxslt.so.1.1.22 [ file ]
  Affected RPM Packages
  Policy RPM                    selinux-policy-2.4.6-104.el5
  Selinux Enabled               True
  Policy Type                   targeted
  MLS Enabled                   True
  Enforcing Mode                Enforcing
  Plugin Name                   plugins.allow_execmod
  Host Name                     Kevin
  Platform                      Linux Kevin 2.6.18-53.el5xen #1 SMP Wed Oct 10
  17:06:12 EDT 2007 i686 i686
  Alert Count                   2
  Line Numbers
  Raw Audit Messages
  avc: denied { execmod } for comm="php" dev=sda2 egid=0 euid=0
  exe="/soft/php-5.2.5/sapi/cli/php" exit=-13 fsgid=0 fsuid=0 gid=0 items=0
  path="/usr/local/lib/libxslt.so.1.1.22" pid=11348
  scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 sgid=0
  subj=root:system_r:unconfined_t:s0-s0:c0.c1023 suid=0 tclass=file
  tcontext=system_u:object_r:lib_t:s0 tty=pts0 uid=0
[root@Kevin php-5.2.5]# chcon -t textrel_shlib_t /usr/local/lib/libxslt.so.1.1.22

[root@Kevin php-5.2.5]# make install

  安装成功
[root@Kevin php-5.2.5]# cp php.ini-dist /httpd/apache/conf/php.ini

[root@Kevin php-5.2.5]# vim /httpd/apache/conf/php.ini

  ;default_charset = "iso-8859-1"
  在这行下面加一行
  default_charset = "gbk"
  配置apache
[root@Kevin php-5.2.5]# vim /httpd/apache/conf/httpd.conf

  找到#AddType application/x-tar .tgz 这行,在下面加两行。
  AddType application/x-httpd-php .php
  AddType application/x-httpd-php-source .phps
  找到下面一行
  <IfModule dir_module>
  DirectoryIndex index.html
  </IfModule>
[root@Kevin php-5.2.5]# service httpd restart

  在安装好PHP重新加载APACHE服务的时候又出现了同样的问题,同样的方法解决
  httpd: Syntax error on line 108 of /httpd/apache/conf/httpd.conf: Cannot load
  /httpd/apache/modules/libphp5.so into server:

  /httpd/apache/modules/libphp5.so: cannot restore segment prot after>  Permission denied
[root@Kevin ~]# tail /var/log/messages

  Dec 23 13:11:05 Kevin setroubleshoot:      SELinux is preventing
  /httpd/apache/bin/httpd from loading /httpd/apache/modules/libphp5.so which

  requires text>  sealert -l4568ea8d-d6f7-47f2-9b9a-2611e15833dc
[root@Kevin php-5.2.5]# sealert -l 4568ea8d-d6f7-47f2-9b9a-2611e15833dc

  Summary
  SELinux is preventing /httpd/apache/bin/httpd from loading

  /httpd/apache/modules/libphp5.so which requires text>  Detailed Description
  The /httpd/apache/bin/httpd application attempted to load

  /httpd/apache/modules/libphp5.so which requires text>  a
  potential security problem. Most libraries do not need this permission.
  Libraries are sometimes coded incorrectly and request this permission.
  The
  http://people.redhat.com/drepper/selinux-mem.html web page explains how to
  remove this requirement.  You can configure SELinux temporarily to allow

  /httpd/apache/modules/libphp5.so to use>  the library is fixed. Please file a
  http://bugzilla.redhat.com/bugzilla/enter_bug.cgi against this package.
  Allowing Access
  If you trust /httpd/apache/modules/libphp5.so to run correctly, you can
  change the file context to textrel_shlib_t. "chcon -t textrel_shlib_t
  /httpd/apache/modules/libphp5.so"
  The following command will allow this access:
  chcon -t textrel_shlib_t /httpd/apache/modules/libphp5.so
  Additional Information
  Source Context                root:system_r:unconfined_t:SystemLow-SystemHigh
  Target Context                root:object_r:etc_runtime_t
  Target Objects                /httpd/apache/modules/libphp5.so [ file ]
  Affected RPM Packages
  Policy RPM                    selinux-policy-2.4.6-104.el5
  Selinux Enabled               True
  Policy Type                   targeted
  MLS Enabled                   True
  Enforcing Mode                Enforcing
  Plugin Name                   plugins.allow_execmod
  Host Name                     Kevin
  Platform                      Linux Kevin 2.6.18-53.el5xen #1 SMP Wed Oct 10
  17:06:12 EDT 2007 i686 i686
  Alert Count                   1
  Line Numbers
  Raw Audit Messages
  avc: denied { execmod } for comm="httpd" dev=sda2 egid=0 euid=0
  exe="/httpd/apache/bin/httpd" exit=-13 fsgid=0 fsuid=0 gid=0 items=0
  path="/httpd/apache/modules/libphp5.so" pid=10571
  scontext=root:system_r:unconfined_t:s0-s0:c0.c1023 sgid=0
  subj=root:system_r:unconfined_t:s0-s0:c0.c1023 suid=0 tclass=file
  tcontext=root:object_r:etc_runtime_t:s0 tty=pts0 uid=0
[root@Kevin php-5.2.5]# chcon -t textrel_shlib_t /httpd/apache/modules/libphp5.so

[root@Kevin php-5.2.5]# service httpd restart

  OK,成功
  写个测试页面
  vi /www/index.php
  <?
  phpinfo();
  ?>
  打开网站http://localhost结果变成了下载PHP文件了
  修改/httpd/apache/conf/httpd.conf
  AddType application/x-httpd-php .php .php5
[root@Kevin php-5.2.5]# service httpd restart

  OK
  用 http://loclahost/index.php or http://localhost 测试你的php and apache
  五、安装;zend and phpadmin
  1.install zendoptimizer
[root@Kevin soft]# tar xzvf ZendOptimizer-3.3.0-linux-glibc21-i386.tar.gz

[root@Kevin php-5.2.5]# cd ZendOptimizer-3.3.0-linux-glibc21-i386

[root@Kevin ZendOptimizer-3.3.0-linux-glibc21-i386]# ./install.sh

[ok]->[exit]->[yes]->[/httpd/zend]->[/httpd/apache/conf]->[yes]->[/httpd/apache/bin/apachectl]->

[ok]->[ok]->[no]

  这个我是在图形界面下安装的,就没有截图了,基本的顺序就是这样子的。
  use http://localhost/index.php or http://localhost test the zend program.
  2.install phpMyadmin
[root@Kevin soft]# tar xjvf phpMyAdmin-2.11.3-all-languages.tar.gz

[root@Kevin php-5.2.5]# cp -rf phpMyAdmin-2.11.3-all-languages /www/phpmyadmin

[root@Kevin php-5.2.5]# cp config.sample.inc.php config.inc.php

[root@Kevin php-5.2.5]# vim config.inc.php

  phpMyadmin可以各人发挥了,每个人的需求不一样,所以配置肯定也不一样了。以下是我的配置:
  CODE:
[Copy to clipboard]

  $cfg['blowfish_secret'] = 'cookie'; (使用cookie加密)
  CODE:
[Copy to clipboard]

  $cfg['Servers'][$i]['connect_type']  = 'socket';  (以socket方式连接MySQL)
  CODE:
[Copy to clipboard]

  $cfg['Servers'][$i]['compress']      = TRUE; (启用压缩以提高速度,如果访问不正常请改回FALSE)
  CODE:
[Copy to clipboard]

  $cfg['Servers'][$i]['auth_type']     = 'cookie'; (使用cookie进行身份验证)
  visite http://localhost/phpmyadmin
  用mysql的root登陆,前面我们为root设置了密码的,如果不设置密码,用空密码登陆也会出现一个警告吧 算是,你
  用密码登陆就没有问题了。
  还有一个提示错误,可能是php高版本的问题,需要用到mcrypt,我在前面没有安装,有时间我再做一次吧。
  错误提示信息如下:
  Cannot load mcrypt extension. Please check your PHP configuration.
  因为之前没有安装mcrypt,在编译php的时候也没有--with-mcrypt
  所以现在出现这个错误了。如果要解决只有重新编译mcrypt and php (网上没有找到答案。。。。。。)
  这个问题我在网上找了很多资料,以及google,没有找到答案,如果有人知道怎么弄的话,请告诉我,谢谢!!
  这样就不用重新编译了。

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-458486-1-1.html 上篇帖子: redhat基本命令 下篇帖子: RedHat5.9下搭建DHCP服务器
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表