Linux被玩坏了,由Ubuntu安装软件造成的php5集体罢工


昨天在虚拟机ubuntu 11上安装php5-redis模块
用了各种搜索(百度+googl)办法找到软件或方法。。。过程省略。。。但是好像提示缺少什么依赖,最开始是java7-runtime和php5-redis,然后也是各种找答案。。。还有个狗屎一样的什么依赖软件phpapi-20121212+lfs,找啊找~~~~~,又和php5-common有关,也是用了官网给的各种deb装上了(php5-redis仍然没装上)。在以上所有过程中(具体哪一步忘了)用了提示中的apt-get -f install 强制安装,然后提示我会删除一些软件,会重装一些软件,然后,什么软件都没重装上,不知道是不是没有一个牛逼的ubuntu源(我用的网易,台湾,163,搜狐。。。),然后后面的过程不管是安装或卸载(包括强制和带依赖的卸载)都会提示如下:

Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
charles-proxy : Depends: java6-runtime or
java7-runtime
libapache2-mod-php5 : Depends: php5-common (= 5.4.9-4ubuntu2.4) but 6.2+dfsg-1 is to be installed
php5-cli : Depends: php5-common (= 5.4.9-4ubuntu2.4) but 5.6.2+dfsg-1 is to be installed
php5-curl : Depends: php5-common (= 5.4.9-4ubuntu2.4) but 5.6.2+dfsg-1 is to be installed
php5-gd : Depends: php5-common (= 5.4.9-4ubuntu2.4) but 5.6.2+dfsg-1 is to be installed
php5-mysql : Depends: php5-common (= 5.4.9-4ubuntu2.4) but 5.6.2+dfsg-1 is to be installed
php5-redis : Depends: phpapi-20121212+lfs but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

以上很好奇地是charles我是装上的,它提示的java7-runtime我是找的官网的压缩包手动安装的。我的php-storm都跑得好好的,charles也可以跑。。。为毛。

很久以来,不知道是多少次开始觉得Ubuntu不友好了,老大让我换centOS或者fedora,如果大家给不了建设性的意见的话,我就只有考虑重装一个或者换其他linux了(个人认为这不是解决之道,我的项目还部署在上面呢,重新搭建我司用的开发环境要很久。。。)。

不管你是一只菜鸟或老鸟。。。so,拜托了,我先装个备用的。

Linux 安装依赖 Ubuntu php5相关软件

千D夜をこえて 10 years, 2 months ago

ubuntu 基于debian 但是比debian 难用 redis 模块的话 应该很好安装 这只是个扩展,不管你是编译安装的还是apt 安装的php 都是可以动态的载入模块的方式
这里有说明:
https://github.com/nicolasff/phpredis

ljzasx answered 10 years, 2 months ago

千万不要听那个50分钟的。

理由1:平心而论,从题主的水平看,应该没办法驾驭ubuntu,更别提gentoo了。
理由2:gentoo的pecl-redis和ubuntu的php-redis等价。在两个系统上装上这两个都会自动给你装上php。
理由3:gentoo的USE,例如php的mysql的USE,开了和ubuntu装上php5-mysql等价。php的gd的USE和ubuntu的php5-gd等价。无非就是一个用USE,一个用拆包的方式而已。centos同ubuntu,拆包方式代替USE。
理由4:真的能处理好gentoo的依赖问题么。

根据目前题住透露出来的部分信息来看,
题主用centos7及以上版本/ubuntu的14.04、15.04、16.04版本(如果有的话) 会更好一点。

gentoo不是万能的,盲目信任gentoo是万万不能的。
希望你有一天能返璞归真。

java可以去找这种:
http://linuxg.net/how-to-install-oracle-java-jdk-678-on-ubuntu-13-04-12-10-12-04/
尽量用这种可靠来源的别人给打好的包,自己装会有乱七八糟的问题,例如JAVA_HOME,CLASSPATH等。。

然后,你用ubuntu11.。。
这是长期支持版本么。
centos一个版本可以支持十年,
ubuntu能有centos的一半就谢天谢地了。
ubuntu11.04支持期限甚至只有一年零六个月。

不是ubuntu不好,
的确是你不太会驾驭。

Bjinx answered 10 years, 2 months ago

也可以考虑编译安装的

56465 answered 10 years, 2 months ago

