美文网首页
apache + php安装过程

apache + php安装过程

作者: 与狼共舞666 | 来源:发表于2022-08-23 15:22 被阅读0次
    实验所用安装包为:
    apr-1.7.0.tar.gz
    apr-util-1.6.1.tar.gz
    pcre-8.45.tar.gz
    httpd-2.4.54.tar.gz
    php-7.4.30.tar.gz
    

    1、解压 httpd-2.4.54.tar.gz,在解压后的httpd-2.4.54/srclib目录中拷贝apr-1.7.0.tar.gz apr-1.7.0.tar.gz,解压后的目录名为 apr apr-util ( if you need to use the APR and APR-Util from the apr.apache.org project. If the latter, download the latest versions and unpack them to ./srclib/apr and ./srclib/apr-util (no version numbers in the directory names) and use ./configure's --with-included-apr option.)
    2、安装pcre,按照常规安装流程./configure --prefix=/usr/local/pcre && make && make install
    3、安装apache ./configure --prefix=/usr/local/httpd --with-included-apr --with-pcre=/usr/local/pcre/bin/pcre-config
    4、安装php依赖包 (yum -y install libxml2 libxml2-devel sqlite-devel)并 ./configure -with-config-file-path=/usr/local/php/etc --prefix=/usr/local/php (最简化的安装,甚至是不支持mysql数据库的连接,只是为了演示)
    详细安装:

    === 安装路径 ===
    --prefix=/usr/local/php \
    
    === php.ini 配置文件路径 ===
    --with-config-file-path=/usr/local/php/etc \
    
    === 指定apache文件路径,生成apache对php支持模块libphp5.so的关键,不装apache可把这项去掉 ===
    --with-apxs2=/usr/local/apache/bin/apxs \
    
    === 优化选项 ===
    --enable-inline-optimization \
    --disable-debug \
    --disable-rpath \
    --enable-shared \
    
    === 启用 opcache,默认为 ZendOptimizer+(ZendOpcache) ===
    --enable-opcache \
    
    === FPM ===
    --enable-fpm \
    --with-fpm-user=www \
    --with-fpm-group=www \
    
    === MySQL ===
    --with-mysql=mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    
    === 国际化与字符编码支持 ===
    --with-gettext \
    --enable-mbstring \
    --with-iconv \
    
    === 加密扩展 ===
    --with-mcrypt \
    --with-mhash \
    --with-openssl \
    
    === 数学扩展 ===
    --enable-bcmath \
    
    === Web 服务,soap 依赖 libxml ===
    --enable-soap \
    --with-libxml-dir \
    
    === 进程,信号及内存 ===
    --enable-pcntl \
    --enable-shmop \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    
    === socket & curl ===
    --enable-sockets \
    --with-curl \
    
    === 压缩与归档 ===
    --with-zlib \
    --enable-zip \
    --with-bz2 \
    
    === GNU Readline 命令行快捷键绑定 ===
    --with-readline
    
    ./config \
    --prefix=/usr/local/php \
    --with-config-file-path=/usr/local/php/etc \
    --with-apxs2=/usr/local/httpd/bin/apxs \
    --enable-inline-optimization \
    --disable-debug \
    --disable-rpath \
    --enable-shared \
    --enable-opcache \
    --enable-fpm \
    --with-fpm-user=www \
    --with-fpm-group=www \
    --with-mysql=mysqlnd \
    --with-mysqli=mysqlnd \
    --with-pdo-mysql=mysqlnd \
    --with-gettext \
    --enable-mbstring \
    --with-iconv \
    --with-mcrypt \
    --with-mhash \
    --with-openssl \
    --enable-bcmath \
    --enable-soap \
    --with-libxml-dir \
    --enable-pcntl \
    --enable-shmop \
    --enable-sysvmsg \
    --enable-sysvsem \
    --enable-sysvshm \
    --enable-sockets \
    --with-curl \
    --with-zlib \
    --enable-zip \
    --with-bz2 \
    --with-readline
    

    php7.4.30安装

    安装php依赖包

    yum install openssl openssl-devel bzip2 bzip2-devel libcurl libcurl-devel -y

    checking for oniguruma... no
    configure: error: Package requirements (oniguruma) were not met:
    
    No package 'oniguruma' found
    
    Consider adjusting the PKG_CONFIG_PATH environment variable if you
    installed software in a non-standard prefix.
    
    Alternatively, you may set the environment variables ONIG_CFLAGS
    and ONIG_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.
    

    rpm -ivh https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-6.9.7.1-1.el7.remi.x86_64.rpm

    rpm -ivh https://rpms.remirepo.net/enterprise/7/remi/x86_64/oniguruma5php-devel-6.9.7.1-1.el7.remi.x86_64.rpm

    ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-apxs2=/usr/local/httpd/bin/apxs --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-opcache --enable-fpm --with-fpm-user=www --with-fpm-group=www --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-gettext --enable-mbstring --with-iconv --with-mcrypt --with-mhash --with-openssl --enable-bcmath --enable-soap --with-libxml-dir --enable-pcntl --enable-shmop --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-sockets --with-curl --with-zlib --enable-zip --with-bz2 --with-readline
    make && make install

    相关文章

      网友评论

          本文标题:apache + php安装过程

          本文链接:https://www.haomeiwen.com/subject/sffggrtx.html