1. 程式人生 > >php安裝mcrypt擴充套件

php安裝mcrypt擴充套件

查了一下資料使用 yum install php-mcrypt 安裝mcrypt擴充套件時會提示沒有安裝包

Setting up Install Process
No package php-mcrypt available.
Error: Nothing to do

mcrypt 是加密擴充套件庫,載入了它可以用他裡面自帶的22種加密解密演算法

CentOS6 預設安裝的是php5.3.2

預設的 redhat repos php中是沒有 mcrypt 擴充套件的
根據紅帽的官方訊息(https://bugzilla.redhat.com/show_bug.cgi?id=621268)RHEL 不打算新增PHP的mcrypt 的支援
Joe Orton 2010-08-05 04:47:17 EDT

Thanks for the report.

We are not planning to ship mcrypt support for PHP.

解決方案:

[[email protected] php-5.5.36]# cd ext/mcrypt
[[email protected] mcrypt]# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626

注意:如果報 -bash:phpize not Found  那麼 yum install php-devel 就可以使phpize進行動態編譯安裝擴充套件


[[email protected] mcrypt]# ./configure  -with-php-config=/usr/bin/php-config
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-pc-linux-gnu
checking for PHP prefix... /usr
checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
checking for PHP extension directory... /usr/lib/php/modules
checking for PHP installed headers prefix... /usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking for mcrypt support... yes, shared
checking for libmcrypt version... >= 2.5.6
checking for mcrypt_module_open in -lmcrypt... no
checking for mcrypt_module_open in -lmcrypt... yes
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: executing libtool commands

[[email protected] mcrypt]# make && make install
/bin/sh /home/zzq/software/php-5.5.36/ext/mcrypt/libtool --mode=compile cc  -I. -I/home/zzq/software/php-5.5.36/ext/mcrypt -DPHP_ATOM_INC -I/home/zzq/software/php-5.5.36/ext/mcrypt/include -I/home/zzq/software/php-5.5.36/ext/mcrypt/main -I/home/zzq/software/php-5.5.36/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt.c -o mcrypt.lo 
libtool: compile:  cc -I. -I/home/zzq/software/php-5.5.36/ext/mcrypt -DPHP_ATOM_INC -I/home/zzq/software/php-5.5.36/ext/mcrypt/include -I/home/zzq/software/php-5.5.36/ext/mcrypt/main -I/home/zzq/software/php-5.5.36/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt.c  -fPIC -DPIC -o .libs/mcrypt.o
/bin/sh /home/zzq/software/php-5.5.36/ext/mcrypt/libtool --mode=compile cc  -I. -I/home/zzq/software/php-5.5.36/ext/mcrypt -DPHP_ATOM_INC -I/home/zzq/software/php-5.5.36/ext/mcrypt/include -I/home/zzq/software/php-5.5.36/ext/mcrypt/main -I/home/zzq/software/php-5.5.36/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -c /home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt_filter.c -o mcrypt_filter.lo 
libtool: compile:  cc -I. -I/home/zzq/software/php-5.5.36/ext/mcrypt -DPHP_ATOM_INC -I/home/zzq/software/php-5.5.36/ext/mcrypt/include -I/home/zzq/software/php-5.5.36/ext/mcrypt/main -I/home/zzq/software/php-5.5.36/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c /home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt_filter.c  -fPIC -DPIC -o .libs/mcrypt_filter.o
/home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt_filter.c: In function ‘php_mcrypt_filter_create’:
/home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt_filter.c:210: warning: passing argument 1 of ‘mcrypt_module_open’ discards qualifiers from pointer target type
/usr/local/include/mutils/mcrypt.h:38: note: expected ‘char *’ but argument is of type ‘const char *’
/bin/sh /home/zzq/software/php-5.5.36/ext/mcrypt/libtool --mode=link cc -DPHP_ATOM_INC -I/home/zzq/software/php-5.5.36/ext/mcrypt/include -I/home/zzq/software/php-5.5.36/ext/mcrypt/main -I/home/zzq/software/php-5.5.36/ext/mcrypt -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include  -DHAVE_CONFIG_H  -g -O2   -o mcrypt.la -export-dynamic -avoid-version -prefer-pic -module -rpath /home/zzq/software/php-5.5.36/ext/mcrypt/modules  mcrypt.lo mcrypt_filter.lo -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lmcrypt
libtool: link: cc -shared  .libs/mcrypt.o .libs/mcrypt_filter.o   -L/usr/local/lib /usr/local/lib/libmcrypt.so  -Wl,-rpath -Wl,/usr/local/lib   -Wl,-soname -Wl,mcrypt.so -o .libs/mcrypt.so
libtool: link: ( cd ".libs" && rm -f "mcrypt.la" && ln -s "../mcrypt.la" "mcrypt.la" )
/bin/sh /home/zzq/software/php-5.5.36/ext/mcrypt/libtool --mode=install cp ./mcrypt.la /home/zzq/software/php-5.5.36/ext/mcrypt/modules
libtool: install: cp ./.libs/mcrypt.so /home/zzq/software/php-5.5.36/ext/mcrypt/modules/mcrypt.so
libtool: install: cp ./.libs/mcrypt.lai /home/zzq/software/php-5.5.36/ext/mcrypt/modules/mcrypt.la
libtool: finish: PATH="/usr/local/jdk1.7.0_79/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/zzq/app/hadoop-2.4.1/bin:/home/zzq/app/hadoop-2.4.1/sbin:/home/zzq/bin:/sbin" ldconfig -n /home/zzq/software/php-5.5.36/ext/mcrypt/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /home/zzq/software/php-5.5.36/ext/mcrypt/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------

Build complete.
Don't forget to run 'make test'.

Installing shared extensions:     /usr/lib/php/modules/
如果make && make install報錯/home/zzq/software/php-5.5.36/ext/mcrypt/mcrypt.c:283: error: ‘PHP_FE_END’ undeclared here (not in a function)
make: *** [mcrypt.lo] Error 1

原始碼有錯執行這個:

[[email protected] mcrypt]# sed -i 's|PHP_FE_END|{NULL,NULL,NULL}|' ./*.c
[[email protected] mcrypt]# sed -i 's|ZEND_MOD_END|{NULL,NULL,NULL}|' ./*.c

編輯php.ini

[[email protected] mcrypt]# vim /etc/php.ini

加入mcrypt.so,      mcrypt.so預設在/usr/lib/php/modules/裡面

extension_dir = "/usr/lib/php/modules/"
extension = "mcrypt.so"



php -m

能檢視到mcrypt就成功了

網頁上也能看到





相關推薦

CentOS下php安裝mcrypt擴充套件

(以下步驟均為本人實際操作,可能與你的安裝方法有所區別,但我會盡量排除疑惑) 大致步驟(1)安裝mcrypt,(2)安裝php對mcrypt的擴充套件,(3)重啟apache (1)、確認你的linux沒有安裝mcrypt庫,如果已安裝,跳過安裝步驟 [[email

CentOS7下php安裝mcrypt擴充套件

轉自http://www.cnblogs.com/huangzhen/archive/2012/09/12/2681861.html (以下步驟均為本人實際操作,可能與你的安裝方法有所區別,但我會盡量排除疑惑) 大致步驟(1)安裝mcrypt,(2)安裝php對mc

php安裝mcrypt擴充套件

查了一下資料使用 yum install php-mcrypt 安裝mcrypt擴充套件時會提示沒有安裝包 Setting up Install Process No package php-mcrypt available. Error: Nothing to do

轉載--php 7.2 安裝 mcrypt 擴充套件 php 7.2 安裝 mcrypt 擴充套件

在 php 官網下載 mcrypt 包,php 擴充套件官網 # wget http://pecl.php.net/get/mcrypt-1.0.1.tgz # tar xf mcrypt-1.0.1.tgz # cd mcrypt-1.0.1 編譯安裝

安裝和使用phpmcrypt擴充套件

 PHP程式設計師們在編寫程式碼程式時,除了要保證程式碼的高效能之外,還有一點是非常重要的,那就是程式的安全性保障。PHP除了自帶的幾種加密函式外,還有功能更全面的PHP加密擴充套件庫Mcrypt和Mhash。 其中,Mcrypt擴充套件庫可以實現加密解密功能,就是既

MACOSX下PHP安裝pdo_oci擴充套件

環境安裝 首先先去oracle官網下載Clinet SDK 下載地址 選擇下載 Basic、SDK這兩個檔案就行了。解壓後把倆個資料夾的內容合併 mv ~/Downloads/instantclient-basic-macos.x64-12.2.0.1.0-2/* ~/instan

Centos下PHP安裝Kafka擴充套件操作教程

說明:網上有好幾種PHP操作kafka的擴充套件,有kafka-php和php-rdkafka兩種是比較流行的。但其中kafka-php功能較全,但是使用composer安裝,對於內網使用者不能訪問外網,因此,我們選擇php-rdkafka。 php-rdkafka依賴librdkafka,先下

redis慢查詢日誌、php安裝redis擴充套件、redis儲存session、redis主從配置

一:redis慢查詢日誌 編輯配置檔案/etc/redis.conf針對慢查詢日誌,可以設定兩個引數,一個是執行時長,單位是微秒,另一個是慢查詢日誌的長度。當一個新的命令被寫入日誌時,最老的一條會從命令日誌佇列中被移除。 slowlog-log-slower-than 1000 //單位ms,表示慢於100

redis慢查詢日誌,php安裝redis擴充套件,redis儲存session,redis主從配置

redis慢查詢日誌 和mysql一樣redis也有慢查詢日誌,redis的慢查詢日誌預設是開啟的。針對慢查詢日誌,主要是設定兩個引數,一個是執行時長,單位是微秒,另一個是慢查詢日誌的長度。當一個新的命令被寫入日誌時,最老的一條會從命令日誌佇列中被移除。 編輯配置檔案,檔案中搜素slowlog,可以設

centos7 php安裝redis擴充套件

原始碼地址:https://github.com/phpredis/phpredis/releases 下載對應的版本wget https://github.com/phpredis/phpredis/archive/4.2.0RC2.zip 解壓:unzip 4.2.0RC2.zip

windows 下php安裝redis擴充套件

下載網站連結https://pecl.php.net/package/redis 1.下載php_redis.dll,下載地址https://pecl.php.net/package/redis 2.找到php安裝目錄將下載的包裡面的這兩個檔案放到ext資料夾裡 php_redis.dll

php 安裝Redis 擴充套件

1、用phpinfo();檢視php 的資訊 主要看 Architecture  PHP Extension Build  (ts vc 等要對應上) 2、https://windows.php.net/downloads/pecl/releases/igbinar

記錄一個PHP安裝redis擴充套件時的問題

安裝過程:https://www.cnblogs.com/pengyunjing/p/8688320.html 由於我之前安裝過該擴充套件,重新安裝時沒有執行make clean命令,所以安裝好出現了下面的錯誤: PHP Warning:  PHP Startup: Unable to load

linux環境php安裝solr擴充套件(親測總結)

1、從http://pecl.php.net/package/solr下載最新版本。 我下載到/usr/tmp      cd /usr/tmp   wget https://pecl.php.net/get/solr-2.4.0.tgz

編譯安裝php 安裝pdo_mysql擴充套件

1.進入擴充套件目錄 如果還未下載: a. 下載 檔案  wget http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz b. 解壓檔案 tar zxvf PDO_MYSQL-1.0.2.tgz cd  PDO_MYSQL

Linux php安裝fileinfo擴充套件

1.首先,找到擴充套件安裝的位置 find / -name fileinfo 2.cd 到該位置(根據自己的具體情況來) cd /usr/local/src/php7/ext/fileinfo/ 3.不要離開php安裝原始碼的ext/fileinfo目

windows系統 PHP安裝Redis擴充套件

首先在windows系統上安裝redis   1.下載地址https://github.com/dmajkic/redis/downloads。下載到的Redis支援32bit和64bit。根據自己實際情況選擇,我選擇32bit。把32bit檔案內容拷貝到需要安裝的目錄下,比如:D:\dev\redis-2

php安裝redis擴充套件及操作redis

                        &nbs

php安裝redis擴充套件,以及遇到的坑

先說問題吧 php 安裝redis擴充套件ext/standard/php_smart_str.h: No such file or directory 按照網上的教程安裝了redis的擴充套件,執行到 編譯安裝 make && make ins

Linux下php安裝Redis擴充套件(其他擴充套件同理)

1、cd  /usr/local/src/  切換到 3、tar zxvf   2.2.4.tar.gz  解壓檔案 4、cd  phpredis-2.2.4      #進入安裝目錄 5 、/usr/local/php/bin/phpize    # 使用 php