Apache 在 Ubuntu 16.04 升级后将 PHP 文件呈现为文本。
Apache 已安装并正在运行。PHP7 正在运行。当我执行以下命令时,我得到了正确的输出:
php -r 'echo "\n\nYour PHP installation is working fine.\n\n\n";'
Run Code Online (Sandbox Code Playgroud)
但是,当我访问http://localhost/info.php或任何其他 php 文件时,我得到的是文件内容而不是页面。
大多数在线帮助都是针对旧版本的 Ubuntu 和 PHP,所以我不确定它们是否可靠。
更新:安装 libapache2-mod-php7.0 并启用 php7.0 后,Apache 无法启动。见输出:
douglas@douglas-acer:~$ sudo service apache2 restart
douglas@douglas-acer:~$ sudo apt-get install libapache2-mod-php
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
libapache2-mod-php
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/2.960 …
Run Code Online (Sandbox Code Playgroud) 从 19.04 升级完成时出现错误,然后当我运行sudo apt-get upgrade
或 sudo apt-get install mysql-server
我得到:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up mysql-server-8.0 (8.0.17-0ubuntu2) ...
Renaming removed key_buffer and myisam-recover options (if present)
ERROR: Unable to start …
Run Code Online (Sandbox Code Playgroud)