php抖音多账号管理系统源码,requirements.php

这是一个用于检查PHP应用程序运行所需的环境配置脚本。它检查了如PDO、GD、ImageMagick等PHP扩展,以及一些PHP ini设置,如'expose_php'和'allow_url_include'。该脚本可以通过命令行或在Web根目录下运行,确保系统满足Yii框架的运行要求。

/**

* Application requirement checker script.

*

* In order to run this script use the following console command:

* php requirements.php

*

* In order to run this script from the web, you should copy it to the web root.

* If you are using Linux you can create a hard link instead, using the following command:

* ln ../requirements.php requirements.php

*/

// you may need to adjust this path to the correct Yii framework path

// uncomment and adjust the following line if Yii is not located at the default path

//$frameworkPath = dirname(__FILE__) . '/vendor/yiisoft/yii2';

if (!isset($frameworkPath)) {

$searchPaths = array(

dirname(__FILE__) . '/vendor/yiisoft/yii2',

dirname(__FILE__) . '/../vendor/yiisoft/yii2',

);

foreach ($searchPaths as $path) {

if (is_dir($path)) {

$frameworkPath = $path;

break;

}

}

}

if (!isset($frameworkPath) || !is_dir($frameworkPath)) {

$message = "

Error

\n\n"

. "

The path to yii framework seems to be incorrect.

\n"

. '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".

\n"

. '

Please refer to the README on how to install Yii.

\n";

if (!empty($_SERVER['argv'])) {

// do not print HTML when used in console mode

echo strip_tags($message);

} else {

echo $message;

}

exit(1);

}

require_once($frameworkPath . '/requirements/YiiRequirementChecker.php');

$requirementsChecker = new YiiRequirementChecker();

$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.';

$gdOK = $imagickOK = false;

if (extension_loaded('imagick')) {

$imagick = new Imagick();

$imagickFormats = $imagick->queryFormats('PNG');

if (in_array('PNG', $imagickFormats)) {

$imagickOK = true;

} else {

$imagickMemo = 'Imagick extension should be installed with PNG support in order to be used for image CAPTCHA.';

}

}

if (extension_loaded('gd')) {

$gdInfo = gd_info();

if (!empty($gdInfo['FreeType Support'])) {

$gdOK = true;

} else {

$gdMemo = 'GD extension should be installed with FreeType support in order to be used for image CAPTCHA.';

}

}

/**

* Adjust requirements according to your application specifics.

*/

$requirements = array(

// Database :

array(

'name' => 'PDO extension',

'mandatory' => true,

'condition' => extension_loaded('pdo'),

'by' => 'All DB-related classes',

),

array(

'name' => 'PDO SQLite extension',

'mandatory' => false,

'condition' => extension_loaded('pdo_sqlite'),

'by' => 'All DB-related classes',

'memo' => 'Required for SQLite database.',

),

array(

'name' => 'PDO MySQL extension',

'mandatory' => false,

'condition' => extension_loaded('pdo_mysql'),

'by' => 'All DB-related classes',

'memo' => 'Required for MySQL database.',

),

array(

'name' => 'PDO PostgreSQL extension',

'mandatory' => false,

'condition' => extension_loaded('pdo_pgsql'),

'by' => 'All DB-related classes',

'memo' => 'Required for PostgreSQL database.',

),

// Cache :

array(

'name' => 'Memcache extension',

'mandatory' => false,

'condition' => extension_loaded('memcache') || extension_loaded('memcached'),

'by' => 'MemCache',

'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : ''

),

// CAPTCHA:

array(

'name' => 'GD PHP extension with FreeType support',

'mandatory' => false,

'condition' => $gdOK,

'by' => 'Captcha',

'memo' => $gdMemo,

),

array(

'name' => 'ImageMagick PHP extension with PNG support',

'mandatory' => false,

'condition' => $imagickOK,

'by' => 'Captcha',

'memo' => $imagickMemo,

),

// PHP ini :

'phpExposePhp' => array(

'name' => 'Expose PHP',

'mandatory' => false,

'condition' => $requirementsChecker->checkPhpIniOff("expose_php"),

'by' => 'Security reasons',

'memo' => '"expose_php" should be disabled at php.ini',

),

'phpAllowUrlInclude' => array(

'name' => 'PHP allow url include',

'mandatory' => false,

'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"),

'by' => 'Security reasons',

'memo' => '"allow_url_include" should be disabled at php.ini',

),

'phpSmtp' => array(

'name' => 'PHP mail SMTP',

'mandatory' => false,

'condition' => strlen(ini_get('SMTP')) > 0,

'by' => 'Email sending',

'memo' => 'PHP mail SMTP server required',

),

);

// OPcache check

if (!version_compare(phpversion(), '5.5', '>=')) {

$requirements[] = array(

'name' => 'APC extension',

'mandatory' => false,

'condition' => extension_loaded('apc'),

'by' => 'ApcCache',

);

}

$result = $requirementsChecker->checkYii()->check($requirements)->getResult();

$requirementsChecker->render();

exit($result['summary']['errors'] === 0 ? 0 : 1);

一键复制

编辑

Web IDE

原始数据

按行查看

历史

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值