php中yaf框架的服務器配置

1  yaf 擴展php

wget http://pecl.php.net/get/yaf-3.0.4.tgz 
   /usr/local/php/bin/phpize
    ./configure --with-php-config=/usr/local/php/bin/php-config
   make && make install
 echo "extension=yaf.so" >> /usr/local/php/etc/php.ini

2 yafconf 擴展css

wget http://pecl.php.net/get/yaconf-1.0.2.tgz
 /usr/local/php/bin/phpize
 ./configure --with-php-config=/usr/local/php/bin/php-config
  make && make install 
echo "extension=yaconf.so" >> /usr/local/php/etc/php.ini

3   yafconf 配置,在php.ini中 須要填寫配置文件的目錄html

1
yaconf.directory = / yaconf

  關於PHP如何獲取配置參數,參看 http://blog.jobbole.com/90405/python

4  nginx 虛擬服務器的配置nginx

  nginx 對yaf 的配置中須要增長一條 url 重定向,不然yaf 的路由控制訪問的時候會報404錯誤數據庫

 

複製代碼
  server {
        listen       80;
        root   /home/wwwroot/sssm;
        index index.php index.html index.htm;
        server_name   sssm.test.zhonghuass.cn;
        include       mime.types;
        default_type  application/octet-stream;
        client_header_buffer_size 1024k;
        large_client_header_buffers 4 1024k;
        client_max_body_size 8m;
        gzip off;
    rewrite ^/admin/public/images/(.*\.(js|ico|gif|jpg|png|css|bmp|html|xls)$) /admin/public/images/$1 last;

# 注意,下面這個URL 重定向必定要加上。 if (!-e $request_filename) { rewrite ^/(.*) /index.php?$1 last; } location / { root /home/wwwroot/sssm; index index.php index.html index.htm; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } location ~ \.php$ { root /home/wwwroot/sssm; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } access_log /home/wwwlogs/sssm/access.log main; error_log /home/wwwlogs/sssm/error.log error; }
複製代碼

 

5  若是是apache 須要在虛擬服務的配置文件中添加一下規則apache

複製代碼
<VirtualHost *:80>
    ServerName jinkang
    DocumentRoot D:/wamp64/wwwroot/
    <Directory  "D:/wamp64/wwwroot/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local
        RewriteEngine On
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteRule .* index.php
    </Directory>
</VirtualHost>
複製代碼

或者在代碼根目錄下新建文件 .htaccess服務器

內容爲 app

複製代碼

RewriteEngine On
RewriteRule ^/Api/(.*) /Api/index.php
RewriteRule ^/admin/(.*) /admin/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* index.phpide

複製代碼

 

yaconf  配置  yaconf.directory=/tmp/yaconf/  (注意後綴)

application/library/Db.php    public function __construct($dbname = 'gjml')   數據庫標識

application/library/Yaconf.php     $m['gjml']=$e; 

application/Bootstrap.php     

Yaf_Registry::set('db', new Db('gjml'));

在yaconf.directory 下建立文件 db.ini

s.hostname = "122"s.username = "12"s.password = "12"s.port = "3306"s.database = "12"s.charset = "utf8"s.debug = "1"

相關文章
相關標籤/搜索