我抓狂了,几乎有一天我试图重新安装 lampp,但它不起作用。
几乎有一天我都在徒劳地尝试在 ubuntu 14.04 LTS 上重新安装 lampp。我首先安装了带有 php 5.5.9 的 lamp,一切正常(我开发网站时没有任何问题),我想将我的 php 更新到 php7。然后我安装了 php7,但是当我在我的网站上执行 phpinfo() 时,我看到版本仍然是 5.5.9,而命令行 php -v 告诉我必须使用版本 7。因此,我尝试删除并重新安装 lamp,我遵循了几个教程,但不幸的是,我总是出错。
要重新安装灯,我按照本教程操作:教程在这里。但是当我这样做时sudo apt-get install apache2
,出现了以下错误:
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up php5-mysqlnd (5.5.9+dfsg-1ubuntu4.16) ...
Creating config file /etc/php5/mods-available/mysqlnd.ini with new version
cp: cannot create regular file '/etc/php5/mods-available/mysqlnd.ini': No such file or directory
dpkg: error processing package php5-mysqlnd (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of phpmyadmin:
phpmyadmin depends on php5-mysql | php5-mysqli | php5-mysqlnd; however:
Package php5-mysql is not installed.
Package php5-mysqli is not installed.
Package php5-mysqlnd is not configured yet.
dpkg: error processing package phpmyadmin (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
mysql-server-5.6
php5-mysqlnd
phpmyadmin
E: Sub-process /usr/bin/dpkg returned an error code (1)
dpkg --configure -a 的结果:
Setting up php5-mysqlnd (5.5.9+dfsg-1ubuntu4.16) ...
Creating config file /etc/php5/mods-available/mysqlnd.ini with new version
cp: cannot create regular file '/etc/php5/mods-available/mysqlnd.ini': No such file or directory
dpkg: error processing package php5-mysqlnd (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up mysql-server-5.6 (5.6.30-0ubuntu0.14.04.1) ...
2016-05-10 13:08:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-10 13:08:00 0 [Note] /usr/sbin/mysqld (mysqld 5.6.30-0ubuntu0.14.04.1) starting as process 15565 ...
2016-05-10 13:08:00 15565 [Note] Plugin 'FEDERATED' is disabled.
2016-05-10 13:08:00 15565 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-05-10 13:08:00 15565 [Note] InnoDB: The InnoDB memory heap is disabled
2016-05-10 13:08:00 15565 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-05-10 13:08:00 15565 [Note] InnoDB: Memory barrier is not used
2016-05-10 13:08:00 15565 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-05-10 13:08:00 15565 [Note] InnoDB: Using Linux native AIO
2016-05-10 13:08:00 15565 [Note] InnoDB: Using CPU crc32 instructions
2016-05-10 13:08:00 15565 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-05-10 13:08:00 15565 [Note] InnoDB: Completed initialization of buffer pool
2016-05-10 13:08:00 15565 [Note] InnoDB: Highest supported file format is Barracuda.
2016-05-10 13:08:00 15565 [Note] InnoDB: 128 rollback segment(s) are active.
2016-05-10 13:08:00 15565 [Note] InnoDB: Waiting for purge to start
2016-05-10 13:08:01 15565 [Note] InnoDB: 5.6.30 started; log sequence number 1626679
2016-05-10 13:08:01 15565 [Note] Binlog end
2016-05-10 13:08:01 15565 [Note] InnoDB: FTS optimize thread exiting.
2016-05-10 13:08:01 15565 [Note] InnoDB: Starting shutdown...
2016-05-10 13:08:02 15565 [Note] InnoDB: Shutdown completed; log sequence number 1626689
start: Job failed to start
invoke-rc.d: initscript mysql, action "start" failed.
dpkg: error processing package mysql-server-5.6 (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
php5-mysqlnd
mysql-server-5.6
谢谢 !
编辑:我找到了解决方案,我依次卸载mysql和php,然后安装apache即可。
我执行的命令(也许有些命令没用,但之后它就起作用了):
sudo apt-get purge mysql-client-core-5.6
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get install mysql-client-core-5.5
sudo apt-get install mysql-server
sudo apt-get -y purge php.*