LAMP与LNMP 杂

mysql5.6 等于mariadb10.0

缺少启动脚本的另外启动方式:
/usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql --datadir=/data/mysql &

数据库的关闭方式

killall mysqld 读写完再kill,安全
kill PID 直接kill

放置配置文件my.cnf不在默认的位置
1. 修改启动脚本/etc/init.d/mysqld设置:
定义conf=$basedir/my.cnf
2. 启动脚本start模块 添加conf路径
--defaults-file="$conf"

apache 版本历史

1.3
2.0
2.2
2.4 使用apr通用的函数库,忽略底层操作系统,让apache可以从linux移植到windows

apr, apr-util要编译安装

http编译参数:
–enable-so #模块就是so文件;
–enable-mods-shared=most #安装哪些so;

/usr/local/apache2.4/bin/httpd -M 安装后列出模块
static嵌入httpd中
shared模块式

php5.6/7.1编译参数(lamp中最后安装)
php是httpd其中一个模块
–with-apxs2 apache加载扩展模块的工具,所以要先安装apache,才能指定这个路径
–with-pdo-mysql --with-mysql --with-mysqli 让php支持mysql
其他都是php相应的模块

/usr/local/php-fpm/bin/php -m 列出模块

/usr/local/php-fpm/bin/php --ini 列出配置文件
/usr/local/php-fpm/bin/php -i info

libphp5.so #httpd中安装好php显示的模块名;
libphp7.so

apachectl命令;
apachectl -t
apachectl graceful 重新加载
AddType php

命令行ctrl r 按关键字选命令

php设置

disable functions
timezone Asia/Shanghai
error log 级别
浏览器显示错误设置

daemon是错误日志属主,httpd的进程属主是daemon
syntax error代表语法错误

openbasedir 需要/tmp不然上传图片这些操作有问题

增加php模块

redis模块
用于缓存

 wget https://codeload.github.com/phpredis/phpredis/zip/develop 
    file develop 
    mv develop phpredis-develop.zip
    yum install -y zip
    yum install -y unzip
   unzip phpredis-develop.zip 
   cd phpredis-develop
   /usr/local/php-fpm/bin/phpize 
  yum install -y autoconf
   /usr/local/php-fpm/bin/phpize 
   ./configure --with-php-config=/usr/local/php-fpm/bin/php-config 
   make
   make install
  /usr/local/php-fpm/bin/php -m
  /usr/local/php-fpm/bin/php -i |grep extension_dir
  vi /usr/local/php-fpm/etc/php.ini #增加 extension = redis.so    
  /usr/local/php-fpm/bin/php -m

源码包里有ext, 要增加模块,在模块目录里运行phpize
然后再编译
ini增加一行
extension

安装mariadb10.2.27后安装php5.6.39错误

make
/usr/local/src/php-5.6.39/ext/mysql/php_mysql.c: 在函数‘php_mysql_do_connect’中:
/usr/local/src/php-5.6.39/ext/mysql/php_mysql.c:725:36: 错误:‘MYSQL_PORT’未声明(在此函数内第一次使用)
  int hashed_details_length, port = MYSQL_PORT;
                                    ^
/usr/local/src/php-5.6.39/ext/mysql/php_mysql.c:725:36: 附注:每个未声明的标识符在其出现的函数内只报告一次
make: *** [ext/mysql/php_mysql.lo] 错误 1

要把MYSQL_PORT全部改成0,可以通过这个错误
------------------------------
In file included from /usr/local/src/php-5.6.39/ext/mysqli/mysqli.c:34:0:
/usr/local/src/php-5.6.39/ext/mysqli/php_mysqli_structs.h:82:21: fatal error: my_list.h: No such file or directory
 #include 

In file included from /usr/local/src/php-5.6.39/ext/mysqli/mysqli.c:34:0:
/usr/local/src/php-5.6.39/ext/mysqli/php_mysqli_structs.h:83:22: fatal error: m_string.h: No such file or directory
 #include 

In file included from /usr/local/src/php-5.6.39/ext/mysqli/php_mysqli_structs.h:83:0,
                 from /usr/local/src/php-5.6.39/ext/mysqli/mysqli.c:34:
/usr/local/mysql/include/mysql/m_string.h:37:28: fatal error: lex_string.h: No such file or directory
     #include "lex_string.h"

https://dev.mysql.com/doc/dev/mysql-server/8.0.11/m__string_8h_source.html
手动生成文件放进去目录/usr/local/mysql/include/mysql/放完一个,下一个依赖又出问题。

lamp php5.6与php7./configure参数有一点点区别

并没有研究太多apache的安装

lamp - php 5.6
./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

lamp - php 7
./configure --prefix=/usr/local/php7 --with-apxs2=/usr/local/apache2.4/bin/apxs --with-config-file-path=/usr/local/php7/etc --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-bz2 --with-openssl --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-mbstring --enable-sockets --enable-exif

针对mariadb的php./configure参数(php5和7都一样)

./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql5.6 --with-mysqli=/usr/local/mysql5.6/bin/mysql_config --with-pdo-mysql=/usr/local/mysql5.6 --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

针对mysql的php编译参数(php5和7都一样)

./configure --prefix=/usr/local/php-fpm --with-config-file-path=/usr/local/php-fpm/etc --enable-fpm --with-fpm-user=php-fpm --with-fpm-group=php-fpm --with-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-freetype-dir --with-iconv-dir --with-zlib-dir --with-mcrypt --enable-soap --enable-gd-native-ttf --enable-ftp --enable-mbstring --enable-exif --with-pear --with-curl --with-openssl

你可能感兴趣的:(linux,高级)