PHPRC问题

来源:互联网 发布:知乎大神有哪些 编辑:程序博客网 时间:2024/06/02 02:03

I'm using apache2 on OSX, by default the php.ini location is:

/private/etc/php.ini

I need to change it to this...

/Library/FileMaker Server/Web Publishing/publishing-engine/php/lion/lib/php.ini

Any help?

1.Use PHPIniDir directive in apache config file after LoadModule :

example:

LoadModule php5_module /path/to/php5_module

PHPIniDir path/to/php.ini


2.Or set the PHPRC environment variable:

example:

export PHPRC=path/to/php.ini


apache+modfcgi配置PHPRC自定义php.ini路径

下面是apache+mod_fcgid实现PHPRC自定义php.ini路径

linux版本是CentOS Linux release 6.0,apache和mod_fcgid都是yum安装。

修改apache配置文件

添加:

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
<VirtualHost *:80>
    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /var/www/html
    ServerName 666.5keke.com
    ErrorLog logs/cacti-error_log
    CustomLog logs/cacti-access_log common
    <IfModule mod_fcgid.c>
        ScriptAlias /fcgi-bin/ /home/phpcgi/bin/
        <directory /home/phpcgi/bin/>
            AllowOverride None
            Order allow,deny
            Allow from all
        </directory>
        <Location /fcgi-bin/>
            SetHandler fcgid-script
            Options +ExecCGI
        </Location>
        AddHandler php-fastcgi .php
        Action php-fastcgi /fcgi-bin/php-starter
    </IfModule>
</VirtualHost>

添加php-starter脚本

?
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
vi /home/phpcgi/bin/php-starter
 
#!/bin/sh
umask 022
PHPRC="/home/phpcgi/etc"
 
export PHPRC
PHP_FCGI_CHILDREN=0
export PHP_FCGI_CHILDREN
PHP_FCGI_MAX_REQUESTS=5000
export PHP_FCGI_MAX_REQUESTS
exec /usr/bin/php-cgi -d session.save_path=/home/phpcgi/temp -d open_basedir="/home/phpcgi/temp" -d upload_tmp_dir="/home/phpcgi/temp" -d sendmail_path="/usr/sbin/sendmail -f 5keke -t -i"
 
 
#session.save_path 是保存session的路径
#open_basedir      可将用户访问文件的活动范围限制在指定的区域
#upload_tmp_dir    默认上传临时目录
#sendmail_path     调用sendmail程序的路径

3.In my / folder (above /htdocs) I created an .htaccess file with the following content:

Code:
SetEnv TZ America/IndianapolisSetEnv ERRLOGFILE /home/users/web/bEXAMPLE/pow.EXAMPLE/phpsessions/cgi_error_log.txtSetEnv TMPDIR /home/users/web/bEXAMPLE/pow.EXAMPLE/phpsessionsSetEnv PHPSESSDIR /home/users/web/bEXAMPLE/pow.EXAMPLE/phpsessionsSetEnv PHPRC /home/users/web/bEXAMPLE/pow.EXAMPLE/
原创粉丝点击