YUM方式安装MongoDB rpm二进制包

人懒,直接rpm二进制包安装

[root@a5139 ~]# touch /etc/yum.repos.d/10gen.repo
[root@a5139 ~]# vi /etc/yum.repos.d/10gen.repo

#如果是64位写入
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
enabled=1

#如果是32位写入
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
enabled=1

yum install mongo-10gen mongo-10gen-server

PHP MongoDB 扩展安装

[root@a5139 ~]# wget http://pecl.php.net/get/mongo-1.3.4.tgz

[root@a5139 ~]# tar zxvf mongo-1.3.4.tgz

[root@a5139 ~]# cd mongo-1.3.4

[root@a5139 mongo-1.3.4]# /usr/local/php/bin/phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519

[root@a5139 mongo-1.3.4]# ./configure –with-php-config=/usr/local/php/bin/php-config

[root@a5139 mongo-1.3.4]# make && make install

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/

[root@a5139 mongo-1.3.4]# ls /usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/
memcache.so mongo.so pdo_mysql.so

[root@a5139 mongo-1.3.4]# vi /usr/local/php/etc/php.ini

#加入

extension_dir = “/usr/local/php/lib/php/extensions/no-debug-non-zts-20060613/”
#extension = “memcache.so”
#extension = “pdo_mysql.so”
extension = “mongo.so”

[root@a5139 mongo-1.3.4]# /etc/init.d/php-fpm restart
Shutting down php_fpm . done
Starting php_fpm done

#探针查看已经支持mongodb鸟!

 

参考文献:
1、Install MongoDB on Red Hat Enterprise, CentOS, or Fedora Linux
2PHP Language Center

解决php通过localhost不能连接mysql(Percona Server)数据库,通过127.0.0.1等ip能链接mysql数据库的问题.

问题产生

使用Percona Server官网的在线生成工具生成了my.cnf配置文件.做好左右配置启动ok之后,php无法通过localhost连接mysql数据库.

但是通过ip地址却可以连接.

mysql的localhost和127.0.0.1的区别

localhost走的是 unix sock
,127.0.0.1走的是 tcp

原因分析

产生localhost不能连接的问题是,php默认中使用的mysql unix sock使用的是 /tmp/mysql.sock
如果你修改了mysql的的sock的路径,那么需要在php.ini中指定.

解决问题

so:解决php连接mysql localhost不能连接,通过127.0.0.1等ip能链接的问题.

1.修改php.ini中配置,指定mysql.sock位置.
或者
2.修改my.cnf配置,改为  /tmp/mysql.sock

    前言

MySQL衍生版 Percona Server的更多资料请搜索~ 对于如今mysql在甲骨文的掌控下,最为开源软件来说前景堪忧~ mysql的衍生版倒是有几个,这些东西到底能不能用? 红薯都用percona作为oschina的生产数据库了。我也不怕了!哈哈,上!坚决的上!因为我是先拿vps小内存的环境开刀(搞熟悉了上生产线),所以centos6系统为32位滴,那么64位、centos5等等,如法炮制即可~
对 Percona Server 的担忧,使用这个不会出问题吧,是不是和mysql都不一样。不用担心,mysql怎么用你他就怎么用,配置也是一样的。

继续阅读

如果一站点既要80 http访问,又要443https访问。

要让https和http并存,不能在配置文件中使用ssl on,配置listen 443 ssl;

实例

server
{

listen 80;
listen 443 ssl;
server_name www.iamle.com;
index index.html index.htm index.php;
root /home/wwwroot/www.iamle.com/;
#ssl on; 这里要注释掉
ssl_certificate /usr/local/nginx/conf/ssl/www_iamle_com.crt;
ssl_certificate_key /usr/local/nginx/conf/ssl/www_iamle_com.key;

#以下配置省略

}

 

 

 

From:http://nginx.org/en/docs/http/configuring_https_servers.html#single_http_https_server

It is good practice to configure separate servers for HTTP and HTTPS protocols from the very start. Although their functionalities currently seem equal, this may change significantly in the future and using a consolidated server may become problematic. However, if HTTP and HTTPS servers are equal, and you prefer not to think about the future, you may configure a single server that handles both HTTP and HTTPS requests by deleting the directive “ssl on” and adding the “ssl” parameter for *:443 port: