最後更新: 2024-09-12
目錄
- 更新 resolv.conf
* php_admin_value is not valid in .htaccess files. It can only be used in httpd.conf
* Use php_value instead
Check Apache version in php
The Apache version is contained in the predefined variable:
<?php echo $_SERVER['SERVER_SOFTWARE']; ?>
P.S.
此方法可以用於 "FPM/FastCGI" 及 "Apache 2.0 Handler"
OR
Output
詳細程度由 httpd.conf 的 ServerTokens 決定
Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips
# apache_get_version() - 只適用於 "Apache 2.0 Handler"
<?php echo apache_get_version(); ?>
更新 resolv.conf
Code
<? $ch = curl_init("https://datahunter.org"); curl_setopt($ch, CURLOPT_FILE, $fp); curl_setopt($ch, CURLOPT_HEADER, 0); curl_exec($ch); if(curl_error($ch)) { var_dump(curl_error($ch)); } else { echo("Test Ok"); } curl_close($ch); ?>
* 使用內嵌的php(libphp5.so)時, 修改 /etc/resolv.conf 後必須 restart Apache, 否則 php call 唔到出去.