<value name="NLS_LANG">$NLS_LANG</value>
nginx+php+oci(下)
原创
©著作权归作者所有:来自51CTO博客作者linux_2003的原创作品,请联系作者获取转载授权,否则将追究法律责任
修改php.ini文件
手工修改:查找/usr/local/webapp/php/etc/php.ini中的
extension_dir = "./"
修改为
extension_dir = "/usr/local/webapp/php/lib/php/extensions/no-debug-non-zts-20060613/"
并在此行后增加以下几行,然后保存:
extension = "imagick.so"
extension = "memcache.so"
extension = "memcached.so"
extension = "oci8.so"
再查找output_buffering = Off 修改为output_buffering = On
配置eAccelerator加速PHP:
mkdir -p /usr/local/webapp/eaccelerator_cache
vi /usr/local/webapp/php/etc/php.ini
按shift+g键跳到配置文件的最末尾,加上以下配置信息:
[eaccelerator]
zend_extension="/usr/local/webapp/php/lib/php/extensions/no-debug-non-zts-20060613/eaccelerator.so"
eaccelerator.shm_size="128"
eaccelerator.cache_dir="/usr/local/webapp/eaccelerator_cache"
eaccelerator.enable="1"
eaccelerator.optimizer="1"
eaccelerator.check_mtime="1"
eaccelerator.debug="0"
eaccelerator.filter=""
eaccelerator.shm_max="0"
eaccelerator.shm_ttl="300"
eaccelerator.shm_prune_period="120"
eaccelerator.shm_only="0"
eaccelerator.compress="1"
eaccelerator.compress_level="9"
/usr/sbin/groupadd -M www -s /sbin/nologin
创建php-fpm配置文件
vi /usr/local/webapp/php/etc/php-fpm.conf
<?xml version="1.0" ?>
<configuration>
<section name="global_options">
<value name="pid_file">/usr/local/webapp/php/logs/php-fpm.pid</value>
<value name="error_log">/usr/local/webapp/php/logs/php-fpm.log</value>
<value name="log_level">notice</value>
<value name="emergency_restart_threshold">10</value>
<value name="emergency_restart_interval">1m</value>
<value name="process_control_timeout">5s</value>
<value name="daemonize">yes</value>
</section>
<workers>
<section name="pool">
<value name="name">default</value>
<value name="listen_address">127.0.0.1:9000</value>
<value name="listen_options">
<value name="backlog">-1</value>
<value name="owner"></value>
<value name="group"></value>
<value name="mode">0666</value>
</value>
<value name="php_defines">
<value name="sendmail_path">/usr/sbin/sendmail -t -i</value>
<value name="display_errors">1</value>
</value>
<value name="user">www</value>
<value name="group">www</value>
<value name="pm">
<value name="style">static</value>
<value name="max_children">128</value>
<value name="apache_like">
<value name="StartServers">20</value>
<value name="MinSpareServers">5</value>
<value name="MaxSpareServers">35</value>
</value>
</value>
<value name="request_terminate_timeout">0s</value>
<value name="request_slowlog_timeout">0s</value>
<value name="slowlog">logs/slow.log</value>
<value name="rlimit_files">51200</value>
<value name="rlimit_core">0</value>
<value name="chroot"></value>
<value name="chdir"></value>
<value name="catch_workers_output">yes</value>
<value name="max_requests">500</value>
<value name="allowed_clients">127.0.0.1</value>
<value name="environment">
<value name="HOSTNAME">$HOSTNAME</value>
<value name="PATH">/usr/local/bin:/usr/bin:/bin</value>
<value name="TMP">/tmp</value>
<value name="TMPDIR">/tmp</value>
<value name="TEMP">/tmp</value>
<value name="OSTYPE">$OSTYPE</value>
<value name="MACHTYPE">$MACHTYPE</value>
<value name="MALLOC_CHECK_">2</value>
<value name="ORACLE_HOME">$ORACLE_HOME</value>
<value name="NLS_LANG">$NLS_LANG</value>
<value name="NLS_LANG">$NLS_LANG</value>
</value>
</section>
</workers>
</configuration>
ulimit -SHn 51200
/usr/local/webapp/php/sbin/php-fpm start
# 启动后会提示Starting php_fpm done
安装nginx
tar zxvf pcre-8.01.tar.gz
cd pcre-8.01/
./configure
make && make install
cd ../
tar zxvf nginx-0.8.29.tar.gz
cd nginx-0.8.29/
./configure --user=www --group=www --prefix=/usr/local/webapp/nginx --with-http_stub_status_module --with-http_ssl_module
make && make install
cd ../
创建nginx配置文件
在/usr/local/webapp/nginx/conf/目录中创建fcgi.conf文件:
输入
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
编辑nginx.conf设置解析php
location ~ .*\.(php|php5)?$
{
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fcgi.conf;
}
配置nginx.conf
服务加入开机自启动
ulimit -SHn 51200
/usr/local/webapp/php/sbin/php-fpm start
/usr/local/webapp/nginx/sbin/nginx
vi /usr/local/webapp/nginx/html/test.php
<?php
phpinfo();
?>
查看各种信息
系统优化
vi /etc/sysctl.conf
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
执行sysctl -p
上一篇:nginx+php+oci(上)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
PHP安装OCI8扩展
PHP安装OCI8扩展
PHP安装OCI8扩展 php oci8 phpoci8 -
php支持oracle oci编译参数
linux php 参数 编译
php linux oracl