资讯专栏INFORMATION COLUMN

Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

ChanceWong / 427人阅读

摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配

启动ssh服务
service sshd start
yum -y update
查看centos版本

centos 5 执行:

rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm

centos 6 执行:

rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
yum安装php
yum install php55w  php55w-bcmath php55w-cli php55w-common 
php55w-devel php55w-fpm    php55w-gd php55w-imap  php55w-ldap
php55w-mbstring php55w-mcrypt php55w-mysql   php55w-odbc   php55w-pdo 
php55w-pear  php55w-pecl-igbinary  php55w-xml php55w-xmlrpc
php55w-opcache php55w-intl php55w-pecl-memcache

安装完成

whereis php

启动php-fpm

/etc/rc.d/init.d/php-fpm start
安装Redis server
>  yum install wget make gcc gcc-c++ zlib-devel openssl openssl-devel
> pcre-devel kernel keyutils patch perl
> 
>  mkdir /tmp/redis
> 
>  cd /tmp/redis
> 
>  wget http://download.redis.io/releases/redis-2.8.8.tar.gz
> 
>  tar xzf redis-*
> 
>  cd redis-*
> 
>  make
> 
>  sudo make install clean
> 
>  mkdir /etc/redis
> 
>  cp redis.conf /etc/redis/redis.conf

修改conf配置

vim /etc/redis/redis.conf

例子 /n关键字去修改

> daemonize yes
> 
> port 6379
> 
> bind 127.0.0.1
> 
> dir /var/opt

查看是否安装成功

> whereis redis-server
> 
> /usr/local/bin/redis-server /etc/redis/redis.conf
>
>  redis-cli
安装 PHPRedis

下载地址

https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz

上传 phpredis-2.2.4.tar.gz/usr/local/src 目录

> cd /usr/local/src
> 
> tar zxvf phpredis-2.2.4.tar.gz
> 
> cd phpredis-2.2.4
> 
> /usr/local/php/bin/phpize
> 
> whereis php
> 
> /usr/bin/phpize
> 
> /usr/bin/php/bin/phpize
> 
> find / -name "phpize"
> 
> ./configure --with-php-config=/usr/bin/php-config
> 
> make
> 
> make install
> 
> 
> vim /usr/bin/php.ini

安装完成之后,出现下面的安装路径

> /usr/local/php/lib/php/extensions/no-debug-non-zts-20090626/

3、配置php支持 在php.ini里添加

> extension="redis.so"

重启php-fpm

> /etc/rc.d/init.d/php-fpm stop
> 
> /etc/rc.d/init.d/php-fpm start
> 
> php -r "if (new Redis() == true){ echo "
 OK 
"; }"

ok 就是成功了

安装Xdebug

到官网 http://www.xdebug.com/download.php

linux 系统下载 source 版 tgz 压缩包
备注
(查看xdebug生成的文件 2.3.× 会出现Incorrect profiler snapshot format: incorrect function parameters 导致phpstorm winCacheGrind 打不开 建议安装2.2.*)

> tar -xvzf xdebug-2.3.1.tgz
> 
> cd xdebug-2.3.1
> 
> phpize  # find / -name  phpize
> 
> ./configure   
# 手动找php-config
 ./configure --enable-xdebug  --with-php-config=/usr/local/webserver/php/bin/php-config
> 
> make
> 
> make install
> 
> cp modules/xdebug.so /usr/include/php/ext //将 xdebug.so 文件移到 php 下面

ext可以通过find 去找到

