AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-4315597

Mayor of the Plattenbaus's questions

Martin Hope
Mayor of the Plattenbaus
Asked: 2025-02-12 05:56:43 +0800 CST

带有 sqlite 的 API 平台:找不到驱动程序

  • 6

我正在使用API Platform Symfony 环境的轻微修改版本。由于该环境中内置的 postgres 系统的一部分目前对我来说不起作用,因此我重新使用 sqlite 作为数据库提供程序。

在浏览器中加载我的 Symfony 应用程序的任何数据库连接页面时,我都会得到一些意料之中的结果An exception occurred in the driver: could not find driver。这是有道理的,因为 docker compose 设置默认未配置为使用 sqlite。

令我惊讶的是,在相关机器上安装驱动程序实际上有多么困难。根据在其他一些问题/答案中看到的信息,以下是我尝试添加到 Dockerfile 中但没有成功的内容:

RUN apt update && apt upgrade -y
RUN apt-get install -y ca-certificates apt-transport-https
RUN apt-get install -y software-properties-common
RUN apt-get install -y python3-launchpadlib
RUN add-apt-repository http://archive.ubuntu.com/ubuntu noble-updates/main
RUN add-apt-repository ppa:ondrej/php
RUN apt update
RUN apt upgrade
RUN apt install -y php7.3-sqlite3
RUN rm -rf /var/lib/apt/lists/*

不幸的是,执行时会产生以下输出docker compose build --no-cache:

=> ERROR [php frankenphp_base  9/17] RUN apt update                                                                                                         0.8s
------
 > [php frankenphp_base  9/17] RUN apt update:
0.150 
0.150 WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
0.150 
0.223 Hit:1 http://deb.debian.org/debian bookworm InRelease
0.225 Hit:2 http://deb.debian.org/debian bookworm-updates InRelease
0.239 Hit:3 http://deb.debian.org/debian-security bookworm-security InRelease
0.345 Ign:4 https://ppa.launchpadcontent.net/ondrej/php/ubuntu bookworm InRelease
0.372 Err:5 https://ppa.launchpadcontent.net/ondrej/php/ubuntu bookworm Release
0.372   404  Not Found [IP: 185.125.190.80 443]
0.452 Reading package lists...
0.763 E: The repository 'https://ppa.launchpadcontent.net/ondrej/php/ubuntu bookworm Release' does not have a Release file.
------
failed to solve: process "/bin/sh -c apt update" did not complete successfully: exit code: 100

有人知道安装这个难以捉摸的包(或功能等效包)的巧妙方法吗?

===

编辑:我后来才意识到我找错了方向。我的应用程序是通过symfony serve主机系统提供的,而不是在 docker 容器内提供的。我一意识到这一点,就确认apt 包已经安装。之后,只需取消注释文件php-sqlite3中的行,然后重新启动命令即可……瞧!一切正常!php.ini;extension=pdo_sqlitesymfony serve

sqlite
  • 1 个回答
  • 44 Views
Martin Hope
Mayor of the Plattenbaus
Asked: 2024-11-18 03:53:28 +0800 CST

为什么当我尝试在 bash 脚本中读取 tmp 文件时会出现“不是有效标识符”的情况?

  • 5

我正在使用带有一些内联 Python 的 Bash 脚本来读取 JSON API。我取出一小部分输出并将其转储到临时文件中。我知道临时文件存在,因为我能够head对其运行操作。但是,当需要实际迭代文件中的行时,我收到如下错误read: /tmp/temporary_tag_storage.H9hEH6': not a valid identifier

以下是我的脚本的完整相关部分:

#!/usr/bin/env bash

getTagByNumber () {
    SOMETHING=$(curl -s 'https://localhost:8000/api/tagstubs' | \
        python3 -c "import sys, json; print(json.load(sys.stdin)[$1]['tag'])")
    echo "$SOMETHING" >&3
}

TAGNUMBER=0;
tmpfile=$(mktemp /tmp/temporary_tag_storage.XXXXXX)
# create file descriptor 3 for writing to a temporary file so that
# echo ... >&3 writes to that file
exec 3>"$tmpfile"
# create file descriptor 4 for reading from the same file so that
# the file seek positions for reading and writing can be different
exec 4<"$tmpfile"
while [ $TAGNUMBER -lt 5 ]
do
    getTagByNumber $TAGNUMBER $TAGS
    TAGNUMBER=$(( $TAGNUMBER + 1 ))
done

#This works, dutifully spitting out five lines of text.
head -n $TAGNUMBER <&4

#So why does this give me "not a valid identifier"?
while read $tmpfile; do
  echo "$p"
done
#rm "$tmpfile"

...输出如下:

politics
sports
religion
film
television
./createtags.sh: line 83: read: `/tmp/temporary_tag_storage.H9hEH6': not a valid identifier

如您所见,第一次尝试读取标签成功,输出了一堆主题名称。这就是为什么我对第二次while循环失败感到困惑。

我尝试$tmpfile在第二个循环的定义中用双引号括住变量名while,但这似乎没有帮助。

有谁知道我做错了什么?

bash
  • 1 个回答
  • 28 Views
Martin Hope
Mayor of the Plattenbaus
Asked: 2023-09-03 16:43:15 +0800 CST

安装 Laravel Jetstream 时如何解决“意外保留字”?

  • 5

我按照https://jetstream.laravel.com/installation.html上的说明安装 Laravel Jetstream。

我运行artisan jetstream:install并选择安装 Livewire 支持、API 支持、电子邮件验证和 PHPUnit 支持。

然后我npm install按照说明运行,一切似乎都正常。

最后,我npm run build按照说明运行。呃哦!我现在收到以下消息:

> build
> vite build

file:///home/mrmayor/Documents/coding-projects/super-great-project/backend/node_modules/vite/bin/vite.js:7
    await import('source-map-support').then((r) => r.default.install())
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:133:18)
    at async link (internal/modules/esm/module_job.js:42:21)

知道我做错了什么吗?

  • 1 个回答
  • 18 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    重新格式化数字,在固定位置插入分隔符

    • 6 个回答
  • Marko Smith

    为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会?

    • 2 个回答
  • Marko Smith

    VScode 自动卸载扩展的问题(Material 主题)

    • 2 个回答
  • Marko Smith

    Vue 3:创建时出错“预期标识符但发现‘导入’”[重复]

    • 1 个回答
  • Marko Smith

    具有指定基础类型但没有枚举器的“枚举类”的用途是什么?

    • 1 个回答
  • Marko Smith

    如何修复未手动导入的模块的 MODULE_NOT_FOUND 错误?

    • 6 个回答
  • Marko Smith

    `(表达式,左值) = 右值` 在 C 或 C++ 中是有效的赋值吗?为什么有些编译器会接受/拒绝它?

    • 3 个回答
  • Marko Smith

    在 C++ 中,一个不执行任何操作的空程序需要 204KB 的堆,但在 C 中则不需要

    • 1 个回答
  • Marko Smith

    PowerBI 目前与 BigQuery 不兼容:Simba 驱动程序与 Windows 更新有关

    • 2 个回答
  • Marko Smith

    AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String”

    • 1 个回答
  • Martin Hope
    Fantastic Mr Fox msvc std::vector 实现中仅不接受可复制类型 2025-04-23 06:40:49 +0800 CST
  • Martin Hope
    Howard Hinnant 使用 chrono 查找下一个工作日 2025-04-21 08:30:25 +0800 CST
  • Martin Hope
    Fedor 构造函数的成员初始化程序可以包含另一个成员的初始化吗? 2025-04-15 01:01:44 +0800 CST
  • Martin Hope
    Petr Filipský 为什么 C++20 概念会导致循环约束错误,而老式的 SFINAE 不会? 2025-03-23 21:39:40 +0800 CST
  • Martin Hope
    Catskul C++20 是否进行了更改,允许从已知绑定数组“type(&)[N]”转换为未知绑定数组“type(&)[]”? 2025-03-04 06:57:53 +0800 CST
  • Martin Hope
    Stefan Pochmann 为什么 {2,3,10} 和 {x,3,10} (x=2) 的顺序不同? 2025-01-13 23:24:07 +0800 CST
  • Martin Hope
    Chad Feller 在 5.2 版中,bash 条件语句中的 [[ .. ]] 中的分号现在是可选的吗? 2024-10-21 05:50:33 +0800 CST
  • Martin Hope
    Wrench 为什么双破折号 (--) 会导致此 MariaDB 子句评估为 true? 2024-05-05 13:37:20 +0800 CST
  • Martin Hope
    Waket Zheng 为什么 `dict(id=1, **{'id': 2})` 有时会引发 `KeyError: 'id'` 而不是 TypeError? 2024-05-04 14:19:19 +0800 CST
  • Martin Hope
    user924 AdMob:MobileAds.initialize() - 对于某些设备,“java.lang.Integer 无法转换为 java.lang.String” 2024-03-20 03:12:31 +0800 CST

热门标签

python javascript c++ c# java typescript sql reactjs html

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve