如何配置apache执行cgi
我对 LAMP 很陌生,我已经测试了 php 是否在 apache 服务器上运行,创建了一个文件testing.php,而不是显示 php 版本和其他内容,它只是显示与我输入的内容完全相同的内容:
<?php phpinfo(); ?>
我尝试使用 python 脚本并且也只是显示我输入的内容:
#!usr/bin/python
print ("Content-type:text/html\r\n\r\n")
print ("<html>")
print ("<head>)"
print ("<title>Hello world!</title>")
print ("</head>")
print ("<body>")
print ("<h2>Hello world!</h2>")
print ("</body>")
print ("</html>")
我应该如何配置 apache 来执行 cgi?
I'm very new to LAMP and I've tested if php is running on apache server creating a file testing.php and instead of showing php version and stuff it just show exactly the same thing I typed:
<?php phpinfo(); ?>
I tried to use python script and also just show the exactly what I typed:
#!usr/bin/python
print ("Content-type:text/html\r\n\r\n")
print ("<html>")
print ("<head>)"
print ("<title>Hello world!</title>")
print ("</head>")
print ("<body>")
print ("<h2>Hello world!</h2>")
print ("</body>")
print ("</html>")
How should I configure apache to execute cgi?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否使用过 a2enmod 来启用 PHP?
您需要执行以下操作:
sudo a2enmod php7.4
sudo systemctl restart apache2
Have you used a2enmod to enable PHP?
You'll need to do something like:
sudo a2enmod php7.4
sudo systemctl restart apache2