我花了50分钟编辑这个, 不点赞, 不留言的人, 我诅咒你一辈子用centos, ubuntu .

各大Linux发行版当中, Gentoo Linux在软件源, 包管理做得特别人性化. 来, 我给你演示下安装你说的" php-redis ", 在gentoo里它叫" pecl-redis ", 属于"dev/php" 下的, 这包跟java的" "差不多一个意思, 因为有些软件的名字会冲突, 至于如何准确选择所安装的软件, 就看包名了,发生名字冲突时, 就把 包名 加上.


 Gentoo64 ~ # emerge -pv pecl-redis

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  NS   #] dev-lang/php-5.5.16:5.5 [5.3.28-r3:5.3] USE="berkdb bzip2 cli crypt ctype fileinfo filter fpm gdbm hash iconv ipv6 json mysql mysqli nls opcache pdo phar posix readline session simplexml sqlite ssl tokenizer unicode xml zip zlib -apache2 -bcmath -calendar -cdb -cgi -cjk -curl -debug -embed -enchant -exif (-firebird) -flatfile (-frontbase) -ftp -gd -gmp -imap -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode (-selinux) -sharedmem -snmp -soap -sockets -spell (-sybase-ct) -systemd -sysvipc -threads -tidy -truetype -vpx -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xslt" 12,947 kB
[ebuild  N     ] dev-php/pecl-redis-2.2.3  USE="-igbinary" PHP_TARGETS="php5-5 -php5-4" 85 kB

Calculating dependencies... done! ,自动帮你计算依赖, 我没有装 php , 它会自动帮我把 php 给安装上, 你还可以指定 php版本 , 比如 5.3 , 所有的软件, 你想安装哪个版本都行, 一切依赖都是Gentoo帮你搞定, 你只需说 我要XXX, 不要YYY . 你可以看到, php 会自动安装 berkdb bzip2 cli crypt ctype fileinfo ... , 前面带 - 的是不安装, 还会看到 curl 是不安装的, 但我还想把 curl 也给装上, 那么你可以把 dev-lang/php curl 给写到 /etc/portage/package.use ,再次运行 emerge -pv pecl-redis :


 Gentoo64 ~ # emerge -pv pecl-redis

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  NS   #] dev-lang/php-5.5.16:5.5 [5.3.28-r3:5.3] USE="berkdb bzip2 cli crypt ctype curl fileinfo filter fpm gdbm hash iconv ipv6 json mysql mysqli nls opcache pdo phar posix readline session simplexml sqlite ssl tokenizer unicode xml zip zlib -apache2 -bcmath -calendar -cdb -cgi -cjk -debug -embed -enchant -exif (-firebird) -flatfile (-frontbase) -ftp -gd -gmp -imap -inifile -intl -iodbc -kerberos -ldap -ldap-sasl -libedit -libmysqlclient -mhash -mssql -oci8-instant-client -odbc -pcntl -postgres -qdbm -recode (-selinux) -sharedmem -snmp -soap -sockets -spell (-sybase-ct) -systemd -sysvipc -threads -tidy -truetype -vpx -wddx -xmlreader -xmlrpc -xmlwriter -xpm -xslt" 12,947 kB
[ebuild  N     ] dev-php/pecl-redis-2.2.3  USE="-igbinary" PHP_TARGETS="php5-5 -php5-4"

看, curl 这个 php扩展库 就加入了安装列表了, 当然也可以在命令行指定要安装 curl , 现在执行 emerge pecl-redis , 看它的输出:


 * IMPORTANT: 9 news items need reading for repository 'gentoo'.
 * Use eselect news to read news items.

Calculating dependencies... done!    

>>> Verifying ebuild manifests

>>> Emerging (1 of 2) dev-lang/php-5.5.17
 * Fetching files in the background. To view fetch progress, run
 * `tail -f /var/log/emerge-fetch.log` in another terminal.
 * php-5.5.17.tar.bz2 SHA256 SHA512 WHIRLPOOL size ;-) ...                                                                                    [ ok ]