编辑php.ini,加入下面配置,一般的功能都打开了

     [Xdebug]
      zend_extension="/usr/include/php/ext/xdebug.so"  
      xdebug.trace_output_dir="/tmp/php/xdebug"  
      xdebug.profiler_output_dir="/tmp/php/xdebug"  
      xdebug.profiler_output_name="callgrind.out.%s.%t"  
      xdebug.profiler_enable=On  
      xdebug.profiler_enable_trigger=1  
      xdebug.default_enable=1  
      xdebug.show_exception_trace=On  
      xdebug.show_local_vars=0  
      xdebug.max_nesting_level=300  
      xdebug.var_display_max_depth=6  
      xdebug.dump_once=On  
      xdebug.dump_globals=On  
      xdebug.dump_undefined=On  
      xdebug.dump.GET=* 
      xdebug.dump.SERVER=REMOTE_ADDR 
      xdebug.dump.REQUEST=*  
      xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT  
      xdebug.remote_connect_back=1  
      xdebug.remote_enable=1  
      xdebug.remote_handler=dbgp  
      xdebug.remote_mode=req  
      xdebug.cli_color=1   
      xdebug.trace_format=0 
      xdebug.auto_trace=On 
     xdebug.force_display_errors= 1 
     xdebug.collect_assignments=On 
     xdebug.force_error_reporting = 1 
     display_startup_errors=1 
     allow_url_include=1 
     always_populate_raw_post_data=1 
     asp_tags=1 
     xdebug.scream=0 
     xdebug.collect_return=1 
     xdebug.collect_vars=1 
     xdebug.remote_host = 127.0.0.1   
     xdebug.collect_params=On 
     xdebug.collect_params=4 
     how_local_vars=On 
     xdebug.idekey="PHPSTORM" 
     xdebug.dump.COOKIE=* 
     xdebug.dump.ENV=* 
     xdebug.dump.FILES=* 
     xdebug.dump.POST=* 
     xdebug.dump.SERVER=* 
     xdebug.dump.SESSION=* 
     xdebug.file_link_format=* 
     xdebug.profiler_aggregate=1 
     xdebug.profiler_append=1 
     xdebug.profiler_enable_trigger_value=* 
     xdebug.remote_autostart=1 
     xdebug.show_local_vars=1 
     xdebug.show_mem_delta=1 
     xdebug.trace_enable_trigger=1

不许要全部功能的话可以

 [Xdebug]
 zend_extension="/usr/include/php/ext/xdebug.so"  
 xdebug.trace_output_dir="/tmp/php/xdebug"  
 xdebug.profiler_output_dir="/tmp/php/xdebug"  
 xdebug.profiler_output_name="callgrind.out.%s.%t"
 xdebug.profiler_enable=Off
 xdebug.profiler_enable_trigger=1
 xdebug.default_enable=On
 xdebug.show_exception_trace=Off
 xdebug.show_local_vars=0
 xdebug.max_nesting_level=300
 xdebug.var_display_max_depth=6
 xdebug.dump_once=On
 xdebug.dump_globals=On
 xdebug.dump_undefined=On
 xdebug.dump.REQUEST=*
 xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT
 xdebug.remote_connect_back=1
 xdebug.remote_enable=1
 xdebug.remote_handler=dbgp
 xdebug.remote_mode=req
安装nginx
> yum install nginx -y

安装完成,下面直接就可以启动Nginx了:

> /etc/init.d/nginx start
> 
> /etc/init.d/iptables stop 关闭防火墙
> 
> /etc/nginx/nginx.conf # Nginx配置文件位置 

php错误,nginx报502错误 在nginx.conf里把502注释掉即可

laravel5的配置

> server {
>     listen       80;
>     server_name  baidu.com;
>         set $index_file index.php;
>         location / {
>         root   /opt/www/baidu/public;
>         index  index.html index.htm index.php;
> 
>         if (!-e $request_filename) {
>         rewrite ^/(.*)$ /index.php?$1 last;
>         break;
>        }
>        index $index_file;
> 
>          }    location ~ .php$ {    root          html;    fastcgi_pass   127.0.0.1:9000;    fastcgi_index  index.php;   
> fastcgi_param  SCRIPT_FILENAME 
> /opt/www/baidu/public/$fastcgi_script_name;    include      
> fastcgi_params;    } }
安装mysql
>  yum install mysql mysql-server

设置开机启动

> chkconfig mysqld on
> 
> mysql -u root
> 
> mysql> select user,host,password from mysql.user;
> mysql> set password for root@localhost=password("123456"); mysql> exit

  

show databases;
use laravel5;
show tables;

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/45593.html

相关文章

  • Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

    摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配 启动ssh服务 service sshd start yum -y update 查看centos版本 centos 5 执行: rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rp...

    glumes 评论0 收藏0
  • Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

    摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配 启动ssh服务 service sshd start yum -y update 查看centos版本 centos 5 执行: rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rp...

    vslam 评论0 收藏0
  • Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

    摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配 启动ssh服务 service sshd start yum -y update 查看centos版本 centos 5 执行: rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rp...

    hsluoyz 评论0 收藏0
  • Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

    摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配 启动ssh服务 service sshd start yum -y update 查看centos版本 centos 5 执行: rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rp...

    freewolf 评论0 收藏0
  • Linux CentOS 安装 PHP5.5 Redis XDebug Nginx MySQL

    摘要:启动服务查看版本执行执行安装安装完成启动安装修改配置例子关键字去修改查看是否安装成功安装下载地址上传到目录安装完成之后,出现下面的安装路径配 启动ssh服务 service sshd start yum -y update 查看centos版本 centos 5 执行: rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rp...

    LeoHsiun 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<