问题标签 [php-7.1]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
960 浏览

php - PHP 7: SessionHandlerInterface::read(string $session_id): string 必须与 SessionHandlerInterface::read($key) 兼容

在 PHP 7.1 下使用以下代码

我得到:

致命错误:Sessions\MySqlSessionHandler::read(string $session_id) 声明:字符串必须与 SessionHandlerInterface::read($key) 兼容

当我删除类型声明“字符串”而不是像

不抛出异常。所有其他 SessionHandlerInterface 函数也是如此。阅读 PHP 文档类型字符串应该是正确的。

怎么了 ?

0 投票
1 回答
1062 浏览

moodle - 异常 - 调用未定义的函数 course_overviewfiles_options()

我正在使用由 php7.0 和 mysql5.7 创建的 Moodle(最新的 3.2.2)站点,但是当我尝试以管理员身份添加新课程时,出现一个名为:异常 - 调用未定义函数 course_overviewfiles_options()的错误。我能做些什么来解决它?我从开发中“清除所有缓存”,所以上面的问题消失了,但是当用户登录时,发生了另一个错误:异常 - 调用未定义的函数 core_login_get_return_url()。我再次“清除所有缓存”,第 2 号问题消失了,第 1 号问题再次出现。

0 投票
0 回答
251 浏览

apache - apache 2.4,Windows Server 2012 无法访问 htdocs 中的新文件

我在 windows server2012 r2 上安装了 Apache 2.4、MySql 4.1 和 PHP 7.1。

我可以通过浏览http://localhost/来测试是否安装了 Apache,以便网站显示 htdocs 中已经存在的 index.html 文件的内容,但我无法通过http://访问 htdocs 文件夹中的文件 test.php:/ /localhost/test.php/我得到错误内容未找到 Apache 错误报告中的行是 [Wed Apr 26 12:54:22.400615 2017] [:error] [pid 1068:tid 1020] [client ::1: 61536] 找不到脚本“C:/Apache24/htdocs/index.php”或无法统计

我已经做了很多测试,我觉得奇怪的是,如果我在 index.html 中复制 test.php 的内容,它可以工作,并且我会得到正确的页面,其中包含有关 php 安装的信息。所以我认为这是安全设置的问题,但我是文件夹的所有者,我进行了安装。

有人对此有任何想法吗?

谢谢

0 投票
1 回答
3816 浏览

php - 在 PHP 7.1 中使用三重 DES(3DES)

我需要一种使用 3des 加密和解密的方法。我目前正在使用 php 7.1

我发现了这个问题,但是从 php 7.1 开始不推荐使用mcrypt ,我找不到任何其他资源。

0 投票
0 回答
1476 浏览

openssl - ./configure 执行成功,然后在 PHP7.1.4 中使用 openssl 使 make 失败

我想安装php7,

首先

./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache

并且成功了~

然后,输入make

