一世安逸 發表於 2020-3-9 22:28:00

php环境 安装

<p>&nbsp;</p>
<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; php&nbsp;相关</p>
<ol>
<li><strong><em>  </em><code>wget https:<span class="hljs-comment">//www.php.net/distributions/php-7.2.16.tar.gz //你可以官网获取最新的包</span></code></strong></li>
<li><strong><span class="hljs-comment">&nbsp; &nbsp;&nbsp; &nbsp; tar解压&nbsp; &nbsp; //一般目录 /usr/src</span></strong></li>
<li><strong><span class="hljs-comment"> </span><span class="hljs-comment">&nbsp; &nbsp;</span>yum &nbsp;-y &nbsp;install &nbsp;gcc &nbsp;gcc-c++ &nbsp;libxml2-devel m4 autoconf pcre-devel make cmake &nbsp;bison&nbsp; //必要扩展(不全)</strong></li>
<li><strong>&nbsp; &nbsp; &nbsp; &nbsp;如下&nbsp; &nbsp;//一行&nbsp; ./configure</strong></li>
<li><strong><strong>&nbsp; &nbsp; &nbsp; &nbsp;</strong></strong><code><span class="hljs-meta"><strong>make &amp;&amp; make instal</strong></span></code><code><span class="hljs-meta"><strong>l</strong></span></code></li>
</ol>
<div class="cnblogs_code">
<pre>./configure --prefix=/usr/local/php --with-config-<span style="color: rgba(0, 128, 128, 1)">file</span>-path=/usr/local/php/etc --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data--enable-mbstring --with-curl=/usr/local/curl --with-gd --with-zlib --with-bz2 --enable-sockets --enable-sysvsem --enable-sysvshm--enable-pcntl --enable-mbregex --enable-exif --enable-bcmath --with-mhash --enable-zip--with-pcre-regex --with-pdo-<span style="color: rgba(0, 128, 128, 1)">mysql</span> --with-mysqli --with-jpeg-<span style="color: rgba(0, 128, 128, 1)">dir</span>=/usr--with-png-<span style="color: rgba(0, 128, 128, 1)">dir</span>=/usr --with-openssl --with-libdir=/lib/x86_64-linux-gnu/--enable-ftp --with-gettext --with-xmlrpc --enable-opcache --with-<span style="color: rgba(0, 128, 128, 1)">iconv</span>--enable-mysqlnd--with-mysqli=mysqlnd--with-<span style="color: rgba(0, 128, 128, 1)">iconv</span>-<span style="color: rgba(0, 128, 128, 1)">dir</span> --with-kerberos --with-pdo-sqlite --with-pear --enable-libxml --enable-shmop --enable-xml --enable-opcache</pre>
</div>
<p>&nbsp;</p>
<div class="cnblogs_code">
<pre>/<span style="color: rgba(0, 0, 0, 1)">configure \
    </span>--prefix=/usr/local/<span style="color: rgba(0, 0, 0, 1)">php \                                 
    </span>--<span style="color: rgba(0, 128, 128, 1)">exec</span>-prefix=/usr/local/<span style="color: rgba(0, 0, 0, 1)">php \                              
    </span>--bindir=/usr/local/php/bin \                           
    </span>--sbindir=/usr/local/php/sbin \                           
    </span>--includedir=/usr/local/php/<span style="color: rgba(0, 0, 255, 1)">include</span><span style="color: rgba(0, 0, 0, 1)"> \                  
    </span>--libdir=/usr/local/php/lib/php \                        
    </span>--mandir=/usr/local/php/php/man \                        
    </span>--with-config-<span style="color: rgba(0, 128, 128, 1)">file</span>-path=/usr/local/php/<span style="color: rgba(0, 0, 0, 1)">etc \               
    </span>--with-<span style="color: rgba(0, 128, 128, 1)">mysql</span>-sock=/tmp/<span style="color: rgba(0, 128, 128, 1)">mysql</span>.<span style="color: rgba(0, 0, 0, 1)">sock \         
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">mcrypt \                                       [是php里面重要的加密支持扩展库,linux环境下该库在默认情况下不开启]
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">mhash \                                          
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">openssl \                                       
    </span>--with-mysqli=shared,<span style="color: rgba(0, 0, 0, 1)">mysqlnd \                        
    </span>--with-pdo-<span style="color: rgba(0, 128, 128, 1)">mysql</span>=shared,<span style="color: rgba(0, 0, 0, 1)">mysqlnd \                     
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">gd \                                                                                                
    </span>--with-<span style="color: rgba(0, 128, 128, 1)">iconv</span><span style="color: rgba(0, 0, 0, 1)"> \                                          [关闭iconv函数,种字符集间的转换]                        
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">zlib \                                          
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">zip \                                          [打开对zip的支持]
    </span>--enable-inline-<span style="color: rgba(0, 0, 0, 1)">optimization \                            [优化线程]
    </span>--disable-<span style="color: rgba(0, 0, 0, 1)">debug \                                        [关闭调试模式]
    </span>--disable-<span style="color: rgba(0, 0, 0, 1)">rpath \                                        [关闭额外的运行库文件]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">shared \                                        [启用动态库]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">xml \                                          [开启xml扩展]
    </span>--enable-bcmath \                                        [打开图片大小调整,<span style="color: rgba(0, 0, 0, 1)">用到zabbix监控的时候用到了这个模块]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">shmop \                                        [共享内存]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">sysvsem \                                        [内存共享方案]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">mbregex \                                        [开启多字节正则表达式的字符编码。]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">mbstring \                                        [开启多字节字符串函数]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">ftp \                                          [开启ftp]
    </span>--enable-gd-native-<span style="color: rgba(0, 0, 0, 1)">ttf \                              [开启gd库原有字体]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">pcntl \                                              
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">sockets \                                        [开启套节字]
    </span>--with-xmlrpc \                                          [打开xml-<span style="color: rgba(0, 0, 0, 1)">rpc的c语言]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">soap \                                          [开启简单对象访问协议简单对象访问协议]
    </span>--without-<span style="color: rgba(0, 0, 0, 1)">pear \                                        [开启php扩展与应用库]
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">gettext \                                        [开户php在当前域中查找消息]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">session \                                    [允许php会话session]
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">curl \                                           [允许curl扩展]
    </span>--with-<span style="color: rgba(0, 0, 0, 1)">openssl \                                       [允许openssl 扩展 下载composer 会用到]
    </span>--with-jpeg-<span style="color: rgba(0, 128, 128, 1)">dir</span><span style="color: rgba(0, 0, 0, 1)"> \                                        [指定jpeg安装目录yum安装过后不用再次指定会自动找到]
    </span>--with-freetype-<span style="color: rgba(0, 128, 128, 1)">dir</span><span style="color: rgba(0, 0, 0, 1)"> \                                    [指定freetype安装目录yum安装过后不用再次指定会自动找到]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">opcache \                                    [开启使用opcache缓存]
    </span>--enable-<span style="color: rgba(0, 0, 0, 1)">fpm \                                          [开启fpm]
    </span>--with-fpm-user=nginx \                                 
    </span>--with-fpm-group=nginx \                              
    </span>--without-<span style="color: rgba(0, 0, 0, 1)">gdbm \                                        [数据库函数使用可扩展散列和类似于标准UNIX dbm的工作]
    </span>--enable-fast-<span style="color: rgba(0, 0, 0, 1)">install \                                    [为快速安装优化]
    </span>--disable-fileinfo</pre>
