Table of Contents
CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录,centosredis
Home Backend Development PHP Tutorial CentOS installation PHP5.5 Redis XDebug Nginx MySQL full record, centosredis_PHP tutorial

CentOS installation PHP5.5 Redis XDebug Nginx MySQL full record, centosredis_PHP tutorial

Jul 13, 2016 am 10:00 AM
centos mysql nginx redis xdebug

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

Copy after login

修改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

Copy after login

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

复制代码 代码如下:
> /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 下面

Copy after login

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

Copy after login

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

Copy after login

安装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;
Copy after login

以上所述就是本文的全部内容了,希望大家能够喜欢。

请您花一点时间将文章分享给您的朋友或者留下评论。我们将会由衷感谢您的支持!

www.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 执行: 复制代码 代码如下...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to check the name of the docker container How to check the name of the docker container Apr 15, 2025 pm 12:21 PM

You can query the Docker container name by following the steps: List all containers (docker ps). Filter the container list (using the grep command). Gets the container name (located in the "NAMES" column).

How to start mysql by docker How to start mysql by docker Apr 15, 2025 pm 12:09 PM

The process of starting MySQL in Docker consists of the following steps: Pull the MySQL image to create and start the container, set the root user password, and map the port verification connection Create the database and the user grants all permissions to the database

MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

How to create containers for docker How to create containers for docker Apr 15, 2025 pm 12:18 PM

Create a container in Docker: 1. Pull the image: docker pull [mirror name] 2. Create a container: docker run [Options] [mirror name] [Command] 3. Start the container: docker start [Container name]

Laravel Introduction Example Laravel Introduction Example Apr 18, 2025 pm 12:45 PM

Laravel is a PHP framework for easy building of web applications. It provides a range of powerful features including: Installation: Install the Laravel CLI globally with Composer and create applications in the project directory. Routing: Define the relationship between the URL and the handler in routes/web.php. View: Create a view in resources/views to render the application's interface. Database Integration: Provides out-of-the-box integration with databases such as MySQL and uses migration to create and modify tables. Model and Controller: The model represents the database entity and the controller processes HTTP requests.

How to start containers by docker How to start containers by docker Apr 15, 2025 pm 12:27 PM

Docker container startup steps: Pull the container image: Run "docker pull [mirror name]". Create a container: Use "docker create [options] [mirror name] [commands and parameters]". Start the container: Execute "docker start [Container name or ID]". Check container status: Verify that the container is running with "docker ps".

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Laravel framework installation method Laravel framework installation method Apr 18, 2025 pm 12:54 PM

Article summary: This article provides detailed step-by-step instructions to guide readers on how to easily install the Laravel framework. Laravel is a powerful PHP framework that speeds up the development process of web applications. This tutorial covers the installation process from system requirements to configuring databases and setting up routing. By following these steps, readers can quickly and efficiently lay a solid foundation for their Laravel project.

See all articles