>>> Unpacking source...
>>> Unpacking php-5.5.17.tar.bz2 to /var/tmp/portage/dev-lang/php-5.5.17/work
>>> Source unpacked in /var/tmp/portage/dev-lang/php-5.5.17/work
>>> Preparing source in /var/tmp/portage/dev-lang/php-5.5.17/work/php-5.5.17 ...
 * Running eautoreconf in '/var/tmp/portage/dev-lang/php-5.5.17/work/php-5.5.17' ...
 * Running libtoolize --install --copy --force ...                                                                                            [ ok ]
 * Running aclocal ...                                                                                                                        [ ok ]
 * Running autoconf ...                                                                                                                       [ ok ]
 * Running autoheader ...                                                                                                                     [ ok ]
 * Running elibtoolize in: php-5.5.17/
 *   Applying portage/1.2.0 patch ...
 *   Applying sed/1.5.6 patch ...
 *   Applying as-needed/2.4.2 patch ...
 *   Applying target-nm/2.4.2 patch ...
 * Running elibtoolize in: php-5.5.17/ext/bcmath/libbcmath/
>>> Source prepared.
>>> Configuring source in /var/tmp/portage/dev-lang/php-5.5.17/work/php-5.5.17 ...
 * econf: updating sapis-build/cli/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating sapis-build/cli/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating php-5.5.17/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating php-5.5.17/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --prefix=/usr/lib64/php5.5 --mandir=/usr/lib64/php5.5/man --infodir=/usr/lib64/php5.5/info --libdir=/usr/lib64/php5.5/lib --with-libdir=lib64 --without-pear --disable-maintainer-zts --disable-bcmath --with-bz2=/usr --disable-calendar --enable-ctype --with-curl=/usr --enable-dom --without-enchant --disable-exif --enable-fileinfo --enable-filter --disable-ftp --with-gettext=/usr --without-gmp --enable-hash --without-mhash --with-iconv --disable-intl --enable-ipv6 --enable-json --without-kerberos --enable-libxml --with-libxml-dir=/usr --enable-mbstring --with-mcrypt=/usr --without-mssql --with-onig=/usr --with-openssl=/usr --with-openssl-dir=/usr --disable-pcntl --enable-phar --enable-pdo --enable-opcache --without-pgsql --enable-posix --without-pspell --without-recode --enable-simplexml --disable-shmop --without-snmp --disable-soap --disable-sockets --with-sqlite3=/usr --without-sybase-ct --disable-sysvmsg --disable-sysvsem --disable-sysvshm --without-fpm-systemd --without-tidy --enable-tokenizer --disable-wddx --enable-xml --disable-xmlreader --disable-xmlwriter --without-xmlrpc --without-xsl --enable-zip --with-zlib=/usr --disable-debug --enable-dba --without-cdb --with-db4=/usr --disable-flatfile --with-gdbm=/usr --disable-inifile --without-qdbm --without-freetype-dir --without-t1lib --disable-gd-jis-conv --without-jpeg-dir --without-png-dir --without-xpm-dir --without-vpx-dir --without-gd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql-sock=/var/run/mysqld/mysqld.sock --without-pdo-dblib --with-pdo-mysql=mysqlnd --without-pdo-pgsql --with-pdo-sqlite=/usr --without-pdo-odbc --with-readline=/usr --without-libedit --without-mm --with-pic --with-pcre-regex=/usr --with-pcre-dir=/usr --with-config-file-path=/etc/php/cli-php5.5 --with-config-file-scan-dir=/etc/php/cli-php5.5/ext-active --disable-embed --enable-cli --disable-cgi --disable-fpm --without-apxs2
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
Updated main/php_version.h
checking for x86_64-pc-linux-gnu-cc... no
checking for x86_64-pc-linux-gnu-gcc... x86_64-pc-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-pc-linux-gnu-gcc accepts -g... yes
checking for x86_64-pc-linux-gnu-gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for icc... no
checking for suncc... no
checking whether x86_64-pc-linux-gnu-gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... x86_64-pc-linux-gnu-gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking whether ln -s works... yes
checking for system library directory... lib64
checking whether to enable runpaths... yes
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking for gawk... gawk
checking for bison... bison -y
checking for bison version... 2.4 (ok)
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking whether to enable computed goto gcc extension with re2c... no
./configure: line 5388: test: too many arguments
checking whether to force non-PIC code in shared modules... no
checking whether /dev/urandom exists... yes
checking for pthreads_cflags... -pthread
checking for pthreads_lib... 

