Discuz! Board

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 1875|回复: 0
打印 上一主题 下一主题

php安装扩展

[复制链接]

1272

主题

2067

帖子

7962

积分

认证用户组

Rank: 5Rank: 5

积分
7962
跳转到指定楼层
楼主
发表于 2020-5-8 20:00:13 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
composer global require laravel/installer
[Changed current directory to /root/.config/composer]

Problem 1
    - laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
    - Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/opt/remi/php72/php.ini
    - /etc/opt/remi/php72/php.d/10-opcache.ini
    - /etc/opt/remi/php72/php.d/20-bcmath.ini
    - /etc/opt/remi/php72/php.d/20-bz2.ini
    - /etc/opt/remi/php72/php.d/20-calendar.ini
    - /etc/opt/remi/php72/php.d/20-ctype.ini
    - /etc/opt/remi/php72/php.d/20-curl.ini
    - /etc/opt/remi/php72/php.d/20-dom.ini
    - /etc/opt/remi/php72/php.d/20-exif.ini
    - /etc/opt/remi/php72/php.d/20-fileinfo.ini
    - /etc/opt/remi/php72/php.d/20-ftp.ini
    - /etc/opt/remi/php72/php.d/20-gd.ini
    - /etc/opt/remi/php72/php.d/20-gettext.ini
    - /etc/opt/remi/php72/php.d/20-iconv.ini
    - /etc/opt/remi/php72/php.d/20-json.ini
    - /etc/opt/remi/php72/php.d/20-mbstring.ini
    - /etc/opt/remi/php72/php.d/20-mysqlnd.ini
    - /etc/opt/remi/php72/php.d/20-pdo.ini
    - /etc/opt/remi/php72/php.d/20-phar.ini
    - /etc/opt/remi/php72/php.d/20-simplexml.ini
    - /etc/opt/remi/php72/php.d/20-sockets.ini
    - /etc/opt/remi/php72/php.d/20-sqlite3.ini
    - /etc/opt/remi/php72/php.d/20-tokenizer.ini
    - /etc/opt/remi/php72/php.d/20-xml.ini
    - /etc/opt/remi/php72/php.d/20-xmlwriter.ini
    - /etc/opt/remi/php72/php.d/20-xsl.ini
    - /etc/opt/remi/php72/php.d/30-mysqli.ini
    - /etc/opt/remi/php72/php.d/30-pdo_mysql.ini
    - /etc/opt/remi/php72/php.d/30-pdo_sqlite.ini
    - /etc/opt/remi/php72/php.d/30-wddx.ini
    - /etc/opt/remi/php72/php.d/30-xmlreader.ini
    - /etc/opt/remi/php72/php.d/30-xmlrpc.ini
    - /etc/opt/remi/php72/php.d/40-igbinary.ini
    - /etc/opt/remi/php72/php.d/40-msgpack.ini
    - /etc/opt/remi/php72/php.d/50-redis.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

yum search zip php
yum install -y php72-php-pecl-zip.x86_64
yum install -y unzip



安装扩展注意

与Apache+PHP或者Nginx+PHP的运行模式不同,WorkerMan是基于PHP命令行 PHP CLI 运行的,使用的是不同的PHP可执行程序,使用的php.ini文件也可能不同。所以在网页中打印phpinfo()看到安装了某个扩展,不代表命令行的PHP CLI也安装了对应的扩展。

如何确定PHP CLI安装了哪些扩展

运行 php -m 会列出命令行 PHP CLI 已经安装的扩展,结果类似如下:

  1. ~# php -m
  2. [PHP Modules]
  3. libevent
  4. posix
  5. pcntl
复制代码

如何确定PHP CLI 的php.ini文件的位置

当我们安装扩展时,可能需要手动配置php.ini文件,把扩展加进去,所以要确认PHP CLI的php.ini文件的位置。可以运行php --ini查找PHP CLI的ini文件位置,结果类似如下(各个系统显示结果会有差异):


  1. ~# php --ini
  2. Configuration File (php.ini) Path: /etc/php5/cli
  3. Loaded Configuration File:         /etc/php5/cli/php.ini
  4. Scan for additional .ini files in: /etc/php5/cli/conf.d
  5. Additional .ini files parsed:      /etc/php5/cli/conf.d/apc.ini,
  6. /etc/php5/cli/conf.d/libevent.ini,
  7. /etc/php5/cli/conf.d/memcached.ini,
  8. /etc/php5/cli/conf.d/mysql.ini,
  9. /etc/php5/cli/conf.d/pdo.ini,
  10. /etc/php5/cli/conf.d/pdo_mysql.ini
复制代码

给PHP CLI安装扩展(安装memcached扩展为例)

方法一、使用apt或者yum命令安装

如果PHP是通过 apt 或者 yum 命令安装的,则扩展也可以通过 apt 或者 yum 安装



centos等系统yum安装PHP扩展方法


1、利用yum search查找扩展包


~# yum search memcached php

php-pecl-memcached - memcached module for php5

2、使用yum install安装扩展包

~# yum install -y php-pecl-memcached

Reading package lists... Done

Reading state information... Done

...

说明:

使用apt或者yum安装PHP扩展会自动配置php.ini文件,安装完直接可用,十分方便。缺点是有些扩展在apt或者yum中没有对应的扩展安装包。

https://blog.csdn.net/abel004/article/details/53957431



回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|firemail ( 粤ICP备15085507号-1 )

GMT+8, 2024-11-26 07:01 , Processed in 0.058299 second(s), 20 queries .

Powered by Discuz! X3

© 2001-2013 Comsenz Inc.

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