</div>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong><em>&nbsp; &nbsp; &nbsp;php7&nbsp; 扩展安装&nbsp;之&nbsp;利用php解压文件的ext来安装&nbsp;</em></strong>&nbsp;</p>
<ul>
<li>进入ext文件 ,如&nbsp;cd /usr/src/php7.3.5/ext/xxx</li>
<li>用phpize来生成配置文件 //&nbsp; /usr/local/php/bin/phpize</li>
<li>./configure --with-php-config=/usr/local/php/bin/php-config</li>
<li>make &amp;&amp; make install</li>
<li>配置php.ini --&gt;extension_dir =/usr/local/php/lib/php/extension/no.xxx/xxx&nbsp; 和 extension = xxx.so</li>
<li>重启服务器</li>
</ul>
<p>&nbsp;</p>
<p><em><strong>这篇文章&nbsp;&nbsp;<span class="pln">libzip&nbsp;扩展安装帮到了我</span></strong></em></p>
<p>  https://www.cnblogs.com/equation/p/12352596.html</p>
<div class="precode clearfix">
<pre class="prettyprint prettyprinted"><span class="pln">  yum remove libzip libzip<span class="pun">-<span class="pln">devel
  wget https<span class="pun">:<span class="com">//hqidi.com/big/libzip-1.2.0.tar.gz<span class="pln">
  tar <span class="pun">-<span class="pln">zxvf libzip<span class="pun">-<span class="lit">1.2<span class="pun">.<span class="lit">0.tar<span class="pun">.<span class="pln">gz
  cd libzip<span class="pun">-<span class="lit">1.2<span class="pun">.<span class="lit">0<span class="pln">
  <span class="pun">./<span class="pln">configure
  make <span class="pun">&amp;&amp;<span class="pln"> make install</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre>