Configuring SAPI modules
checking for AOLserver support... no
checking for Apache 1.x module support via DSO through APXS... no
checking for Apache 1.x module support... no
checking whether to enable Apache charset compatibility option... no
checking for Apache 2.0 filter-module support via DSO through APXS... no
checking for Apache 2.0 handler-module support via DSO through APXS... no
checking for Apache 1.x (hooks) module support via DSO through APXS... no
checking for Apache 1.x (hooks) module support... no
checking whether to enable Apache charset compatibility option... no
checking for Caudium support... no
checking for setproctitle... no
checking sys/pstat.h usability... no
checking sys/pstat.h presence... no
checking for sys/pstat.h... no
checking for PS_STRINGS... no
checking for CLI build... yes
checking for Continuity support... no
checking for embedded SAPI library support... no
checking for FPM build... no
checking for Zeus ISAPI support... no
checking for LiteSpeed support... no
checking for Milter support... no
checking for NSAPI support... no
checking for PHTTPD support... no
checking for Pi3Web support... no
checking whether Roxen module is build using ZTS... no
checking for Roxen/Pike support... 
checking for thttpd... no
checking for TUX... no
checking for webjames... no
checking for CGI build... yes
checking for chosen SAPI module... none
checking for executable SAPI binaries...  cli

Running system checks
checking for sendmail... /usr/sbin/sendmail
checking whether system uses EBCDIC... no
checking whether byte ordering is bigendian... no
checking whether writing to stdout works... This is the test message -- yes
checking for socket... yes
checking for socketpair... yes
checking for htonl... yes
checking for gethostname... yes
checking for gethostbyaddr... yes
checking for yp_get_default_domain... no
checking for __yp_get_default_domain... no
checking for yp_get_default_domain in -lnsl... yes
checking for dlopen... no
checking for __dlopen... no
checking for dlopen in -ldl... yes
checking for sin in -lm... yes
checking for inet_aton... yes
checking for ANSI C header files... (cached) yes
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for inttypes.h... (cached) yes
checking for stdint.h... (cached) yes
checking for dirent.h... yes
checking for ApplicationServices/ApplicationServices.h... no
checking for sys/param.h... yes
checking for sys/types.h... (cached) yes
checking for sys/time.h... yes
checking for netinet/in.h... yes
checking for alloca.h... yes
checking for arpa/inet.h... yes
checking for arpa/nameser.h... yes
checking for assert.h... yes
checking for crypt.h... yes
checking for dns.h... no
checking for fcntl.h... yes
checking for grp.h... yes
checking for ieeefp.h... no
checking for langinfo.h... yes
checking for limits.h... yes
checking for locale.h... yes
checking for monetary.h... yes
checking for netdb.h... yes
......
config.status: executing default commands
 * econf: updating sapis-build/cli/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating sapis-build/cli/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating sapis-build/fpm/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating sapis-build/fpm/config.sub with /usr/share/gnuconfig/config.sub
 * econf: updating php-5.5.17/config.guess with /usr/share/gnuconfig/config.guess
 * econf: updating php-5.5.17/config.sub with /usr/share/gnuconfig/config.sub
./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --prefix=/usr/lib64/php5.5 --mandir=/usr/lib64/php5.5/man --infodir=/usr/lib64/php5.5/info --libdir=/usr/lib64/php5.5/lib --with-libdir=lib64 --without-pear --disable-maintainer-zts --disable-bcmath --with-bz2=/usr --disable-calendar --enable-ctype --with-curl=/usr --enable-dom --without-enchant --disable-exif --enable-fileinfo --enable-filter --disable-ftp --with-gettext=/usr --without-gmp --enable-hash --without-mhash --with-iconv --disable-intl --enable-ipv6 --enable-json --without-kerberos --enable-libxml --with-libxml-dir=/usr --enable-mbstring --with-mcrypt=/usr --without-mssql --with-onig=/usr --with-openssl=/usr --with-openssl-dir=/usr --disable-pcntl --enable-phar --enable-pdo --enable-opcache --without-pgsql --enable-posix --without-pspell --without-recode --enable-simplexml --disable-shmop --without-snmp --disable-soap --disable-sockets --with-sqlite3=/usr --without-sybase-ct --disable-sysvmsg --disable-sysvsem --disable-sysvshm --without-fpm-systemd --without-tidy --enable-tokenizer --disable-wddx --enable-xml --disable-xmlreader --disable-xmlwriter --without-xmlrpc --without-xsl --enable-zip --with-zlib=/usr --disable-debug --enable-dba --without-cdb --with-db4=/usr --disable-flatfile --with-gdbm=/usr --disable-inifile --without-qdbm --without-freetype-dir --without-t1lib --disable-gd-jis-conv --without-jpeg-dir --without-png-dir --without-xpm-dir --without-vpx-dir --without-gd --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-mysql-sock=/var/run/mysqld/mysqld.sock --without-pdo-dblib --with-pdo-mysql=mysqlnd --without-pdo-pgsql --with-pdo-sqlite=/usr --without-pdo-odbc --with-readline=/usr --without-libedit --without-mm --with-pic --with-pcre-regex=/usr --with-pcre-dir=/usr --with-config-file-path=/etc/php/fpm-php5.5 --with-config-file-scan-dir=/etc/php/fpm-php5.5/ext-active --disable-embed --disable-cli --disable-cgi --enable-fpm --without-apxs2

