php - 为什么我无法在 ubuntu 16.04 上安装 PHP

标签 php mysql laravel ubuntu-16.04

我一直在尝试在 ubuntu 16.04 上安装 laravel 3 天。我正在关注 laravel 安装过程的热门搜索链接。但是我没有执行我尝试过的每一个过程。现在我在我的 ubuntu 上安装 PHP 时遇到了不同的问题。我曾经安装过 maria db,但没有成功。 但它可能破坏了一些东西,导致我无法安装 PHP。我面临的问题:

Reading package lists... Done 
Building dependency tree       
Reading state information... Done
php is already the newest version (1:7.2+62+ubuntu16.04.1+deb.sury.org+3).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
mysql-server : Depends: mysql-server-5.7 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

当我尝试 php -v 时,它给了我这个错误

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20170718/mcrypt.so' (tried: /usr/lib/php/20170718/mcrypt.so (/usr/lib/php/20170718/mcrypt.so: cannot open shared object file: No such file or directory), /usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so (/usr/lib/php/20170718//usr/lib/php/20170718/mcrypt.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP 7.2.9-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Aug 19 2018 07:16:12) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.9-1+ubuntu16.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

我对 ubuntu 和 laravel 完全陌生。如果有人指导我如何在 ubuntu 16.04 上安装 laravel,我将非常感激。 谢谢。

最佳答案

  • 安装 git apt-get install git-core
  • git clone https://github.com/thamaraiselvam/LEMP-Stack-Installer.git

  • cd quick-lemp-install 或 cd LEMP-Stack-Installer

  • chmod +x lemp.sh 此命令使 bash 脚本可执行
  • ./lemp.sh 就是这样:)

PHP version - v7.0

Mysql version - Latest Stable

Note: Default mysql password is root. you can change it before running in the following lines before running the script

sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password YOUR_PASSWORD'

sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password YOUR_PASSWORD'

现在安装 Laravel

  • 转到 cd/var/www/html/
  • sudo apt-get install php-common php-mbstring php-xml php-zip
  • composer create-project --prefer-dist laravel/laravel blog "5.5.*"

关于php - 为什么我无法在 ubuntu 16.04 上安装 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52109270/

相关文章:

php - 有条件地将自定义结帐字段添加到 WooCommerce 中的运输部分

php - 为什么分配对静态类变量的引用会破坏此类变量的继承?

php - 在 MySQL 的 IN 子句中传递字符串变量

mysql - 想要使用 Mysql 仅显示月份为 '10' 的那些日期

MySQL 错误 2049 : Authentication protocol error

php - Laravel - php 如何在数据库中插入值时获取当前 Id?

javascript - php 联系表单返回字段名称而不是值

sql - 如何在 MySQL 存储过程中拆分逗号分隔的文本

Laravel s3 存储 : undefined method 'url'

laravel - 使用 axios get 请求发送对象