Home php教程 php手册 CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录

CentOS 安装 PHP5.5+Redis+XDebug+Nginx+MySQL全纪录

Jun 06, 2016 pm 08:05 PM
centos redis xdebug

这篇文章主要介绍了在CentOS系统环境下安装 PHP5.5+Redis+XDebug+Nginx+MySQL开发环境的全过程,非常的细致详尽,推荐给有需要的小伙伴们参考下吧。

启动ssh服务

service sshd start
yum -y update

查看centos版本

centos 5 执行:

复制代码 代码如下:


rpm -Uvh

centos 6 执行:

复制代码 代码如下:


rpm -Uvh

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

到官网

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的配置

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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

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)

Solution to 0x80242008 error when installing Windows 11 10.0.22000.100 Solution to 0x80242008 error when installing Windows 11 10.0.22000.100 May 08, 2024 pm 03:50 PM

1. Start the [Start] menu, enter [cmd], right-click [Command Prompt], and select Run as [Administrator]. 2. Enter the following commands in sequence (copy and paste carefully): SCconfigwuauservstart=auto, press Enter SCconfigbitsstart=auto, press Enter SCconfigcryptsvcstart=auto, press Enter SCconfigtrustedinstallerstart=auto, press Enter SCconfigwuauservtype=share, press Enter netstopwuauserv , press enter netstopcryptS

Golang API caching strategy and optimization Golang API caching strategy and optimization May 07, 2024 pm 02:12 PM

The caching strategy in GolangAPI can improve performance and reduce server load. Commonly used strategies are: LRU, LFU, FIFO and TTL. Optimization techniques include selecting appropriate cache storage, hierarchical caching, invalidation management, and monitoring and tuning. In the practical case, the LRU cache is used to optimize the API for obtaining user information from the database. The data can be quickly retrieved from the cache. Otherwise, the cache can be updated after obtaining it from the database.

Caching mechanism and application practice in PHP development Caching mechanism and application practice in PHP development May 09, 2024 pm 01:30 PM

In PHP development, the caching mechanism improves performance by temporarily storing frequently accessed data in memory or disk, thereby reducing the number of database accesses. Cache types mainly include memory, file and database cache. Caching can be implemented in PHP using built-in functions or third-party libraries, such as cache_get() and Memcache. Common practical applications include caching database query results to optimize query performance and caching page output to speed up rendering. The caching mechanism effectively improves website response speed, enhances user experience and reduces server load.

How to upgrade Win11 English 21996 to Simplified Chinese 22000_How to upgrade Win11 English 21996 to Simplified Chinese 22000 How to upgrade Win11 English 21996 to Simplified Chinese 22000_How to upgrade Win11 English 21996 to Simplified Chinese 22000 May 08, 2024 pm 05:10 PM

First you need to set the system language to Simplified Chinese display and restart. Of course, if you have changed the display language to Simplified Chinese before, you can just skip this step. Next, start operating the registry, regedit.exe, directly navigate to HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlNlsLanguage in the left navigation bar or the upper address bar, and then modify the InstallLanguage key value and Default key value to 0804 (if you want to change it to English en-us, you need First set the system display language to en-us, restart the system and then change everything to 0409) You must restart the system at this point.

How to find the update file downloaded by Win11_Share the location of the update file downloaded by Win11 How to find the update file downloaded by Win11_Share the location of the update file downloaded by Win11 May 08, 2024 am 10:34 AM

1. First, double-click the [This PC] icon on the desktop to open it. 2. Then double-click the left mouse button to enter [C drive]. System files will generally be automatically stored in C drive. 3. Then find the [windows] folder in the C drive and double-click to enter. 4. After entering the [windows] folder, find the [SoftwareDistribution] folder. 5. After entering, find the [download] folder, which contains all win11 download and update files. 6. If we want to delete these files, just delete them directly in this folder.

PHP Redis caching applications and best practices PHP Redis caching applications and best practices May 04, 2024 am 08:33 AM

Redis is a high-performance key-value cache. The PHPRedis extension provides an API to interact with the Redis server. Use the following steps to connect to Redis, store and retrieve data: Connect: Use the Redis classes to connect to the server. Storage: Use the set method to set key-value pairs. Retrieval: Use the get method to obtain the value of the key.

What models does gnetlink support? What models does gnetlink support? May 08, 2024 pm 09:39 PM

gnetlink is supported on all devices running the Linux operating system and having the necessary hardware and drivers. Major Linux distributions that support it include Ubuntu, Debian, RHEL, CentOS, and Fedora.

Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Why does an error occur when installing an extension using PECL in a Docker environment? How to solve it? Apr 01, 2025 pm 03:06 PM

Causes and solutions for errors when using PECL to install extensions in Docker environment When using Docker environment, we often encounter some headaches...

See all articles