像不像手动源代码编译的那种? 事实上它就是, 只不过是gentoo帮你做这些.

你可以看到, Gentoo安装一个软件, 是从源代码编译的, 一切细节给封装好了, 你需要说"把大象装进冰箱里, 不过它的象牙不需要放进去, 尾巴换成红色的", 瞧, 多方便, 不用像源代码编译时 ./configue --with-XXX --disable-XXX 这么复杂, gentoo会根据你配置的参数, 自动省去一些依赖, 或者自动为你新添加的参数而依赖的软件.

另外gentoo不像centos或ubuntu, 管你机器是啥样的, 一切都是直接从二进制的rpm或ded安装来. 这tmd根本发挥不了最大效能, gentoo可以根据机器, 编译出最好的二进制文件出来, 只要你懂. 随便定义.

不是我偏袒Gentoo, 那些什么Ubuntu, CentOS, Fedora, redhat都是渣渣, 我大部分Linux发行版我都用过. 只有Gentoo是我见过最好用的. 各大Linux发行版的好坏区别在于包管理, 一个好的Linux, 能让你安装软件的时候, 不需要操心依赖, 能自己轻松定义一个软件哪些组件需要安装, 能让用户轻松选择软件的版本.

国人大部人都认为Ubuntu的社区和文档做得特别好, 其实吧, 这些东西都是渣渣, 社区都想tmd打酱油似的.

只要一个热门开源软件出来了, gentoo能在很短时间内把该软件加入到软件源里, 瞅瞅centos, Python2.7都没, 把yum这个源代码里的python版本升级到2,7, 都需要源代码自己编译, 编译后, 各种各样的问题又出来了. 再瞅瞅ubuntu, nodejs的老一点的version 11都没, 要安装新版本的, 还需要找些乱七八糟的第三方源, 先不说安全否, 光是修改配置, 依赖都不一定能解决好呢.

Gentoo的好, 不是一两句都能说完, Gentoo的社区是我见过最专业的社区, 里面的提问, 不敢说百分百能给你解决 但敢说比ubuntu的要专业.

so, 如果你懂那么一点英语, 或者不畏惧英语, 那么, gentoo的社区能为你所用. 我一个初中勉强毕业的人, 都不怕英语呢, 你们这些几乎上个高中的人, 怕个鸟.

在我未接触gentoo前, 我是centos粉, 当我第一次出来工作面试的时候, 一个公司的副总给我演示了他们公司用的gentoo, 老实说, 我当时自认为centos是天下最好用的, 所以这副总给我的演示并未打动我, 因为听不懂什么叫 USE, KEYWORDS, MASK 什么的. 后来我进了这家公司, 慢慢接触到了gentoo, 越发觉得gentoo简直就是为懒人打造的linux系统. 后来我辞职了, 每面试一个公司, 我都特别关心对方用的是什么Linux, 只要听到用的是centos, ubuntu之类的, 我默默就把对方拉黑了. 因此可见gentoo好用到使我面试时很看重对方公司用的什么linux发行版.

最后: 人生苦短, 请用Gentoo, 推荐你用Ubutu, CentOS的人, 要么就是见识少, 要么就是固步自封, 再要么就是邪*教分子

弟大勿勃. answered 10 years, 2 months ago

Your Answer