在Ubuntu上安装PHP 5.4

时间:2017-04-04 14:42:33

标签: php linux ubuntu php-5.4

所以我需要在ubuntu-16.04-server-amd64上安装PHP 5.4。其他一些主题建议

  • sudo add-apt-repository ppa:ondrej / php5-oldstable
  • sudo apt-get update
  • sudo apt-get install -y php5

但是这些不起作用,因为更新时会出现错误。

Reading package lists... Done
W: The repository 'http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu xenial Release' does not have a Release file.
N: Data from such a repository can't be authenticated and is therefore potentially dangerous to use.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: Failed to fetch http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Failed to fetch http://ppa.launchpad.net/ondrej/php5-oldstable/ubuntu/dists/xenial/main/binary-i386/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

建议采取什么行动?

1 个答案:

答案 0 :(得分:0)

你可以使用docker吗?另一种方法只能从源代码编译php

  

docker run --name app --net mysql_net -d -p 8080:80 \ -v   / host / to / path / app:/ var / www / app / \ -v   / host / to / path / config_apache:/ etc / apache2 / sites-enabled / \
  romeoz /搬运工-Apache的PHP:5.4

/host/to/path/app - 您的应用和路径 /host/to/path/config_apache - apache配置的路径(通过此链接进行配置的基本文件https://github.com/romeOz/docker-apache-php/blob/master/5.4/configs/app.conf

然后up容器为mysql

  

docker run --name db --net mysql_net -d \ -v   / host / to / path / data:/ var / lib / mysql \ romeoz / docker-mysql:5.5

/host/to/path/data - 您的数据库数据路径

现在您可以按主持人db使用数据库了 应用程序可用 http://localhost:8080