1

我对 cakephp 2 有疑问。我设置了一个 AES cookie,如下所示:

AppController.php

public function beforeFilter() {
    $this->Cookie->name = 'mycookie';
    $this->Cookie->key = '12345678901234567890123456789012345678901234567890123456789012345678901234567890';
    $this->Cookie->type('aes');
}

文档:http ://book.cakephp.org/2.0/fr/core-libraries/components/cookie.html

此代码仅会导致我的 Synology NAS 上安装的 apache 崩溃。但他与easyphp(在本地)一起工作得很好。

Warning (4096): Argument 1 passed to Hash::insert() must be an array, string given, called in /volume1/web/TEST_DEV/lib/Cake/Controller/Component/CookieComponent.php on line 249 and defined [CORE/Cake/Utility/Hash.php, line 257]

Notice (8): Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' [CORE/Cake/Utility/Security.php, line 319]

Warning (4096): Argument 1 passed to Hash::insert() must be an array, string given, called in /volume1/web/TEST_DEV/lib/Cake/Controller/Component/CookieComponent.php on line 249 and defined [CORE/Cake/Utility/Hash.php, line 257]

Notice (8): Use of undefined constant MCRYPT_RIJNDAEL_128 - assumed 'MCRYPT_RIJNDAEL_128' [CORE/Cake/Utility/Security.php, line 319]

Notice (8): Use of undefined constant MCRYPT_MODE_CBC - assumed 'MCRYPT_MODE_CBC' [CORE/Cake/Utility/Security.php, line 320]

Fatal error: Call to undefined function mcrypt_get_iv_size() in /volume1/web/TEST_DEV/lib/Cake/Utility/Security.php on line 322 

有人能帮我吗 ?因为我的许多开发都是在我的 Synology NAS 上完成的......



编辑: phpinfo() 给我这个列配置命令的输出

'./configure.syno' '--host=armle-unknown-linux' '--target=armle-unknown-linux' '--build=i686-pc-linux' '--with-ldap=shared,/usr/syno' '--with-ldap-sasl=/usr/syno' '--prefix=/usr/syno/php' '--with-apxs2=/usr/syno/apache/bin/apxs' '--disable-cgi' '--with-config-file-path=/usr/syno/etc' '--with-config-file-scan-dir=/usr/syno/etc/php' '--with-libxml-dir=/usr/syno' '--with-bz2=/usr/syno' '--with-zlib=shared,/usr/syno' '--enable-bcmath=shared' '--enable-syno_compiler=shared' '--enable-calendar=shared' '--with-curl=shared,/usr/syno' '--enable-dba=shared' '--enable-exif=shared' '--enable-ftp=shared' '--with-gd=shared' '--with-jpeg-dir=/usr/syno' '--with-png-dir=/usr/syno' '--with-freetype-dir=/usr/syno' '--enable-gd-native-ttf' '--with-gettext=shared' '--with-iconv=shared,/usr/syno/libiconv' '--with-imap=shared,/source/imap-2007e' '--with-imap-ssl=shared,/usr/syno' '--enable-mbstring=shared' '--with-mcrypt=shared,/usr/syno' '--with-mysql=shared,/usr/syno/mysql' '--with-mysqli=shared,/usr/syno/mysql/bin/mysql_config' '--with-openssl=shared,/usr/syno' '--with-pdo-mysql=shared,/usr/syno/mysql' '--with-pdo-pgsql=shared,/usr/syno/pgsql' '--with-pgsql=shared,/usr/syno/pgsql' '--enable-shmop=shared' '--enable-soap=shared' '--enable-sockets=shared' '--enable-wddx=shared' '--with-xmlrpc=shared' '--enable-zip=shared' '--with-sqlite3=static,/usr/syno/sqlite3' '--with-pdo-sqlite=static,/usr/syno/sqlite3' '--with-xsl=shared,/usr/syno/libxslt' '--enable-phar=shared' '--with-mssql=shared,/usr/syno/freetds'

所以我认为 mcrypt 安装正确......

编辑 26/01/2015:许多论坛报告说 mcrypt 与 Synology NAS 存在问题

4

1 回答 1

0

我终于找到了发生了什么。Synology 在默认配置中禁用 mcrypt。

为了纠正这种行为。

进入您的 Synology 管理面板:http://diskstation:5000/webman/index.cgi

  1. 选择网络服务
  2. 单击选项卡 PHP 设置
  3. 点击 PHP 扩展
  4. 检查 mcrypt

(截图在这里:http: //i.stack.imgur.com/kEEv5.jpg

于 2015-01-26T22:26:33.093 回答