我试图在 ubuntu 中更新我现有的作曲家版本。
我尝试检查版本,但 ubuntu 说找不到包。
然后我再次尝试sudo apt install composer
安装作曲家。
现在当我检查作曲家的版本时。它显示 1.6.3,如果我尝试/home/alok/composer.phar
,那么作曲家的版本是 2.0.4。
我很困惑。我应该怎么办?
请帮我解决这个问题。
(我刚从ubuntu 18.04 迁移到 Ubuntu 20.04。)
php7.4-mysql : Depends: php7.4-common (= 7.4.3-4ubuntu2.2) but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
php7.4-mysql
取决于on php7.4-common
(已安装,因此我看不到那里的问题),但它也说(= 7.4.3-4ubuntu2.2)
然后我迷路了... 7.4.3-4ubuntu2.2?那是什么?如果这还不够复杂,它会增加......but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1
然后我就是不知道如何超越这个。$ php artisan migrate
在我自己的生产环境中使用该命令(我租用了一个主机,我只是在搞乱它),我得到了输出...... Illuminate\Database\QueryException
could not find driver (SQL: select * from information_schema.tables where table_schema = gastigram and table_name = migrations and table_type = 'BASE TABLE')
at vendor/laravel/framework/src/Illuminate/Database/Connection.php:671
667| // If an exception occurs when attempting to run a query, we'll format the error
668| // message to include the bindings with SQL, which will make this exception a
669| // lot more helpful to the developer instead of just the database's errors.
670| catch (Exception $e) {
> 671| throw new QueryException(
672| $query, $this->prepareBindings($bindings), $e
673| );
674| }
675|
+34 vendor frames
35 artisan:37
Illuminate\Foundation\Console\Kernel::handle()
$ sudo apt install php7.4-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
php7.4-mysql : Depends: php7.4-common (= 7.4.3-4ubuntu2.2) but 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 is to be installed
E: Unable to correct problems, you have held broken packages.
由于包损坏,如何解决未满足的依赖关系的问题?
$ apt-cache policy php7.4-common
按照@guiverc 的建议运行这是输出
php7.4-common:
Installed: 7.4.9-1+ubuntu18.04.1+deb.sury.org+1
Candidate: 7.4.9-1+ubuntu18.04.1+deb.sury.org+1
Version table:
*** 7.4.9-1+ubuntu18.04.1+deb.sury.org+1 100
100 /var/lib/dpkg/status
7.4.3-4ubuntu2.2 500
500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
500 http://us.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages
7.4.3-4ubuntu1 500
500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
我有 Ubuntu 18.04、Laravel 和 PHP7.4。当我执行例如命令时,ls
我有文件夹列表和:
user1@bpl:/var/www/html/storage$ ls
app framework logs
You have new mail in /var/mail/user1
当我这样做时,cat /var/mail/user1
我有文件的内容:
From user1@bpl Tue Mar 3 14:30:01 2020
Return-Path: <user1@bpl>
X-Original-To: user1
Delivered-To: user1@bpl
Received: by bpl (Postfix, from userid 1000)
id 3264910126D; Tue, 3 Mar 2020 14:30:01 +0000 (UTC)
From: root@bpl (Cron Daemon)
To: user1@bpl
Subject: Cron <user1@bpl> $PHP $ARTISAN transaction:verify >> $LOGS 2>&1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Cron-Env: <PHP=/usr/bin/php>
X-Cron-Env: <ARTISAN=/var/www/html/artisan>
X-Cron-Env: <LOGS=/var/www/html/storage/logs/cron.log>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/user1>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=user1>
Message-Id: <20200303143001.3264910126D@bpl>
Date: Tue, 3 Mar 2020 14:30:01 +0000 (UTC)
/bin/sh: 1: cannot create /var/www/html/storage/logs/cron.log: Permission denied
文件夹日志的权限如下所示:
user1@bpl:/var/www/html/storage$ ls -al
total 20
drwxrwxr-x 5 www-data www-data 4096 Feb 24 14:36 .
drwxr-xr-x 13 www-data www-data 4096 Feb 29 02:06 ..
drwxrwxr-x 3 www-data www-data 4096 Feb 28 15:13 app
drwxrwxr-x 6 www-data www-data 4096 Feb 24 14:36 framework
drwxrwxr-x 2 www-data www-data 4096 Mar 3 14:02 logs
任务事务验证来自 cron。此任务被添加到用户 cron。如何启用将这些日志写入此文件?
我是第一次尝试深入研究 linux 开发的 IIS 男孩,所以请温柔一点。
好的,所以...我正在尝试配置我的工作站以在 laravel 上进行开发。
我在 Ubuntu 18.04 上,并且已经安装了 apache。我已经从 composer 安装了 laravel,并创建了第一个项目:
composer create-project --prefer-dist laravel/laravel mySite "5.8.*"
这在 /etc/apache2/sites-enabled 上创建了一个名为 mySite 的 laravel 项目文件夹
我添加了一个新文件 /etc/apache2/sites-available/mySite.conf ,它看起来像这样:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName mySite
ServerAlias www.mySite
DocumentRoot /etc/apache2/sites-enabled/mySite/public/index.php
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined</VirtualHost>
之后,我在 /etc/apache2/apache2.conf 中添加了一行:
Include /etc/apache2/sites-available/mySite.conf
而且,当然,我已经将我的虚拟网站列入了同一个文件的白名单:
<Directory /etc/apache2/sites-available/mySite>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
我已经运行了 a2ensite 并重新启动了 apache。
但是,在尝试访问http://localhost/mySite或http://localhost/mySite/public/index.php时,我一直收到 403 错误(禁止访问。您无权访问此资源。) ,使用 127.0.0.1 而不是 localhost 会引发相同的错误。
欢迎对此问题的任何见解。
这类似于这个问题,但我的情况有点不同。
我在 Ubuntu 18.04 上运行 laravel、composer 和 valet。我正在尝试运行php artisan migrate
,它会引发与无法连接到 mysql 数据库相关的错误。
Illuminate\Database\QueryException : SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost' (SQL: select * from information_schema.tables where table_schema = blog and table_name = migrations)
at /home/david/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 PDOException::("SQLSTATE[HY000] [1698] Access denied for user 'root'@'localhost'")
/home/david/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
2 PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=blog", "root", "", [])
/home/david/Sites/blog/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68
我似乎很清楚 .env 文件不包含正确的信息……但确实如此。这是我的 .env 用于 mysql 数据库:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=blog
DB_USERNAME=root
DB_PASSWORD=
我尝试进入的数据库名为 blog,用户名为 root,密码为空。这就是我在我的机器上访问 mysql 的方式......sudo mysql -uroot -p
它让我直接登录。
知道可能出了什么问题吗?
我正在尝试安装 Laravel 包名称bitwasp但此包依赖于bcmath
. 每当我尝试安装时,它都会给我一个错误。我也尝试使用以下命令安装它:
sudo apt-get install php7.1-bcmath
但每当我这样做时,我的 Ubuntu 也是 17.10 时出现以下错误:
After this operation, 128 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-gd amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:2 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-bz2 amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:3 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-opcache amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:4 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-json amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:5 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-mcrypt amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:6 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-zip amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:7 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-curl amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:8 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-xml amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:9 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-mbstring amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:10 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-mysql amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:11 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-readline amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:12 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 libapache2-mod-php7.1 amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:13 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-cli amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:14 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-common amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
Err:15 http://ppa.launchpad.net/ondrej/php/ubuntu artful/main amd64 php7.1-bcmath amd64 7.1.12-2+ubuntu17.10.1+deb.sury.org+2
404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-gd_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-bz2_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-opcache_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-json_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-mcrypt_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-zip_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-curl_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-xml_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-mbstring_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-mysql_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-readline_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/libapache2-mod-php7.1_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-cli_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-common_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php/ubuntu/pool/main/p/php7.1/php7.1-bcmath_7.1.12-2+ubuntu17.10.1+deb.sury.org+2_amd64.deb 404 Not Found
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
已经运行update
并且fix-missing
没有任何反应,每次我遇到同样的错误。