简体   繁体   中英

PHP execution (command line vs web) of apache_get_version()

I'm calling the apache_get_version() function in my php script. When I execute the script via web url everything works fine. I got the output I expected.

When calling the script from command line ("php index.php") I recieve an error

PHP Fatal error:  Call to undefined function apache_get_version()

Does anyone know why this happens? The version is always PHP 5.5.12 and it seems as it has nothing to do with privileges since I execute the script as root from the command line.

Thanks in advance!

I execute the script as root from the command line

The apache_get_version function is only available when the script is run through Apache.

You can see the manual page listed under server specific extensions and the introduction page for that section says:

These functions are only available when running PHP as an Apache module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM