centos6.9 安装 php 运行环境,php5.3.3、php-mcrypt、ZendGuardLoader、Apache、设置IP

cat /etc/redhat-release
CentOS release 6.9 (Final)
-- ----------------------------------------------------------------------
cat /proc/version
Linux localhost.localdomain 2.6.32-696.20.1.el6.x86_64 #1 SMP Fri Jan 26 17:51:45 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
-- ----------------------------------------------------------------------
php -version
PHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
-- ----------------------------------------------------------------------
mysql -V
mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
-- ----------------------------------------------------------------------
apachectl -v
Server version: Apache/2.2.15 (Unix)
Server built: Oct 19 2017 16:43:38
-- ----------------------------------------------------------------------
#find / -name 'httpd'
#/opt/sh/etc_config/httpd
#/etc/sysconfig/httpd
#/etc/rc.d/init.d/httpd
#/etc/httpd
#/etc/logrotate.d/httpd
#/usr/sbin/httpd
#/usr/lib64/httpd
#/var/run/httpd
#/var/log/httpd
#/var/lock/subsys/httpd
-- ----------------------------------------------------------------------
命令行模式
systemctl set-default multi-user.target
-- ----------------------------------------------------------------------
支持xshell
service sshd status
-- ----------------------------------------------------------------------
##### 开放端口 ##########
查看当前开放的端口
/etc/init.d/iptables status
service iptables status
设置端口
iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
iptables -I INPUT -p tcp --dport 9080 -j ACCEPT
iptables -I INPUT -p tcp --dport 9081 -j ACCEPT
保存设置
/etc/init.d/iptables save
service iptables save
重启使生效
/etc/init.d/iptables restart
service iptables restart
-- ----------------------------------------------------------------------
开机启动
ln -s /etc/init.d/sshd /etc/rc.d/rc3.d/S100ssh
ln -s /etc/init.d/mysqld /etc/rc.d/rc3.d/S100mysqld
ln -s /etc/init.d/httpd /etc/rc.d/rc3.d/S100httpd
-- ----------------------------------------------------------------------
静态IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0
添加以下内容
DEVICE=eth0
NAME=eth0
TYPE=Ethernet
BOOTPROTO=static
HWADDR=00:15:5D:00:7C:09
IPADDR=192.168.0.133
NETMASK=255.0.0.0
GATEWAY=192.168.0.1
ONBOOT=yes
DNS1=192.168.0.1

重启网络
service network restart
-- ----------------------------------------------------------------------
安装 php-mcrypt

rpm -ivh http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
yum repolist //查看是否已经有了 EPEL(Extra Packages for Enterprise Linux) 扩展包。如果有epel说明已经安装成功。
yum install php-mcrypt -y
service httpd restart
-- ----------------------------------------------------------------------
定时任务 crontab
cat /var/spool/cron/root
-- ----------------------------------------------------------------------
##### 设置mysql #####
mysql_secure_installation
service mysqld stop
service mysqld start
##### ##### ##########

# service mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root
mysql> use mysql;
mysql> grant all privileges on *.* to root@'%' identified by "111111";
-- mysql> update user set password=password("111111") where user='root';
mysql> flush privileges;
mysql> quit
# service mysqld restart
-- ----------------------------------------------------------------------
前提是SELinux 类型必须是targeted的:
cat /etc/selinux/config|grep SELINUXTYPE;
也可以直接把selinux禁用掉;
直接修改/etc/selinux/config找到SELINUX=enforcing 修改为SELINUX=disable,然后reboot即可。
一次性的执行命令setenforce 0,这样不用重启,也可以生效。
建议不要禁用SELinux,开启相关端口即可
-- ----------------------------------------------------------------------

mkdir /usr/zend
tar xvfz ZendGuardLoader-php-5.3-linux-glibc23-x86_64.tar.gz
cp ZendGuardLoader-php-5.3-linux-glibc23-x86_64 /usr/zend
cp /etc/php.ini /etc/php.ini.bak
vi /etc/php.ini

在最后位置添加以下内容
[Zend Guard]
zend_extension=/usr/zend/ZendGuardLoader.so
zend_loader.enable=1
zend_loader.disable_licensing=0
zend_loader.obfuscation_level_support=3
zend_loader.license_path=

-- ----------------------------------------------------------------------
service httpd restart

php log
php_errors.log
/root/php_errors.log

apache log
/var/log/httpd

-- ----------------------------------------------------------------------
groupadd apache //添加用户 apache
useradd --shell /sbin/nologin -g apache apache //添加用户组 apache
-- ----------------------------------------------------------------------
cd /data/www/
chown -R apache:apache .
-- ----------------------------------------------------------------------

猜你喜欢

转载自www.cnblogs.com/youjiao/p/12907508.html