Install PHP5.5 + Redis + XDebug + Nginx + MySQL on CentOS

Source: Internet
Author: User
Tags php error install redis redis server
This article mainly introduces the entire process of installing PHP5.5 + Redis + XDebug + Nginx + MySQL development environment in the CentOS system environment, which is very detailed and detailed. It is recommended for reference by partners in need. Start the ssh service

Service sshd start
Yum-y update

View centos version

Centos 5 execution:

The Code is as follows:


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

Centos 6 execution:

The Code is as follows:


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

Install php in yum

The Code is as follows:


Yum install php55w php55w-bcmath php55w-cli php55w-common
Php55w-devel php55w-fpm php55w-gd php55w-imap
Php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc
Php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc
Php55w-opcache php55w-intl php55w-pecl-memcache

Installation Complete

Whereis php

Start php-fpm

The Code is as follows:


/Etc/rc. d/init. d/php-fpm start

Install 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

Modify conf configuration

The Code is as follows:


Vim/etc/redis. conf

Example/n keyword to modify

The Code is as follows:


> Daemonize yes
>
> Port 6379
>
> Bind 127.0.0.1
>
> Dir/var/opt

Check whether the installation is successful

The Code is as follows:


> Whereis redis-server
>
>/Usr/local/bin/redis-server/etc/redis. conf
>
> Redis-cli

Install PHPRedis

Https://github.com/nicolasff/phpredis/archive/2.2.4.tar.gz
Upload the phpredis-2.2.4.tar.gz to the/usr/local/src directory

> 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

After the installation is complete, the following installation path appears:

The Code is as follows:


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

3. Configure php to support adding in php. ini

The Code is as follows:


> Extension = "redis. so"

Restart php-fpm

The Code is as follows:


>/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.

Install Xdebug

To the official website http://www.xdebug.com/download.php

Download the source tgz package in linux

& Gt; tar-xvzf xdebug-2.3.1.tgz & gt; cd xdebug-2.3.1 & gt; phpize & gt. /configure> make install> cp modules/xdebug. so/usr/include/php/ext // set xdebug. move the so file to the php Directory

Ext can be found through find

Edit php. ini and add the following configuration. Common functions are enabled.

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

Install nginx

The Code is as follows:


> Yum install nginx-y

After the installation is complete, you can start Nginx directly:

The Code is as follows:


>/Etc/init. d/nginx start
>
>/Etc/init. d/iptables stop disable Firewall
>
>/Etc/nginx. conf # Nginx configuration file location

Php error. nginx reports a 502 error. Comment out 502 in nginx. conf.

Laravel5 Configuration

> 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;  } }

Install mysql

The Code is as follows:


> Yum install mysql-server

Set startup

> 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;

The above is all the content of this article. I hope you will like it.

Please take a moment to share your article with your friends or leave a comment. Thank you for your support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.