如何在 Ubuntu 14.04 上安装 php7 (zts) + pthreads

2024-01-08

我需要完整安装 PHP7 (ZTS) + Pthreads 的帮助。我已尝试以下安装但无法使其工作。

sudo -i

apt-get update

apt-get install -y git bison autoconf build-essential pkg-config gitcore libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev

mkdir /etc/php7

mkdir /etc/php7/cli

cd /usr/local/src

git clone https://github.com/php/php-src.git --depth=1

cd php-src/ext

git clone https://github.com/krakjoe/pthreads -b master pthreads

cd ..

./buildconf --force

php_configure_args="--prefix=/etc/php7 --with-config-file-path=/etc/php7/cli --with-config-file-scan-dir=/etc/php7/cli/conf.d --with-bz2 --with-zlib --enable-zip --with-mcrypt --with-openssl --with-curl --enable-ftp --with-mysqli --enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext --with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl --enable-bcmath --enable-mbstring --enable-calendar --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-maintainer-zts --enable-debug --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data --enable-cli --enable-pthreads=shared --with-tsrm-pthreads"


./configure $php_configure_args 

make && make install

cd /usr/local/src/php-src/ext/intl*

chmod a+x /etc/php7/bin/php-config

chmod a+x /etc/php7/bin/phpize

/etc/php7/bin/phpize

./configure --enable-intl --with-icu-dir=/usr  --prefix='/etc/php7' --with-libdir='/lib/x86_64-linux-gnu' --with-php-config='/etc/php7/bin/php-config'

make && make install

cp /usr/local/src/php-src/php.ini-production /etc/php7/cli/php.ini

ln --symbolic /etc/php7/bin/php /usr/bin/php

ln --symbolic /etc/php7/sbin/php-fpm /usr/sbin/php7-fpm

echo 'zend_extension=opcache.so' >> /etc/php7/cli/php.ini

echo 'extension=pthreads.so' >> /etc/php7/cli/php-cli.ini

echo "extension=intl.so" >> /etc/php7/cli/php.ini

FPM 配置。 1)/etc/init.d/php7-fpm

#!/bin/sh
### BEGIN INIT INFO
# Provides:          php-fpm php7-fpm
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts php7-fpm
# Description:       Starts The PHP FastCGI Process Manager Daemon
### END INIT INFO

# Author: Ondrej Sury <[email protected] /cdn-cgi/l/email-protection>
# Adapted to php7-fpm by @bjornjohansen

PATH=/usr/sbin
DESC="PHP7 FastCGI Process Manager"
NAME=php7-fpm
DAEMON=/usr/sbin/$NAME
DAEMON_ARGS="--daemonize --fpm-config /etc/php7/etc/php-fpm.conf"
PIDFILE=/var/run/php7-fpm.pid
TIMEOUT=30
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

# Don't run if we are running upstart
if init_is_upstart; then
    exit 1
fi

#
# Function to check the correctness of the config file
#
do_check()
{
    /usr/local/lib/php7-fpm-checkconf || return 1
    return 0
}

#
# Function that starts the daemon/service
#
do_start()
{
    # Return
    #   0 if daemon has been started
    #   1 if daemon was already running  
    #   2 if daemon could not be started  
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec          $DAEMON --test > /dev/null \
            || return 1
    start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
            $DAEMON_ARGS 2>/dev/null \
            || return 2
    # Add code here, if necessary, that waits for the process to be ready
    # to handle requests from services started subsequently which depend
    # on this one.  As a last resort, sleep for some time.
}

#
# Function that stops the daemon/service
#
do_stop()
{
        # Return
    #   0 if daemon has been stopped
    #   1 if daemon was already stopped
    #   2 if daemon could not be stopped
    #   other if a failure occurred
    start-stop-daemon --stop --quiet --retry=QUIT/$TIMEOUT/TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
    RETVAL="$?"
    [ "$RETVAL" = 2 ] && return 2
    # Wait for children to finish too if this is a daemon that forks
    # and if the daemon is only ever run from this initscript.
    # If the above conditions are not satisfied then add some other    code
    # that waits for the process to drop all resources that could be
    # needed by services started subsequently.  A last resort is to
    # sleep for some time.
    start-stop-daemon --stop --quiet --oknodo --   retry=0/30/TERM/5/KILL/5 --exec $DAEMON
    [ "$?" = 2 ] && return 2
    # Many daemons don't delete their pidfiles when they exit.
    rm -f $PIDFILE
    return "$RETVAL"
}

