Home  >  Article  >  Backend Development  >  How to obtain server operating system related information in php

How to obtain server operating system related information in php

高洛峰
高洛峰Original
2016-12-20 16:24:071505browse

The example in this article describes how PHP obtains information related to the server operating system. Share it with everyone for your reference, the details are as follows:

The following is the basic statement for PHP to obtain the current server information.

PHP program version:

<?PHP echo PHP_VERSION; ?>

ZEND version:

<?PHP echo zend_version(); ?>

MYSQL support:

<?php echo function_exists (mysql_close)?"是":"否"; ?>

MySQL database continuous connection:

<?php
echo @get_cfg_var("mysql.allow_persistent")?"是 ":"否";
?>

Maximum number of MySQL connections:

<?php
echo @get_cfg_var("mysql.max_links")==-1 ? "不限" : @get_cfg_var("mysql.max_links");
?>

Server operating system:

<?PHP echo PHP_OS; ?>

Server information:

<?PHP echo $_SERVER [&#39;SERVER_SOFTWARE&#39;]; ?>

Maximum upload limit:

<?PHP
echo get_cfg_var ("upload_max_filesize")?get_cfg_var ("upload_max_filesize"):"不允许上传附件";
?>

Maximum execution time:

<?PHP echo get_cfg_var("max_execution_time")."秒 "; ?>

Maximum memory occupied by script running:

<?PHP
echo get_cfg_var ("memory_limit")?get_cfg_var("memory_limit"):"无"
?>

Query the version of the currently connected MYSQL database php comes with the function

mysql_get_server_info()

Get the service

date_default_timezone_set (PRC);
echo date("Y-m-d G:i:s");

The version of the MYSQL database php Bring your own The function mysql_get_server_info()

gets the server system time

date_default_timezone_set (PRC);
echo date("Y-m-d G:i:s");

I hope this article will be helpful to everyone in PHP programming.

For more articles on how PHP can obtain information about the server operating system, please pay attention to the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn