<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></title> 
<link>https://jackxiang.com/index.php</link> 
<description><![CDATA[赢在IT，Playin' with IT,Focus on Killer Application,Marketing Meets Technology.]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[向东博客 专注WEB应用 构架之美 --- 构架之美，在于尽态极妍 | 应用之美，在于药到病除]]></copyright>
<item>
<link>https://jackxiang.com/post//</link>
<title><![CDATA[[运维用到]PHP的with-config-file-path 这个是用来指定目录，不是指定文件，PHP扩展的ini配置文件目录指定。]]></title> 
<author>jack &lt;xdy108@126.com&gt;</author>
<category><![CDATA[Php/Js/Shell/Go]]></category>
<pubDate>Fri, 18 Mar 2016 08:01:15 +0000</pubDate> 
<guid>https://jackxiang.com/post//</guid> 
<description>
<![CDATA[ 
	背景：运行指定扩展配置文件extension.ini的扫描目录，这样结构化有利于运维进行模块添加，也是后来我运维时看到并实践的文章，参考文章，http://jackxiang.com/post/8613/。<br/><br/>参数 --prefix=/usr/local/php --with-config-file-scan-dir=/usr/local/php/etc/ <br/>一定要设置正确，多个PHP版本须编译安装在不同路径！！！后面编译后无法修改此项：<br/>Set the path in which to look for php.ini [PREFIX/lib]<br/>--with-config-file-scan-dir=PATH<br/>php.ini的扩展目录，php&nbsp;&nbsp;-c /usr/local/php/etc/php-workerman.ini&nbsp;&nbsp;--ini=/usr/local/php/etc/php-workerman.d --help&#124;grep scan 编译完php二进制后并没有提供参数指定。<br/><br/>作者：风吹我已散博客<br/>链接：https://www.jianshu.com/p/f13402d5217e<br/>来源：简书<br/>著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。<br/><br/><textarea name="code" class="php" rows="15" cols="100">
php -i&#124;grep &quot;php.d&quot; --color
Scan this dir for additional .ini files =&gt; /usr/local/php/etc/php.d
Additional .ini files parsed =&gt; /usr/local/php/etc/php.d/memcached.ini,
/usr/local/php/etc/php.d/opcache.ini,
/usr/local/php/etc/php.d/redis.ini
$_SERVER[&#039;PWD&#039;] =&gt; /usr/local/php/etc/php.d
$_SERVER[&#039;OLD_PWD&#039;] =&gt; /usr/local/php/etc/php.d

</textarea><br/><br/>PHP7在和PHP6一块时注意这个参数，下面就是编译时给指向了PHP5的目录了，出现运行报错，如下：<br/>/usr/local/php7/bin/php start.php <br/>PHP Warning:&nbsp;&nbsp;PHP Startup: Unable to load dynamic library &#039;redis.so&#039; (tried: /usr/local/php/ext/redis.so (/usr/local/php/ext/redis.so: Undefined symbol &quot;zval_used_for_init&quot;), /usr/local/php/ext/redis.so.so (Cannot open &quot;/usr/local/php/ext/redis.so.so&quot;)) in Unknown on line 0<br/>Usage: php yourfile &lt;command&gt; [mode]<br/><textarea name="code" class="php" rows="15" cols="100">
/usr/local/php7/bin/php&nbsp;&nbsp;-i&#124;grep php.d
Scan this dir for additional .ini files =&gt; /usr/local/php/etc/php.d
Additional .ini files parsed =&gt; /usr/local/php/etc/php.d/redis.ini
</textarea><br/><br/>还原编译时的命令，如下：<br/>/usr/local/php7/bin/php -i&#124;grep configure&nbsp;&nbsp;编译参数：<br/>--with-config-file-scan-dir=/usr/local/php7/etc/php.d<br/><br/>个性php.ini里面的参数：<br/>extension_dir =&gt; /usr/local/php/ext/ =&gt; /usr/local/php/ext/&nbsp;&nbsp;#这一行没有写，所以就找到/usr/local/php/ext上去了，得写成：<br/>extension_dir =&gt; /usr/local/php7/ext/ =&gt; /usr/local/php7/ext/<br/>/bin/sed -i &#039;s#; extension_dir = &#92;&quot;&#92;.&#92;/&#92;&quot;#extension_dir = &quot;/usr/local/php/ext/&quot;#&#039;&nbsp;&nbsp;%&#123;buildroot&#125;/%&#123;_prefix&#125;/etc/php.ini <br/>#sed -i &quot;&quot; &#039;s#; extension_dir = &#92;&quot;&#92;.&#92;/&#92;&quot;#extension_dir = &quot;/usr/local/php7/ext/&quot;#&#039; /usr/local/php7/etc/php.ini<br/> 737 extension_dir = &quot;/usr/local/php7/ext/&quot;<br/> 738 ; On windows:<br/> 739 ; extension_dir = &quot;ext&quot;&nbsp;&nbsp;<br/><br/><textarea name="code" class="php" rows="15" cols="100">
./configure --prefix=/usr/local/php7 --with-libdir=lib64 --with-config-file-path=/usr/local/php7/etc --with-config-file-scan-dir=/usr/local/php7/etc/php.d --with-iconv-dir=/usr/local --with-iconv=/usr/local/libiconv --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-libxml-dir=/usr --with-curl --with-curlwrappers --with-mcrypt --with-gd --with-openssl --with-mhash --with-xmlrpc --without-pear --with-fpm-user=www --with-fpm-group=www --with-gettext --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-pdo-mysql=mysqlnd --enable-xml --enable-bcmath --enable-shmop --enable-sysvsem --enable-fpm --enable-mbstring --enable-gd-native-ttf --enable-pcntl --enable-sockets --enable-zip --enable-soap --enable-opcache --enable-exif --enable-mbregex --enable-inline-optimization --enable-ftp --enable-fileinfo --disable-rpath --disable-ipv6 --disable-debug --with-readline
</textarea><br/><br/><br/>/usr/local/php/etc/php.d/redis.ini<br/>php -m&#124;grep redis<br/>redis<br/>是因为有：<br/>--with-config-file-scan-dir=/usr/local/php/etc/php.d &#92;<br/>--with-config-file-scan-dir是搜索下面的ini文件和php.ini一起使用，好处就是扩展的那些extension=&quot;xx.so&quot;可以放里面，每个扩展一个ini文件，可以方便的用自动化脚本或者部署脚本来搞，看起来模块化了<br/><br/><br/>&#039;—with-config-file-path=/data/software/php-5.6.15/lib/php.ini<br/><br/>open(&quot;/data/software/php-5.6.15/bin/php-cli.ini&quot;, O_RDONLY) = -1 ENOENT (No such file or directory)<br/>open(&quot;/data/software/php-5.6.15/lib/php.ini/php-cli.ini&quot;, O_RDONLY) = -1 ENOTDIR (Not a directory)<br/>open(&quot;/data/software/php-5.6.15/bin/php.ini&quot;, O_RDONLY) = -1 ENOENT (No such file or directory)<br/>open(&quot;/data/software/php-5.6.15/lib/php.ini/php.ini&quot;, O_RDONLY) = -1 ENOTDIR (Not a directory)<br/><br/><br/>求问这是bug么？<br/>--with-config-file-path=PATH<br/>&nbsp;&nbsp;--with-config-file-scan-dir=PATH<br/>—with-config-file-path 这个是用来指定目录，不是指定文件。<br/>scan这个干嘛的？还能指定php去这个配置目录扫描？<br/>http://php.net/manual/zh/function.php-ini-scanned-files.php<br/>php.conf.d/*.ini <br/><br/>应该一个是cli，一个是运行服务的吧？<br/>不是吧 应该是搜索这个目录下的 ＊.ini 文件吧<br/><br/>scan是扩展配置文件目录<br/>cli sapi默认都是编译时指定的位置，也可以手动指定<br/><br/>嗯，--with-config-file-scan-dir是搜索下面的ini文件和php.ini一起使用，好处就是扩展的那些extension=&quot;xx.so&quot;可以放里面，每个扩展一个ini文件，可以方便的用自动化脚本或者部署脚本来搞，看起来模块化了<br/><br/><br/>关于opcache想编译成静态所谓提高效率:<br/><br/>PHP 5.5.0 及后续版本，<br/>OPcache 只能编译为共享扩展。<br/>—————————————————<br/>理论上性能好点儿，高并发可能瓶颈不在这儿，所以不明显。<br/>静态这个是迷信 嘿嘿，嗯 所以我说这是我自己的迷信 嘿嘿。
]]>
</description>
</item><item>
<link>https://jackxiang.com/post//#blogcomment</link>
<title><![CDATA[[评论] [运维用到]PHP的with-config-file-path 这个是用来指定目录，不是指定文件，PHP扩展的ini配置文件目录指定。]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://jackxiang.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>