</div>
<p>  在网上找到的教程到了这一步就直接让你继续在PHP源码目录里面执行configure程序继续配置了,其实你虽然已经安装了libzip1.2,</p>
<p>  但是PHP的configure程序依然找不到,不知道你安装在哪,你得告诉PHP的configure程序,我安装了libzip 1.2并</p>
<p>  且安装在何处。以前是用ldconfig来通告系统所需动态库文件的位置,现在用pkg-config。<br>  我刚刚提供的方法安装的libzip默认被安装到了 /usr/local/lib 在这个目录下你能看到libzip.so libzip.so.5 libzip.so.5.0.0 还有一个pkgconfig目录。<br>  所以,真正的解决方法来了,在你configure的会话窗口直接输入如下内容:<br>  export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"<br>  上面命令的作用就是告诉configure程序,去/usr/local/lib 目录下找库文件,这样他就能找到libzip.so<br>  此时,你继续./configure将会很顺利的看到</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>问题 1:&nbsp; No package 'sqlite3' found 。</p>
<p>方法 1:&nbsp;通过yum命令安装sqlite3即可:&nbsp;<code>yum install sqlite-devel</code></p>
<p>问题 2:error: Please reinstall the BZip2 distribution&nbsp;</p>
<p>方法 2 :yum -y install bzip2-devel</p>
<p>问题 2:No package 'oniguruma' found</p>
<p>方法 3 :&nbsp;如下</p>
<div>
<ul>
<li><code>yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-5.9.5-3.el7.x86_64.rpm</code></li>
<li><code>yum install https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/o/oniguruma-devel-5.9.5-3.el7.x86_64.rpm</code></li>
<li></li>


</ul>
<p>问题4 :configure: WARNING: unrecognized options: --with-gd, --enable-zip, --with-pcre-regex, --with-jpeg-dir, --with-png-dir, --enable-libxml-dir</p>
<p>&nbsp;</p>
<div>问题 5 : the&nbsp;page&nbsp;you&nbsp;are&nbsp;looking&nbsp;for&nbsp;is&nbsp;currently&nbsp;unavailable</div>
<p>方法5 : 这个可能出现的问题原因之一是服务器里面有个叫 php-fpm 被停止了。</p>
<p>首先用ps&nbsp;-ef|grep&nbsp;9000<em id="__mceDel"><em id="__mceDel"><em id="__mceDel">监听端口,&nbsp; 如果发现php-fpm被停止了,给启动一下就可以了。</em></em></em></p>
<p>&nbsp;</p>
<p><em><em><em>问题 6 :composer&nbsp;安装laravel过程中报错</em></em></em></p>
<p>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.<br>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.<br>Installing 'unzip' may remediate them.</p>
<p>方法&nbsp;需要我们&nbsp;安装 zip、unzip 命令和 php-zip 扩展&nbsp;yum install -y unzip zip</p>
<p>&nbsp;安装扩展前后对比:<img src="https://img2020.cnblogs.com/i-beta/1212333/202003/1212333-20200310052744126-922296664.png"></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><img src="https://img2020.cnblogs.com/i-beta/1212333/202003/1212333-20200310052806418-1650461236.png"></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>


</div>
<p>&nbsp;</p><br><br>
来源:https://www.cnblogs.com/songyanan/p/12452100.html
頁: [1]
查看完整版本: php环境 安装