安裝wxPHP後,apache沒法啓動

apache沒法啓動,現象:
瀏覽器打開localhost,一直在等待中。php

查看apache2的error日誌,看到:html

tail -100  /var/log/apache2/error.log
...
[Mon Feb 15 11:25:32 2016] [error] [client 10.0.0.163] Negotiation: discovered file(s) matching request: /var/www/index.html (None could be negotiated).
11:25:32: Error: Unable to initialize GTK+, is DISPLAY set properly?

(apache2:6670): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(apache2:6670): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(apache2:6670): GLib-GObject-WARNING **: invalid (NULL) pointer instance

(apache2:6670): GLib-GObject-CRITICAL **: g_signal_connect_data: assertion `G_TYPE_CHECK_INSTANCE (instance)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_colormap_get_visual: assertion `GDK_IS_COLORMAP (colormap)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_screen_get_default_colormap: assertion `GDK_IS_SCREEN (screen)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_screen_get_root_window: assertion `GDK_IS_SCREEN (screen)' failed

(apache2:6670): Gdk-CRITICAL **: IA__gdk_window_new: assertion `GDK_IS_WINDOW (parent)' failed
[Mon Feb 15 11:25:32 2016] [notice] child pid 6666 exit signal Segmentation fault (11)
[Mon Feb 15 11:25:32 2016] [notice] child pid 6667 exit signal Segmentation fault (11)
[Mon Feb 15 11:25:32 2016] [notice] child pid 6668 exit signal Segmentation fault (11)
[Mon Feb 15 11:25:32 2016] [notice] child pid 6669 exit signal Segmentation fault (11)
[Mon Feb 15 11:25:32 2016] [notice] child pid 6670 exit signal Segmentation fault (11)
[Mon Feb 15 11:29:11 2016] [notice] caught SIGTERM, shutting down
[Mon Feb 15 11:29:12 2016] [notice] Apache/2.2.22 (Debian) PHP/5.4.45-0+deb7u2 configured -- resuming normal operations

查看apache2的php模塊:mysql

shen@debian:~$ ls  -lrt /etc/php5/apache2/conf.d/
總用量 0
lrwxrwxrwx 1 root root 25  8月 31 13:36 10-pdo.ini -> ../mods-available/pdo.ini
lrwxrwxrwx 1 root root 27  8月 31 13:36 20-mysql.ini -> ../mods-available/mysql.ini
lrwxrwxrwx 1 root root 28  8月 31 13:36 20-mysqli.ini -> ../mods-available/mysqli.ini
lrwxrwxrwx 1 root root 31  8月 31 13:36 20-pdo_mysql.ini -> ../mods-available/pdo_mysql.ini
lrwxrwxrwx 1 root root 24  9月  5 10:02 20-gd.ini -> ../mods-available/gd.ini
lrwxrwxrwx 1 root root 28  9月  5 10:02 20-mcrypt.ini -> ../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root 27  9月  9 09:41 20-redis.ini -> ../mods-available/redis.ini
lrwxrwxrwx 1 root root 26  9月 21 13:40 20-curl.ini -> ../mods-available/curl.ini
lrwxrwxrwx 1 root root 28  1月 10 14:39 20-xdebug.ini -> ../mods-available/xdebug.ini
lrwxrwxrwx 1 root root 27  2月  4 13:14 20-cairo.ini -> ../mods-available/cairo.ini
lrwxrwxrwx 1 root root 31  2月  4 13:53 20-wxwidgets.ini -> ../mods-available/wxwidgets.ini

最新的兩個php模塊cairo和wxwidgets是在安裝wxPHP時引入的,只有cli-php才須要,apache-php不須要。
可是當前狀況下,cli-php和apache-php的模塊列表是同樣的。web

shen@debian:~$ ls  -l /etc/php5/cli/
總用量 64
lrwxrwxrwx 1 root root     9  8月 16  2015 conf.d -> ../conf.d
-rw-r--r-- 1 root root 64017  8月 16  2015 php.ini
shen@debian:~$ 
shen@debian:~$ 
shen@debian:~$ ls  -l /etc/php5/apache2/
總用量 64
lrwxrwxrwx 1 root root     9  8月 16  2015 conf.d -> ../conf.d
-rw-r--r-- 1 root root 64340  9月  5 15:25 php.ini
shen@debian:~$ ls  -l /etc/php5/cli/
總用量 64
lrwxrwxrwx 1 root root     9  8月 16  2015 conf.d -> ../conf.d
-rw-r--r-- 1 root root 64017  8月 16  2015 php.ini
shen@debian:~$ ls  -l /etc/php5/
總用量 20
drwxr-xr-x 2 root root 4096  1月 10 16:16 apache2
drwxr-xr-x 2 root root 4096  8月 31 13:36 cgi
drwxr-xr-x 2 root root 4096  2月  4 13:12 cli
drwxr-xr-x 2 root root 4096  2月  4 13:53 conf.d
drwxr-xr-x 2 root root 4096  2月  4 13:52 mods-available

解決方法: cli-php和apache-php的模塊列表分開設置:redis

shen@debian:~$ cd /etc/php5/apache2/
shen@debian:/etc/php5/apache2$ sudo rm -f conf.d
shen@debian:/etc/php5/apache2$ sudo cp -rL ../conf.d/ .
shen@debian:/etc/php5/apache2$ ls -l conf.d/
總用量 44
-rw-r--r-- 1 root root  66  2月 15 14:14 10-pdo.ini
-rw-r--r-- 1 root root  70  2月 15 14:14 20-cairo.ini
-rw-r--r-- 1 root root  68  2月 15 14:14 20-curl.ini
-rw-r--r-- 1 root root  64  2月 15 14:14 20-gd.ini
-rw-r--r-- 1 root root  72  2月 15 14:14 20-mcrypt.ini
-rw-r--r-- 1 root root  71  2月 15 14:14 20-mysqli.ini
-rw-r--r-- 1 root root  70  2月 15 14:14 20-mysql.ini
-rw-r--r-- 1 root root  74  2月 15 14:14 20-pdo_mysql.ini
-rw-r--r-- 1 root root  71  2月 15 14:14 20-redis.ini
-rw-r--r-- 1 root root  78  2月 15 14:14 20-wxwidgets.ini
-rw-r--r-- 1 root root 174  2月 15 14:14 20-xdebug.ini
shen@debian:/etc/php5/apache2$ sudo rm -f conf.d/20-wxwidgets.ini
shen@debian:/etc/php5/apache2$ sudo rm -f conf.d/20-cairo.ini 
shen@debian:/etc/php5/apache2$ ls -l conf.d/
總用量 36
-rw-r--r-- 1 root root  66  2月 15 14:14 10-pdo.ini
-rw-r--r-- 1 root root  68  2月 15 14:14 20-curl.ini
-rw-r--r-- 1 root root  64  2月 15 14:14 20-gd.ini
-rw-r--r-- 1 root root  72  2月 15 14:14 20-mcrypt.ini
-rw-r--r-- 1 root root  71  2月 15 14:14 20-mysqli.ini
-rw-r--r-- 1 root root  70  2月 15 14:14 20-mysql.ini
-rw-r--r-- 1 root root  74  2月 15 14:14 20-pdo_mysql.ini
-rw-r--r-- 1 root root  71  2月 15 14:14 20-redis.ini
-rw-r--r-- 1 root root 174  2月 15 14:14 20-xdebug.ini

cli-php下保留所有php模塊:sql

shen@debian:/etc/php5/apache2$ ls -l ../cli/conf.d/
總用量 0
lrwxrwxrwx 1 root root 25  8月 31 13:36 10-pdo.ini -> ../mods-available/pdo.ini
lrwxrwxrwx 1 root root 27  2月  4 13:14 20-cairo.ini -> ../mods-available/cairo.ini
lrwxrwxrwx 1 root root 26  9月 21 13:40 20-curl.ini -> ../mods-available/curl.ini
lrwxrwxrwx 1 root root 24  9月  5 10:02 20-gd.ini -> ../mods-available/gd.ini
lrwxrwxrwx 1 root root 28  9月  5 10:02 20-mcrypt.ini -> ../mods-available/mcrypt.ini
lrwxrwxrwx 1 root root 28  8月 31 13:36 20-mysqli.ini -> ../mods-available/mysqli.ini
lrwxrwxrwx 1 root root 27  8月 31 13:36 20-mysql.ini -> ../mods-available/mysql.ini
lrwxrwxrwx 1 root root 31  8月 31 13:36 20-pdo_mysql.ini -> ../mods-available/pdo_mysql.ini
lrwxrwxrwx 1 root root 27  9月  9 09:41 20-redis.ini -> ../mods-available/redis.ini
lrwxrwxrwx 1 root root 31  2月  4 13:53 20-wxwidgets.ini -> ../mods-available/wxwidgets.ini
lrwxrwxrwx 1 root root 28  1月 10 14:39 20-xdebug.ini -> ../mods-available/xdebug.ini

重啓apache2:apache

shen@debian:/etc/php5/apache2$ sudo /etc/init.d/apache2 restart
[ ok ] Restarting web server: apache2 ... waiting .

瀏覽器打開localhost,完美恢復。瀏覽器

相關文章
相關標籤/搜索