本文整理汇总了PHP中apache_setenv函数的典型用法代码示例。如果您正苦于以下问题:PHP apache_setenv函数的具体用法?PHP apache_setenv怎么用?PHP apache_setenv使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了apache_setenv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: satispress_send_file
/**
* Send a download.
*
* @since 0.1.0
*
* @param string $file An absolute file path.
*/
function satispress_send_file($file)
{
@session_write_close();
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
if (get_magic_quotes_runtime()) {
@set_magic_quotes_runtime(0);
}
@ini_set('zlib.output_compression', 'Off');
@set_time_limit(0);
@ob_end_clean();
if (ob_get_level()) {
@ob_end_clean();
// Zip corruption fix.
}
nocache_headers();
header('Robots: none');
header('Content-Type: application/force-download');
header('Content-Description: File Transfer');
header('Content-Disposition: attachment; filename="' . basename($file) . '";');
header('Content-Transfer-Encoding: binary');
if ($size = @filesize($file)) {
header('Content-Length: ' . $size);
}
@readfile_chunked($file) or wp_die(__('File not found', 'satispress'));
exit;
}
示例2: getResponse
/**
* @param Request $request
*
* @return Response
*/
public static function getResponse(Request $request)
{
ignore_user_abort(true);
//turn off gzip compression
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', 1);
}
ini_set('zlib.output_compression', 0);
$response = new Response();
//removing any content encoding like gzip etc.
$response->headers->set('Content-Encoding', 'none');
//check to ses if request is a POST
if ($request->getMethod() == 'GET') {
$response->headers->set('Connection', 'close');
//return 1x1 pixel transparent gif
$response->headers->set('Content-Type', 'image/gif');
//avoid cache time on browser side
$response->headers->set('Content-Length', '42');
$response->headers->set('Cache-Control', 'private, no-cache, no-cache=Set-Cookie, proxy-revalidate');
$response->headers->set('Expires', 'Wed, 11 Jan 2000 12:59:00 GMT');
$response->headers->set('Last-Modified', 'Wed, 11 Jan 2006 12:59:00 GMT');
$response->headers->set('Pragma', 'no-cache');
$response->setContent(self::getImage());
} else {
$response->setContent(' ');
}
return $response;
}
示例3: disable_gzip
function disable_gzip()
{
@ini_set('zlib.output_compression', 'Off');
@ini_set('output_buffering', 'Off');
@ini_set('output_handler', '');
@apache_setenv('no-gzip', 1);
}
示例4: __construct
public function __construct($config_file = NULL)
{
if ($config_file == NULL) {
$config_file = APP_DIR . '/.env';
}
$this->getenv_func = 'getenv';
if (function_exists('apache_getenv')) {
$this->getenv_func = 'apache_getenv';
}
if (!file_exists($config_file)) {
Logger::warning('Unable to find the configuration file (only the global environment variable will be available)!');
return;
}
$config = file_get_contents($config_file);
$lines = explode(PHP_EOL, $config);
foreach ($lines as $env) {
$env = trim($env);
if (!empty($env)) {
if (function_exists('apache_setenv')) {
$raw = explode('=', $env);
if (count($raw) == 2) {
apache_setenv($raw[0], $raw[1]);
} else {
Logger::warning('Invalid environment definition: ' . $env);
}
continue;
}
putenv($env);
}
}
unset($lines);
unset($config);
}
示例5: store
/**
* Attribution pixel
*
* @param PixelRequest $request
* @return Image
*/
public function store(PixelRequest $request)
{
$this->agent->setUserAgent($request->header('user-agent'));
ignore_user_abort(true);
// Turn off gzip compression
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', 1);
}
ini_set('zlib.output_compression', 0);
// Turn on output buffering if necessary
if (ob_get_level() == 0) {
ob_start();
}
// Remove any content encoding
header('Content-encoding: none', true);
if (!$request->isMethod('post')) {
// Create attribution entry
$attribution = Attribution::create(['landing_page_id' => $request->get('lp'), 'email' => $request->get('em'), 'tracking_id' => $request->get('t'), 'converting_source' => $request->get('cs'), 'converting_medium' => $request->get('cm'), 'converting_keyword' => $request->get('ck'), 'converting_content' => $request->get('ccn'), 'converting_campaign' => $request->get('cc'), 'converting_landing_page' => $request->get('cl'), 'converting_timestamp' => Carbon::createFromTimeStamp($request->get('ct'))->toDateTimeString(), 'original_source' => $request->get('os'), 'original_medium' => $request->get('om'), 'original_keyword' => $request->get('ok'), 'original_content' => $request->get('ocn'), 'original_campaign' => $request->get('oc'), 'original_landing_page' => $request->get('ol'), 'original_timestamp' => Carbon::createFromTimeStamp($request->get('ot'))->toDateTimeString(), 'refer_url' => $request->get('r'), 'platform' => $this->agent->platform(), 'device' => $this->agent->device(), 'browser' => $this->agent->browser(), 'version' => $this->agent->version($this->agent->browser())]);
// Link attribution entry to lead
\Event::fire(new AttributionSubmitted($attribution));
// Return 1x1 pixel transparent gif
header("Content-type: image/gif");
header("Content-Length: 42");
header("Cache-Control: private, no-cache, no-cache=Set-Cookie, proxy-revalidate");
header("Pragma: no-cache");
echo base64_decode('R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEA');
}
// Flush output buffers
ob_flush();
flush();
ob_end_flush();
}
示例6: init
public function init()
{
if (file_exists($this->sock)) {
$this->log->error("Sock file already exists, concurrent process cannot be started");
exit;
}
$this->log->info('Streamer initialization');
// connection keep-alive, in other case browser will close it when receive last frame
header('Connection: keep-alive');
// disable caches
header('Cache-Control: no-cache');
header('Cache-Control: private');
header('Pragma: no-cache');
// x-mixed-replace to stream JPEG images
header('Content-type: multipart/x-mixed-replace; boundary=' . self::$BOUNDARY);
// set unlimited so PHP doesn't timeout during a long stream
set_time_limit(0);
// ignore user abort script
ignore_user_abort(true);
@apache_setenv('no-gzip', 1);
// disable apache gzip compression
@ini_set('zlib.output_compression', 0);
// disable PHP zlib compression
@ini_set('implicit_flush', 1);
// flush all current buffers
$k = ob_get_level();
for ($i = 0; $i < $k; $i++) {
ob_end_flush();
}
register_shutdown_function(array($this, 'shutdown'));
fclose(fopen($this->sock, 'w'));
$this->initialized = true;
}
示例7: __construct
function __construct(){
$this->cache_token = obcer::cache_token((COUCH?'db':NULL));
$this->start_time = (float) array_sum(explode(' ',microtime()));
$this->oh_memory = round(memory_get_usage() / 1024);
// set up the 'filter' variable to determine what columns to show
if(SHOW_ALL == FALSE){
if(SHOW_LANGUAGE == false ) $this->c_filter []='language';
if(SHOW_SUPPRESS == false) $this->c_filter []='suppress';
if(SHOW_RXCUI == false) $this->c_filter []='rxcui';
if(SHOW_NAME == false) $this->c_filter []='name';
if(SHOW_ALL_SYNONYM == FALSE) $this->c_filter []= 'synonym';
if(SHOW_TTY == false) $this->c_filter []='tty';
if(SHOW_UML == false) $this->c_filter []= 'umlscui';
}
// of course I could make a checkbox panel to allow for any combination of display fields, and cache entire returned xml results to do manipulations
if(PROGRESSIVE_LOAD){
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
flush();
ob_implicit_flush(1);
ob_start();
}
// process any post if existant
if($_POST) self::post_check();
// if we haven't died by now then close and flush the ob cache for the final time
// echo the footer and stats to screen.
echo '<div id="stats">' . $this->stats().'</div>';
}
示例8: reset
/**
* Resets the entire Database
*/
function reset()
{
$this->load->dbforge();
try {
// force disabling of g-zip so output can be streamed
apache_setenv('no-gzip', '1');
} catch (Exception $e) {
/* ignore */
}
// @todo: Abrir views especifica para o load das tables;
?>
<div class="database_setup"><?php
$this->_message('Creating the database at <strong>' . $this->db->database . '</strong><br/>', '');
$success = $this->_drop_tables();
echo "<br/><br/>";
$success = $success && $this->_create_tables();
echo "<br/><br/>";
$success = $success && $this->_init_data();
?>
</div><?php
if ($success) {
?>
<p><a href="<?php
echo site_url('welcome');
?>
">Continue</a></p><?php
} else {
?>
An error occurred. Please reset the database and try again.<?php
}
}
示例9: disableCompression
/**
* Disables the output compression used by the server or PHP.
* @codeCoverageIgnore
*/
protected function disableCompression()
{
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', 1);
}
ini_set('zlib.output_compression', 0);
}
示例10: response
public function response()
{
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_clean();
}
ob_implicit_flush(1);
header('Content-Type: ' . (isset($_GET['callback']) ? 'text/javascript' : 'application/json'));
header('Access-Control-Allow-Origin: *');
try {
if ($this->auth()) {
$this->handler = new RestHandler($this->method, $this);
$response = $this->handler->response();
echo $this->formatResponse($response);
} else {
throw new RestException(RestException::APP_NOT_AUTHORIZED);
}
} catch (RestException $e) {
echo $this->formatResponse($e);
}
@ob_flush();
@flush();
}
示例11: disable_ob
function disable_ob()
{
// Turn off output buffering
ini_set('output_buffering', 'off');
// Turn off PHP output compression
ini_set('zlib.output_compression', false);
// Implicitly flush the buffer(s)
ini_set('implicit_flush', true);
ob_implicit_flush(true);
// Clear, and turn off output buffering
while (ob_get_level() > 0) {
// Get the curent level
$level = ob_get_level();
// End the buffering
ob_end_clean();
// If the current level has not changed, abort
if (ob_get_level() == $level) {
break;
}
}
// Disable apache output buffering/compression
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', '1');
apache_setenv('dont-vary', '1');
}
}
示例12: send
/**
* {@inheritdoc}
*/
public function send()
{
// Disable gzip compression on Apache configurations
if (function_exists('apache_setenv')) {
apache_setenv('no-gzip', '1');
}
parent::send();
}
示例13: sendFile
public static function sendFile($localFileName, $asRemoteFileName, $mimeType, $desc, $cleanUpFunc = null)
{
// Turn off server-side auto compression if it is present...
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
$okay = TRUE;
$status = 200;
$result = FALSE;
if (!is_file($localFileName)) {
header('HTTP/1.0 404 Not Found');
$okay = FALSE;
$status = 404;
}
if ($okay === TRUE && !is_readable($localFileName)) {
header('HTTP/1.0 403 Forbidden');
$okay = FALSE;
$status = 403;
}
if ($okay == TRUE) {
// Set the headers...
header('Pragma: public');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// some day in the past
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header("Cache-Control: private", false);
// required for certain browsers
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($localFileName)) . ' GMT');
if ($desc !== null) {
header('Content-Description: ' . $desc);
}
if ($mimeType !== null) {
header('Content-Type: ' . $mimeType);
} else {
header('Content-Type: application/octet-stream');
}
if ($asRemoteFileName == null) {
header('Content-Disposition: attachment');
} else {
header('Content-Disposition: attachment; filename="' . $asRemoteFileName . '"');
}
header('Content-Transfer-Encoding: binary');
$len = filesize($localFileName);
header('Content-Length: ' . $len);
flush();
ob_clean();
ob_end_flush();
// Send the file...
$result = @readfile($localFileName);
if ($result === FALSE || $result !== $len) {
$okay = FALSE;
$status = 0;
}
}
if ($cleanUpFunc !== null) {
@call_user_func($cleanUpFunc, $localFileName, $result, $status);
}
exit;
}
示例14: upgrade
public function upgrade()
{
$this->output->enable_profiler(FALSE);
if (!extension_loaded('zip')) {
$this->alert->set('warning', $this->lang->line('alert_zip_warning'));
redirect('updates');
}
if (!$this->uri->rsegment(3)) {
$this->alert->set('warning', $this->lang->line('alert_bad_request'));
redirect('updates');
} else {
if (!$this->user->hasPermission('Site.Updates.Add')) {
$this->alert->set('warning', $this->lang->line('alert_permission_warning'));
redirect('updates');
}
}
$update_type = $this->uri->rsegment(3);
$this->setHTMLHead();
set_time_limit(300);
// 5 minutes
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
ob_implicit_flush(TRUE);
ignore_user_abort(TRUE);
if (ob_get_level() == 0) {
ob_start();
}
flush_output($this->load->view($this->config->item('admin', 'default_themes') . 'updates_upgrade', '', TRUE), FALSE);
if ($update_type === 'core') {
// Enable maintenance mode, will be disabled after update
flush_output($this->lang->line('progress_enable_maintenance') . "<br />");
$maintenance_mode = $this->config->item('maintenance_mode');
$this->config->set_item('maintenance_mode', 0);
$this->Updates_model->update($update_type);
// Restore maintenance mode
flush_output($this->lang->line('progress_disable_maintenance'));
$this->config->set_item('maintenance_mode', $maintenance_mode);
flush_output(sprintf($this->lang->line('text_complete_installation'), base_url()));
} else {
if ($updates = $this->input->get('updates')) {
foreach ($updates as $update) {
$update = explode('|', $update);
if (count($update) === 2) {
$this->Updates_model->update($update_type, $update[0], $update[1]);
}
}
}
}
flush_output('<script type="text/javascript">
parent.jQuery(\'#updateProgress\').attr(\'class\', \'fa fa-check\')
.attr(\'title\', \'Complete\');
</script>', FALSE);
flush_output('</body></html>', FALSE);
ob_end_flush();
}
示例15: download
/**
* Set the file headers and force the download of a given file
*
* @return void
*/
public function download()
{
if (isset($_GET['download']) && isset($_GET['payment_id'])) {
$transaction_id = urldecode($_GET['download']);
$payment_id = urldecode($_GET['payment_id']);
$product_id = urldecode($_GET['product_id']);
// Old download links might not have attachment_id set.
// This means they were purchased before we added support
// for multiple attachments. So, we just grab the first
// attachment_id saved in post meta.
$attachment_id = !empty($_GET['attachment_id']) ? urldecode($_GET['attachment_id']) : sell_media_get_attachment_id($product_id);
$size_id = !empty($_GET['size_id']) ? urldecode($_GET['size_id']) : null;
$verified = apply_filters('sell_media_verify_download', $this->verify($transaction_id, $payment_id), $product_id);
if ($verified) {
$file = Sell_Media()->products->get_protected_file($product_id, $attachment_id);
if (!file_exists($file)) {
wp_die(__('The original high resolution file doesn\'t exist here: %1$s', 'sell_media'), $file);
exit;
}
$file_type = wp_check_filetype($file);
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
if (function_exists('get_magic_quotes_runtime') && get_magic_quotes_runtime()) {
set_magic_quotes_runtime(0);
}
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 'Off');
nocache_headers();
header("Robots: none");
header("Content-Type: " . $file_type['type'] . "");
header("Content-Description: File Transfer");
header("Content-Disposition: attachment; filename=\"" . basename($file) . "\"");
header("Content-Transfer-Encoding: binary");
// If image, generate the image sizes purchased and create a download
if (wp_attachment_is_image($attachment_id)) {
$this->download_image($product_id, $attachment_id, $size_id);
} else {
$this->download_file($file);
}
do_action('sell_media_after_successful_download', $product_id);
exit;
} else {
do_action('sell_media_before_failed_download', $product_id, $attachment_id);
wp_die(__('You do not have permission to download this file', 'sell_media'), __('Purchase Verification Failed', 'sell_media'));
}
exit;
}
// Rend purchase receipt?
if (isset($_GET['resend_email']) && isset($_GET['payment_id'])) {
$payment_id = $_GET['payment_id'];
$payment_email = get_meta_key($payment_id, 'email');
Sell_Media()->payments->email_receipt($payment_id, $payment_email);
}
}