CentOS 安裝 PHP5.5+Redis+XDebug+Nginx+MySQL全紀錄,centosredis_PHP教程

來源:互聯網
上載者:User

CentOS 安裝 PHP5.5+Redis+XDebug+Nginx+MySQL全紀錄,centosredis


啟動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 \"\r\n OK \r\n\"; }"

ok 就是成功了

安裝Xdebug

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

linux 系統下載 source 版 tgz 壓縮包

> tar -xvzf xdebug-2.3.1.tgz> > cd xdebug-2.3.1> > phpize> > ./configure> > make> > make install> > cp modules/xdebug.so /usr/include/php/ext //將 xdebug.so 檔案移到 php 下面

ext可以通過find 去找到

編輯php.ini,加入下面配置,一般的功能都開啟了

1818 [Xdebug]1819 zend_extension="/usr/include/php/ext/xdebug.so" 1820 xdebug.trace_output_dir="/tmp/php/xdebug" 1821 xdebug.profiler_output_dir="/tmp/php/xdebug" 1822 xdebug.profiler_output_name="callgrind.out.%s.%t" 1823 xdebug.profiler_enable=On 1824 xdebug.profiler_enable_trigger=1 1825 xdebug.default_enable=1 1826 xdebug.show_exception_trace=On 1827 xdebug.show_local_vars=0 1828 xdebug.max_nesting_level=300 1829 xdebug.var_display_max_depth=6 1830 xdebug.dump_once=On 1831 xdebug.dump_globals=On 1832 xdebug.dump_undefined=On 1833 xdebug.dump.GET=* 1834 xdebug.dump.SERVER=REMOTE_ADDR 1835 xdebug.dump.REQUEST=* 1836 xdebug.dump.SERVER=REQUEST_METHOD,REQUEST_URI,HTTP_USER_AGENT 1837 xdebug.remote_connect_back=1 1838 xdebug.remote_enable=1 1839 xdebug.remote_handler=dbgp 1840 xdebug.remote_mode=req 1841 xdebug.cli_color=1  1842 xdebug.trace_format=0 1843 xdebug.auto_trace=On 1844 xdebug.force_display_errors= 1 1845 xdebug.collect_assignments=On 1846 xdebug.force_error_reporting = 1 1847 display_startup_errors=1 1848 allow_url_include=1 1849 always_populate_raw_post_data=1 1850 asp_tags=1 1851 xdebug.scream=0 1852 xdebug.collect_return=1 1853 xdebug.collect_vars=1 1854 xdebug.remote_host = 127.0.0.1  1855 xdebug.collect_params=On 1856 xdebug.collect_params=4 1857 how_local_vars=On 1858 xdebug.idekey="PHPSTORM" 1859 xdebug.dump.COOKIE=* 1860 xdebug.dump.ENV=* 1861 xdebug.dump.FILES=* 1862 xdebug.dump.POST=* 1863 xdebug.dump.SERVER=* 1864 xdebug.dump.SESSION=* 1865 xdebug.file_link_format=* 1866 xdebug.profiler_aggregate=1 1867 xdebug.profiler_append=1 1868 xdebug.profiler_enable_trigger_value=* 1869 xdebug.remote_autostart=1 1870 xdebug.show_local_vars=1 1871 xdebug.show_mem_delta=1 1872 xdebug.trace_enable_trigger=1

安裝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> exitshow databases;use laravel5;show tables;

以上所述就是本文的全部內容了,希望大家能夠喜歡。

請您花一點時間將文章分享給您的朋友或者留下評論。我們將會由衷感謝您的支援!

http://www.bkjia.com/PHPjc/973282.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/973282.htmlTechArticleCentOS 安裝 PHP5.5+Redis+XDebug+Nginx+MySQL全紀錄,centosredis 啟動ssh服務 service sshd start yum -y update 查看centos版本 centos 5 執行: 複製代碼 代碼如下...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.