日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > php >内容正文

php

vagrant box php开发环境配置--centos 7 安装 php7

發(fā)布時(shí)間:2025/1/21 php 137 豆豆
生活随笔 收集整理的這篇文章主要介紹了 vagrant box php开发环境配置--centos 7 安装 php7 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

2019獨(dú)角獸企業(yè)重金招聘Python工程師標(biāo)準(zhǔn)>>>

centos7.3 系統(tǒng) 安裝php7.1.2,我選擇編譯安裝

下載源文件

用vagrant賬戶登錄,先安裝wget,再下載源碼

# release后面的版本號可能需要調(diào)整,依賴libmcrypt-devel需要該源 sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm sudo yum install -y wget vim wget -O php-7.1.2.tar.gz http://cn2.php.net/get/php-7.1.2.tar.gz/from/this/mirror tar -xvf php-7.1.2.tar.gz

編譯安裝

centos7 box默認(rèn)是用minimal安裝的,所以有些依賴需要安裝

sudo yum install -y libxml2-devel openssl-devel bzip2-devel curl-devel libjpeg-devel libpng-devel freetype-devel gmp-devel libmcrypt-devel readline-devel libxslt-devel

configure

cd php-7.1.2 ./configure --prefix=/usr/local/php --with-config-file-path=/etc --enable-fpm --with-fpm-user=nginx --with-fpm-group=nginx --enable-inline-optimization --disable-debug --disable-rpath --enable-shared --enable-soap --with-libxml-dir --with-xmlrpc --with-openssl --with-mcrypt --with-mhash --with-pcre-regex --with-sqlite3 --with-zlib --enable-bcmath --with-iconv --with-bz2 --enable-calendar --with-curl --with-cdb --enable-dom --enable-exif --enable-fileinfo --enable-filter --with-pcre-dir --enable-ftp --with-gd --with-openssl-dir --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-gd-native-ttf --enable-gd-jis-conv --with-gettext --with-gmp --with-mhash --enable-json --enable-mbstring --enable-mbregex --enable-mbregex-backtrack --with-libmbfl --with-onig --enable-pdo --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --with-zlib-dir --with-pdo-sqlite --with-readline --enable-session --enable-shmop --enable-simplexml --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --enable-wddx --with-libxml-dir --with-xsl --enable-zip --enable-mysqlnd-compression-support --with-pear --enable-opcache sudo make sudo make install

配置文件

sudo cp php.ini-development /etc/php.ini

把php的bin目錄加到path中

sudo vim /etc/profile.d/path.sh

在末尾加上

PATH=$PATH:/usr/local/php/bin export PATH source /etc/profile # 查看安裝成功與否 php -v

顯示

PHP 7.1.2 (cli) (built: Mar 26 2017 09:29:22) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies 就安裝成功了

php-fpm

sudo cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf sudo cp /usr/local/php/etc/php-fpm.d/www.conf.default /usr/local/php/etc/php-fpm.d/www.conf sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm sudo chmod +x /etc/init.d/php-fpm

增加到開機(jī)啟動(dòng)

sudo chkconfig --add php-fpm chkconfig --list sudo service php-fpm start

應(yīng)該啟動(dòng)失敗,報(bào)錯(cuò)

cannot get uid for user 'nginx' 修改 /usr/local/php/etc/php-fpm.d/www.conf中的

; Unix user/group of processes ; Note: The user is mandatory. If the group is not set, the default user's group ; will be used. user = nginx group = nginx

Xdebug

參考 https://xdebug.org/docs/install

cd ~ wget https://xdebug.org/files/xdebug-2.5.1.tgz tar xvzf xdebug-2.5.1.tgz cd xdebug-2.5.1 sudo yum install autoconf phpize ./configure --enable-xdebug make sudo make install

輸出

Installing shared extensions: /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/

sudo vim /etc/php.ini

末尾添加

zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so xdebug.remote_enable=1 xdebug.remote_host= 10.0.2.2 xdebug.remote_port=9000 xdebug.max_nesting_level=200 xdebug.idekey="PHPSTORM" xdebug.remote_autostart = 1

轉(zhuǎn)載于:https://my.oschina.net/u/2558702/blog/867919

總結(jié)

以上是生活随笔為你收集整理的vagrant box php开发环境配置--centos 7 安装 php7的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。