/opt/php7/php-7.1.4/ext/openssl/openssl.c:4103: undefined reference toDSA_set0_pqg' /opt/php7/php-7.1.4/ext/openssl/openssl.c:4110:未定义对DSA_set0_key' /opt/php7/php-7.1.4/ext/openssl/openssl.c:4122: undefined reference toDSA_get0_key 的引用' /opt/php7/php-7.1.4/ext/openssl/openssl.c:4123:未定义对BN_is_zero' ext/openssl/.libs/openssl.o: In functionphp_openssl_pkey_init_dh' 的引用:/opt/php7/php-7.1.4/ext/openssl/openssl.c:4180:对 php_openssl_dh_pub_from_priv' 的未定义引用DH_set0_pqg' ext/openssl/.libs/openssl.o: In function:/opt/php7/php-7.1.4/ext/openssl/openssl.c :4157: 未定义对BN_with_flags' ext/openssl/.libs/openssl.o: In functionphp_openssl_pkey_init_dh' 的引用:/opt/php7/php-7.1.4/ext/openssl/openssl.c:4194: 未定义对DH_set0_key' /opt/php7/php-7.1.4/ext/openssl/openssl.c:4187: undefined reference toDH_set0_key' ext/openssl/.libs/xp_ssl.o 的引用:在函数sk_X509_num': /usr/local/include/openssl/x509.h:97: undefined reference toOPENSSL_sk_num' ext/openssl/.libs/xp_ssl.o: 在函数sk_X509_value': /usr/local/include/openssl/x509.h:97: undefined reference toOPENSSL_sk_value' ext/openssl/.libs/xp_ssl.o: 在函数sk_X509_num': /usr/local/include/openssl/x509.h:97: undefined reference toOPENSSL_sk_num' ext/openssl/.libs/xp_ssl.o:在功能enable_server_sni': /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1359: undefined reference toTLS_server_method'ext/openssl/.libs/xp_ssl.o:在函数php_openssl_setup_crypto': /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1512: undefined reference toTLS_client_method'/opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1579:未定义对 SSL_CTX_set_options'ext /openssl/.libs SSL_CTX_set_alpn_select_cb' /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1594: undefined reference to/的引用xp_ssl.o:在函数SSL_CTX_get_options'/opt/php7/php-7.1.4/ext/openssl set_server_specific_opts': /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1241: undefined reference to/xp_ssl.c:1268:未定义引用SSL_CTX_set_options' ext/openssl/.libs/xp_ssl.o: In functionphp_openssl_setup_crypto':/opt/php7/php-7.1.4/ext/openssl/ xp_ssl.c:1512:未定义对SSL_CTX_set_alpn_protos 的 ext/openssl/.libs TLS_server_method' /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:1574: undefined reference to/xp_ssl.o 的引用:在函数php_openssl_sockop_set_option': /opt/php7/php-7.1.4/ext/openssl/xp_ssl.c:2296: undefined reference toSSL_get0_alpn_selected 的 ext/openssl/.libs/xp_ssl.o 中:在函数sk_GENERAL_NAME_num': /usr/local/include/openssl/x509v3.h:165: undefined reference toOPENSSL_sk_num 的 ext/openssl/.libs/xp_ssl 中。 o:在函数sk_GENERAL_NAME_value': /usr/local/include/openssl/x509v3.h:165: undefined reference to中 OPENSSL_sk_value' ext/ftp/.libs/php_ftp.o:在函数中zm_startup_ftp': /opt/php7/php-7.1.4/ext/ftp/php_ftp.c:313: undefined reference toOPENSSL_init_ssl'/opt/php7/php-7.1.4/ext/ftp/php_ftp.c:314:未定义对OPENSSL_init_crypto' /opt/php7/php-7.1.4/ext/ftp/php_ftp.c:315: undefined reference toOPENSSL_init_crypto'/opt/php7/php-7.1.4/ext/ftp/php_ftp.c:316 的引用:未定义对OPENSSL_init_crypto' /opt/php7/php-7.1.4/ext/ftp/php_ftp.c:318: undefined reference toOPENSSL_init_ssl' ext/ftp/.libs/ftp.o 的引用:在函数ftp_login': /opt/php7/php-7.1.4/ext/ftp/ftp.c:283: undefined reference toTLS_client_method'/opt/php7/php-7.1.4/ext/ftp/ftp.c:292:未定义引用SSL_CTX_set_options' ext/phar/.libs/util.o: In functionphar_verify_signature':/opt/php7 /php-7.1.4/ext/phar/util.c:1563:未定义对EVP_MD_CTX_new' /opt/php7/php-7.1.4/ext/phar/util.c:1586: undefined reference toEVP_MD_CTX_free 的引用' /opt/php7/php-7.1.4/ext/phar/util.c:1595:未定义对EVP_MD_CTX_free' ext/phar/.libs/util.o: In functionphar_create_signature' 的引用:/ opt/php7/php-7.1.4/ext/phar/util.c:1860:未定义对EVP_MD_CTX_new' /opt/php7/php-7.1.4/ext/phar/util.c:1892: undefined reference toEVP_MD_CTX_free 的引用'collect2:ld 返回 1 退出状态 make:*** [sapi/cli/php] 错误 1 ​​`

所以,我需要你的帮助,谢谢!

0 投票
1 回答
4350 浏览

mongodb - 如何使用 '$or' 或 '$and' 子句从 PHP 查询 MongoDB?

我想在过滤器中的$oror$and子句的帮助下使用 MongoDB PHP7.1 驱动程序从 mongodb 获取数据。我试图构建查询来做同样的事情,但没有奏效。

这是我的示例代码:

上面的代码给了我以下错误:

请帮助我理解我做错了什么。

0 投票
0 回答
30 浏览

php - 函数 mysql_fetch_array() 中的致命错误

我正在尝试重新编码以与 PHP7 一起使用,但失败得很惨。有人能指出我正确的方向吗?

这是错误:

警告:mysqli_query() 至少需要 2 个参数,1 个在 /Applications/XAMPP/xamppfiles/htdocs/students/index.php 第 55 行给出

致命错误:未捕获的错误:调用 /Applications/XAMPP/xamppfiles/htdocs/students/index.php:57 中未定义的函数 mysql_fetch_array() 堆栈跟踪:在 /Applications/XAMPP/xamppfiles/htdocs/students 中抛出 #0 {main} /index.php 第 57 行

PHP代码:

我已经删除了其他不必要的代码,只显示了一个正在创建错误的代码。

0 投票
1 回答
1303 浏览

ssl - 从 PHP 5.5 升级到 7.1.4 后 PHPMailer 失败

具体来说,我们会因以下消息而失败:

谷歌搜索我们发现从 PHP 5.5 升级过程中出现类似错误的报告 - 但这些都源于 PHP 5.6 中引入的改进的证书验证。这似乎不是我们的问题。例如 - 在PHPMailer 故障排除 wiki之后- 我们能够使用 openSSL 连接到 smtp 服务器。

打开 SMTBDebug(级别 4)并没有真正显示出任何有用的信息:

如前所述 - 此问题在 PHP 升级后立即开始。无需更改代码或 SSL/证书配置。

有关故障排除的后续步骤的建议?

编辑:有人建议这个问题之前可能已经解决了 SSL3_GET_SERVER_CERTIFICATE.. 但它是一个不同的错误消息(我确实尝试按照建议覆盖 smtpoptions - 无效)。

0 投票
2 回答
9967 浏览

php - Codeigniter 3 会话不适用于 PHP 7.1.4

我有一个使用 . 构建的应用程序Codeigniter 3 HMVC。该应用程序在 PHP5.6版本上运行良好,但是在将我的 PHP 版本升级到之后,7.1.4我无法登录到我的应用程序。经过全面检查后,我发现会话根本没有设置。

我的角色回到 PHP5.6并且会话再次正常工作,而切换到 PHP7.1.4 带来了“会话不工作”问题。

我尝试更改一些配置值,例如 cookie 前缀和 cookie 保存名称等,似乎没有什么可以解决它。

任何人都可以请帮忙。

0 投票
3 回答
2469 浏览

php - PHP:无法将文件移动到不同的文件夹

我正在尝试将使用 PHP 上传的文件移动到另一个文件夹,但不知何故这不起作用,导致:

move_uploaded_file(upload/tmp/phpxEGMLG): failed to open stream: Permission denied

所以,显然我没有适当的权限upload/tmp(实际上是/var/www/html/upload/tmp)。

我已经设置了权限777和所有者root:root/var/www/html/upload/tmp以绝对确定不会有问题。
但这并没有解决它...

我尝试过的其他事情:

  • 将所有者设置为apache:apache
  • 将源文件权限更改为777和所有者root(默认情况下,所有者设置为apache
  • 检查 PHP 设置(几乎是默认设置,/var/www/html并且/tmp在内部open_basedirupload_tmp_dir未设置)+ 日志
  • 检查 Apache 设置 + 日志
  • 在同一个文件夹中移动文件->这可行!
  • 将其移动到其他文件夹--> 不起作用
  • 将所有父目录设置为777和所有者rootapache

我创建了一个测试脚本:

它提供如下输出:

测试文件移动

/var/www/html
根目录
/var/www/html/upload/tmp

数组 ( [type] => 2 [message] => rename(/tmp/tst.txt,tst-2.txt): Permission denied [file] => /var/www/html/test.php [line] = > 13)

这告诉我脚本在哪个用户下运行并且我在正确的目录中。它还省略了额外的检查move_uploaded_file使用,专注于文件的移动。

关于我的设置的一些信息:

  • CentOS 7
  • PHP 7.1
  • PHP-FPM
  • 阿帕奇 2.4.6

它为 PHP-FPM 使用单独的临时目录,例如/tmp/systemd-private-xxxx-php71-php-fpm.service-yyyy/tmp/. 也许有一些原因它不能将文件移到这个目录之外?虽然我找不到任何东西......

我希望有人可以为我提供有关可能发生的事情的线索!