#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
    #
    # If the daemon can reload its configuration without
    # restarting (for example, when it is sent a SIGHUP),
    # then implement that here.
    #
    start-stop-daemon --stop --signal USR2 --quiet --pidfile $PIDFILE --name $NAME
    return 0
}

case "$1" in
start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_check $VERBOSE
    case "$?" in
        0)
            do_start
            case "$?" in
                0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
        1) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
            0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
            2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
status)
    status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
    ;;
check)
    do_check yes
    ;;
reload|force-reload)
    log_daemon_msg "Reloading $DESC" "$NAME"
    do_reload
    log_end_msg $?
    ;;
reopen-logs)
    log_daemon_msg "Reopening $DESC logs" $NAME
    if start-stop-daemon --stop --signal USR1 --oknodo --quiet \
        --pidfile $PIDFILE --exec $DAEMON
    then
        log_end_msg 0
    else
        log_end_msg 1
    fi
    ;;
restart)
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
      0|1)
            do_start
            case "$?" in
                    0) log_end_msg 0 ;;
                    1) log_end_msg 1 ;; # Old process is still running
                    *) log_end_msg 1 ;; # Failed to start
            esac
            ;;
      *)
            # Failed to stop
            log_end_msg 1
            ;;
    esac
    ;;
*)
    echo "Usage: $SCRIPTNAME {start|stop|status|restart|reload|force-  reload}" >&2
    exit 1
;;
esac

chmod a+x /etc/init.d/php7-fpm

2)/etc/init/php7-fpm.conf

# php7-fpm - The PHP FastCGI Process Manager
# Original script by Ondřej Surý. Adapted to php7-fpm by @bjornjohansen

description "The PHP FastCGI Process Manager"
author "Ondřej Surý <[email protected] /cdn-cgi/l/email-protection>"

start on runlevel [2345]
stop on runlevel [016]

# Precise upstart does not support reload signal, and thus rejects the
# job. We'd rather start the daemon, instead of forcing users to
# reboot https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1272788
#
# reload signal USR2


pre-start exec /usr/local/lib/php7-fpm-checkconf

respawn
exec /usr/sbin/php7-fpm --nodaemonize --fpm-config /etc/php7/etc/php-fpm.conf

3)/usr/local/lib/php7-fpm-checkconf

#!/bin/sh
set -e
errors=$(/usr/sbin/php7-fpm --fpm-config /etc/php7/etc/php-fpm.conf -t 2>&1 | grep "\[ERROR\]" || $
if [ -n "$errors" ]; then
    echo "Please fix your configuration file..."
    echo $errors
    exit 1
fi
exit 0

chmod a+x /usr/local/lib/php7-fpm-checkconf

cp /etc/php7/etc/php-fpm.conf.default /etc/php7/etc/php-fpm.conf

cp /etc/php7/etc/php-fpm.d/www.conf.default /etc/php7/etc/php-fpm.d/www.conf

update-rc.d -f php7-fpm defaults

当我运行以下命令时,我收到错误消息“作业无法启动”

service php7-fpm start

如果有人可以纠正我的错误或提供启用 PHP7 (ZTS) + Pthreads 的完整安装,我将很高兴。


更新和安装依赖项

apt-get update

apt-get install -y bison autoconf build-essential pkg-config git-core libltdl-dev libbz2-dev libxml2-dev libxslt1-dev libssl-dev libicu-dev libpspell-dev libenchant-dev libmcrypt-dev libpng-dev libjpeg8-dev libfreetype6-dev libmysqlclient-dev libreadline-dev libcurl4-openssl-dev

删除任何现有的 php7 并重新创建 php7 和其他子目录

rm -rf /etc/php7

mkdir -p /etc/php7
mkdir -p /etc/php7/cli
mkdir -p /etc/php7/etc

删除当前工作目录中的所有 php-src 文件夹并从 git 分支重新安装

rm -rf php-src

git clone https://github.com/php/php-src.git --depth=1

将目录更改为 ext 以从 git 下载 pthread

cd php-src/ext

git clone https://github.com/krakjoe/pthreads -b master pthreads

返回 php-src 作为当前工作目录

cd ..

构建 php-src

./buildconf --force

设置配置选项,启用 zts、fpm 和其他适用于您自己情况的扩展

CONFIGURE_STRING="--prefix=/etc/php7 --with-bz2 --with-zlib --enable-zip --disable-cgi \
   --enable-soap --enable-intl --with-mcrypt --with-openssl --with-readline --with-curl \
   --enable-ftp --enable-mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd \
   --enable-sockets --enable-pcntl --with-pspell --with-enchant --with-gettext \
   --with-gd --enable-exif --with-jpeg-dir --with-png-dir --with-freetype-dir --with-xsl \
   --enable-bcmath --enable-mbstring --enable-calendar --enable-simplexml --enable-json \
   --enable-hash --enable-session --enable-xml --enable-wddx --enable-opcache \
   --with-pcre-regex --with-config-file-path=/etc/php7/cli \
   --with-config-file-scan-dir=/etc/php7/etc --enable-cli --enable-maintainer-zts \
   --with-tsrm-pthreads --enable-debug --enable-fpm \
   --with-fpm-user=www-data --with-fpm-group=www-data"

运行配置脚本并安装

./configure $CONFIGURE_STRING

make && make install

使以下帮助程序可执行

chmod o+x /etc/php7/bin/phpize

chmod o+x /etc/php7/bin/php-config

现在将目录更改为 pthreads 并运行 phpize

cd ext/pthreads*

/etc/php7/bin/phpize

设置pthreads的配置选项,但确保enable-pthreads=shared,这是配置的主要方面

./configure --prefix='/etc/php7' --with-libdir='/lib/x86_64-linux-gnu' \ 
    --enable-pthreads=shared --with-php-config='/etc/php7/bin/php-config'

make && make install

FPM 安装涉及将配置文件复制到适当的位置并在必要时进行更改。

#back to current working directory php-src

cd ../../

#php.ini to be used by fpm-fcgi

cp -r php.ini-production /etc/php7/cli/php.ini

sed -i 's/;date.timezone =.*/date.timezone = Africa\/Lagos/' /etc/php7/cli/php.ini

cp /etc/php7/etc/php-fpm.conf.default /etc/php7/etc/php-fpm.conf

cp /etc/php7/etc/php-fpm.d/www.conf.default /etc/php7/etc/php-fpm.d/www.conf

cp sapi/fpm/init.d.php-fpm /etc/init.d/php7-fpm

sed -i 's/Provides:          php-fpm/Provides:          php7-fpm/' /etc/init.d/php7-fpm

sed -i 's#^php_fpm_BIN=.*#php_fpm_BIN=/usr/sbin/php7-fpm#' /etc/init.d/php7-fpm

sed -i 's#^php_fpm_CONF=.*#php_fpm_CONF=/etc/php7/etc/php-fpm.conf#' /etc/init.d/php7-fpm

sed -i 's#^php_fpm_PID=.*#php_fpm_PID=/var/run/php7-fpm.pid#' /etc/init.d/php7-fpm

将 pthreads.so 添加到 php-cli.ini,这将由命令行界面 (CLI) 使用

cp php.ini-production /etc/php7/cli/php-cli.ini

echo "extension=pthreads.so" > /etc/php7/cli/php-cli.ini

添加其他扩展和链接二进制文件

echo "zend_extension=opcache.so" >> /etc/php7/cli/php.ini

ln --symbolic /etc/php7/bin/php /usr/bin/php

ln --symbolic /etc/php7/sbin/php-fpm /usr/sbin/php7-fpm

chmod +x /etc/init.d/php7-fpm

update-rc.d php7-fpm defaults

service php7-fpm start

确保以下内容与 /etc/php7/etc/php-fpm.conf 中的内容相同

pid = /var/run/php7-fpm.pid
error_log = /var/log/php7-fpm.log
include=/etc/php7/etc/php-fpm.d/*.conf

确保以下内容与 /etc/php7/etc/php-fpm.d/www.conf 中的内容相同

user = www-data
group = www-data
listen = /var/run/php7-fpm.sock
listen.owner = www-data
listen.group = www-data
listen.mode = 0660
listen.allowed_clients = 127.0.0.1
security.limit_extensions = .php .php3 .php4 .php5 .php7

确保以下内容与 /etc/php7/cli/php.ini 中的内容相同

cgi.fix_pathinfo=1

要与 Nginx 一起使用,请在 nginx/sites-available/default 中执行以下操作

upstream php7-fpm {
    server unix:/var/run/php7-fpm.sock;
}
server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /usr/share/nginx/html;

    # Add index.php to the list if you are using PHP
    index index.html index.htm;

    server_name localhost;

    location / {
        try_files $uri $uri/ =404;
    }
    location ~ [^/]\.php(/|$) {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass php7-fpm;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

service nginx restart

要使用 pthreads,请记住它是通过命令行界面运行的。假设 thread.php 是您的并行编程代码,您无法通过使用浏览器执行 localhost/path/to/thread.php 以 sapi/fpm 模式运行它

<?php
//thread.php
    class Part extends Threaded{ public function run(){} }
    $parts = new Part();

    for($i=0;$i<4;$i++) $parts[] = $i;
?>

相反,您可以通过“system”等命令行方法创建一个文件来执行代码 thread.php

<?php
    system("php /path/to/thread.php");
?>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何在 Ubuntu 14.04 上安装 php7 (zts) + pthreads 的相关文章

  • AngularJS + Laravel 5 身份验证

    在使用 AngularJS 构建 SPA 时 我想在 AngularJS 网站中实现用户身份验证 但是 我不知道从哪里开始以及最佳实践是什么 基本上我有一个确定可以担任一个或多个角色 我寻找了一些例子 这样我就可以对如何正确处理这个问题有一
  • 将变量从 PHP 传递到 JavaScript 的有效方法[重复]

    这个问题在这里已经有答案了 有时我必须将一些变量从 PHP 传递到 JS 脚本 现在我是这样做的 var js variable 但这非常丑陋 我无法在 js 文件中隐藏我的 JS 脚本 因为它必须由 PHP 解析 处理这个问题的最佳解决方
  • PHP - 从图像创建一张图像

    我有 n 张图像 想用 php 代码创建一张 我使用 imagecopymerge 但无法成功 请举一些例子 Code numberOfImages 3 x 940 y 420 background imagecreatetruecolor
  • PHP_CodeSniffer - 显示失败的嗅探

    PHP CodeSniffer 中是否有设置来显示失败的嗅探 我将输出与我们的编码标准进行比较 并且一一使用很难破译哪个测试失败 看看我们可能想忽略哪个 如果有一种简单的方法来显示故障嗅探 那么我可以更轻松 更快地完成配置 您可以使用 s
  • 从 stdin 读取后,PHP 在每行上给出尾随“=”

    stdin 的内容因自动换行和尾随 而被损坏 这显然破坏了我需要发布的 URL 我需要从电子邮件中提取 URL 链接 然后发布该 URL 因此 我使用我在互联网上看到的标准代码片段将电子邮件传输到 cpanel 中的 php 脚本 fd f
  • MySQL 和 PHP:多关键字搜索

    我有一个包含逗号分隔关键字的字符串 例如 keywords keyword1 keyword2 keyword3 我的表架构 名为tbl address是这样的 简化的 id INT 11 PRIMARY KEY AUTO INCREMEN
  • PHP:__toString() 和 json_encode() 不能很好地协同工作

    我遇到了一个奇怪的问题 我不知道如何解决它 我有几个类 它们都是 JSON 对象的 PHP 实现 这是问题的说明 class A protected a public function construct this gt a array n
  • 对需要发送标头的项目进行单元测试

    我目前正在与 PHPUnit 合作 尝试在我正在编写的内容的同时开发测试 但是 我目前正在编写会话管理器 并且在这样做时遇到了问题 Session 处理类的构造函数是 private function construct if header
  • 在 WooCommerce 订单和电子邮件中添加并显示自定义购物车项目数据

    我有一个名为彩票的自定义 woocommerce 产品类型 我需要在其上添加一个自定义选择字段 因为它不是可变产品 所以我添加了一个 一切工作正常 我在购物车和结帐中也获得了价值 但我无法在管理订单或订单邮件 客户和管理员 中获得价值 这是
  • 使用 getJSON 未显示 JSON 数据

    document ready function getJSON news php parseInfo function parseInfo data alert data news undefined info html data news
  • PHP 和 ASP.Net 可以在 IIS 7.5 中的同一网站中一起运行吗?

    我们网站的一部分是用 PHP 完成的 而我们网站的一部分是用 ASP Net 完成的 我们刚刚使用 Windows Server 2008 R2 设置了一个新的 Web 服务器 其中安装了 IIS 7 5 我知道 IIS 7 支持 PHP
  • 密码验证 PHP 正则表达式

    我是正则表达式的新手 我需要使用 php 验证密码 并使用正则表达式执行以下密码策略 密码 必须至少有 8 个字符 必须有2个号码 允许的符号有 我已经尝试过以下方法 d A Za z 0 9A Za z 以下完全符合您的要求 d d 0
  • 即使 is_dir 是一个目录,它也会返回 false 吗?

    为什么 is dir 即使是一个目录也会返回 false 没有返回错误 path mysql var lib mysql if is dir path mysql echo error 返回错误 path mysql var lib mys
  • 如何使 WordPress 中的自定义模板充当受密码保护的页面?

    我正在使用自定义模板构建一个页面 问题是 我需要此页面受密码保护 或者至少可供登录用户访问 但即使我在 WordPress 管理的新页面部分中将其设置为此类 私人 密码保护 它也不会显示菜单项和内容 如果是私有的 或者它会立即显示页面内容
  • Symfony 4.1 组件 - 依赖注入问题

    我正在用 PHP 重构旧应用程序 我正在尝试使用 Symfony 依赖注入组件将服务注入控制器 或其他服务 但我不知道如何实现这一点 因为 symphony 文档比框架组件更适合使用框架 我已经有了自己的内核 包含所有服务和控制器的容器 控
  • 按时间戳字段中的日期过滤结果

    我已经获得了一些帮助 但不确定为什么这不起作用 我正在尝试使用表单让用户过滤他们的活动 存储在数据库中 My code GET from 01 11 2013 GET to 25 11 2013 from DateTime createFr
  • 如何在 Api-Platform 中按链接属性过滤结果?

    我有一个User实体和一个Organisation实体 存在关系ManyToOne之间Booking and User ORM ManyToOne targetEntity App Entity User inversedBy bookin
  • PHP strtotime返回Mysql UNIX_TIMESTAMP的不同值

    我在 stackoverflow 上搜索过帖子 发现了一些类似的帖子 但我认为这是一篇不同的帖子 我的 PHP 和 Mysql 服务器的时区全部设置为 UTC 在表中我使用时间戳字段 值为 2010 11 08 02 54 15 我使用这样
  • 在 Laravel 视图中使用 CSS?

    我刚刚开始学习 Laravel 并且可以掌握控制器和路由的基础知识 我的操作系统是 Mac OS X Lion 它位于 MAMP 服务器上 我的routes php代码 Route get function return View make
  • PDO 返回不正确但重复的数据。密钥不在数据库中。

    我刚开始使用 pdo 语句 所以可能是一些简单的东西 我还没有在 php net 上读过 查询数据库时我收到重复的结果 Result 0 gt Array umeta id gt 31 0 gt 31 user id gt 2 1 gt 2

随机推荐

  • Android Action Bar 选项卡 - 内部片段事务问题

    我已经使用 Google 自己的以下示例成功在操作栏中设置了选项卡 http developer android com resources samples ApiDemos src com example android apis app
  • 引用system.web.cors

    我正在尝试在我的 Web API 中实现 cors 支持 我已经阅读了有关此主题的几篇博客文章 但我似乎找不到 System Web Cors dll 或 System Web Http Cors dll 我需要安装什么东西吗 创建一个 N
  • 将列表 java.awt.geom.Point2D 转换为 java.awt.geom.Area

    我有一组点 我想将它们变成 Java 中的闭合多边形 我目前正在尝试使用 java awt geom Point2D 和 java awt geom Area 但无法弄清楚如何将一组点转换为区域 我想我可以根据这些点定义一组 Line2D
  • 通过 Visual Studio 运行应用程序时出现“访问冲突”

    当我从 Visual Studio 中运行命令行应用程序时 一个命令总是失败并出现以下错误 The program 7316 MyProgram vshost exe has exited with code 1073741819 0xc0
  • 如何删除文件夹中的所有文件,但不删除文件夹本身?

    我尝试删除文件夹中的所有文件 包括子目录 NSFileManager deleteMgr NSFileManager defaultManager NSString path test deleteMgr removeItemAtPath
  • UISearchBar纯色

    我想要一个带有纯色而不是渐变的 UISearchBar 我有这个 UISearchBar mySearchBar UISearchBar alloc initWithFrame self tableView bounds mySearchB
  • MVC4 是否已融入 .NET 4.5?

    Visual Studio 2012 的许多发行说明都谈到 NET 4 5 和 MVC4 但我无法判断 MVC4 是否实际上是 NET 4 5 版本的一部分 有人确切知道吗 我希望不必在我的服务器上单独安装 MVC 不 ASP NET MV
  • 我应该使用什么列类型/长度来在数据库中存储 Bcrypt 哈希密码?

    我想在数据库中存储散列密码 使用 BCrypt 哪种类型比较合适 哪种长度合适 使用 BCrypt 散列的密码是否始终具有相同的长度 EDIT 哈希示例 2a 10 KssILxWNR6k62B7yiX0GAe2Q7wwHlrzhF3Lqt
  • 调用基函数,然后调用继承函数

    我有一个基类和一个继承基类的类 基类有几个虚函数 继承类可以重写这些虚函数 但是 基类中的虚拟函数具有必须在调用继承类重写之前运行的代码 有什么方法可以让我先调用基类虚函数 然后再调用继承的类重写 无需调用base function 我知道
  • 如何从XML文件读取数据并将其存储到数据库(MySQL)中?

    我需要从 XML 文件获取数据并将其存储到 MySQL 数据库中 我正在考虑使用 SAX 解析器来解析数据 但我不确定如何将数据有效地存储到数据库中 我正在考虑一些技术 例如JDBC http en wikipedia org wiki J
  • Python、Selenium 和 Beautiful Soup for URL

    我正在尝试使用 Selenium 编写一个脚本来访问 Pastebin 进行搜索并以文本形式打印 URL 结果 我需要可见的 URL 结果 仅此而已 div class gs bidi start align gs visibleUrl g
  • 监控应用程序对 DLL 的调用

    简而言之 我想监视从应用程序到 DLL 的选定调用 我们有一个旧的 VB6 应用程序 我们丢失了它的源代码 当时公司没有使用源代码控制 此应用程序使用第 3 方 DLL 我想在新的 C 应用程序中使用这个 DLL 不幸的是 DLL API
  • 如果存储过程中参数为空,则选择全部

    我想在 SQL Server 中创建一个过程来选择并连接两个表 参数 company from 和 to 始终被设置 但 serie type 可以为NULL 如果 serie type不为NULL我只想包含指定的类型 简单AND S Ty
  • 我们什么时候应该将 String 更改为 Stringbuilder?

    在应用程序中 字符串是一种常用的数据类型 我们知道 字符串的突变会占用大量内存 所以我们能做的就是使用 StringBuilder StringBuffer 但什么时候我们应该改用 StringBuilder 呢 当我们必须拆分它或替换其中
  • 使用 apache ant 构建时未找到属性“hardwareAccelerated”的资源标识符

    我的应用程序针对 android API 级别 7 2 1 在 Eclipse 下一切正常 生成的 APK 在 2 1 设备上也可以正常工作 我尝试使用 apache ant 构建应用程序并收到此错误 相同问题的所有解决方案都告诉我必须设置
  • YouTube API - 通过播放列表查询获取所有视频的标签

    我正在查询 YouTube 频道以检索播放列表元数据 如下所示 https www googleapis com youtube v3 playlistItems part snippet 2CcontentDetails maxResul
  • getEdgeFlags 总是返回 0?

    为什么我无法获取getEdgeFlags 是否能够检测到边缘触摸 我延长了DrawerLayout 然后做了 Override public boolean onInterceptTouchEvent MotionEvent ev int
  • 有什么方法可以在 Swift 中逐渐加快游戏速度吗?

    我目前正在使用 Spritekit 开发一款游戏 游戏中的物体会在屏幕顶部产生并落向玩家角色 当玩家角色与任何物体碰撞时游戏结束 我正在尝试找到一种方法 随着时间的推移逐渐加快游戏速度 使游戏变得更加困难 即游戏开始时物体以正常速度下落 5
  • php 会话在服务器中存储多长时间?

    我想知道 php 会话在服务器内存中存储多长时间 如果用户登录 在服务器中设置会话变量 并且他使浏览器长时间打开 假设 30 天 并且他在第 31 天重新加载页面 该怎么办 浏览器可以访问会话变量 浏览器仍然有会话cookie 吗 默认 p
  • 如何在 Ubuntu 14.04 上安装 php7 (zts) + pthreads

    我需要完整安装 PHP7 ZTS Pthreads 的帮助 我已尝试以下安装但无法使其工作 sudo i apt get update apt get install y git bison autoconf build essential