问题描述
1。问题:
我已安装Apache(有关更多详细信息,请参阅引用的phpinfo输出),我试图用Hello Word演示C ++脚本例。这主要是一个设置问题。
一旦安装了64位Apache,还需要做些什么来使C ++脚本工作?这是在php框架中完成的吗?
- 例如,一个小程序可以创建为一个cgi脚本,它只运行编译器并运行生成的输出作为各种翻译。
- 但是使用PHP,可以加载.dll;为什么不用C ++呢?
我喜欢C ++,因为它可以组织代码;
-我更喜欢层次结构;它似乎更灵活
- 此外,它更容易在纸质文档和C ++代码之间进行转换
2。探索
-I试图找到对该问题的引用;我记得之前阅读材料似乎表明它可能是直接的。
- 从GCI开始,似乎可以将程序编译为可以直接加载到Apache的模块
3。分析
-我找不到像PHP一样工作的C ++解释器的直接方法;然而,编译和运行的间接方法可能是可行的。
-解决方法是用C ++构建CGI接口并编译然后运行它。
4。隔离
-我正在尝试查看Cygwin是否可以使用其语言包:
[]
以及
[]
,最重要的是C ++ CGI简介:
[]
请参阅参考资料以获取更多详细信息(以及其他可能的相关信息)。
4。决议
暂无分辨率;有可用的C ++解释器吗?或者软件是否需要再次用C ++编写(我想从Windows使用Cygwin编译器来获取给定代码,保存它,然后编译并运行它,或者在Windows或其他操作系统下运行等效代码。)
6.1参考资料 - 尝试研究解决问题
1. Issue:
I have installed Apache (see the referenced phpinfo output for more details) and I am trying to demonstrate C++ scripting with a "Hello Word" example. This is mostly a setup issue.
Once 64-bit Apache is installed, what else needs to be done to get C++ scripting to work? Is that done in the php framework?
-A small program for instance could be created as a cgi script that would just run the compiler and run the output generated as an interpreter of sorts.
-But with PHP, it is possible to just load the .dll; why not also with C++?
I like C++ because of the way that it is possible to organize the code;
-I like the hierarchical structure better; it seems more flexible
-Also, it is easier to translate between paper documents and C++ code
2. Probing
-I tried to find references to the issue; I remember reading material before that seemed to suggest that it might be possible directly.
-From GCI, it seems that it is possible to compile the programs as modules that can load into Apache directly
3. Analysis
-I am not finding the direct approach for a C++ interpreter that would work like PHP; however the indirect approach of compile and run might be possible
-The workaround would be to build the CGI interface in C++ and compile it and then run it.
4. Isolation
-I am trying to see if Cygwin would work with its language package following:
Cygwin - Part Two - Installing GCC[1]
and also following
Cygwin - Part Three - Testing the GCC C++ Compiler[2]
and most importantly "Introduction to C++ CGI":
Introduction to C++ CGI | Guy Rutenberg[4]
See the references for more detail (and additional perhaps related information).
4. Resolution
No resolution yet; Is there a C++ interpreter available? Or does the software need to be written in C++ again (I guess to use the Cygwin compiler from windows to take a given code, save it, and then compile it and run it, or the equivalent under Windows or other operating systems.)
6.1 References - attempted research to resolve the issue
40. http://localhost/wordpress/wp-admin/setup-config.php
http://localhost/wordpress/wp-admin/setup-config.php
41. phpinfo()
http://localhost/test.php
42. test.php -Google
43. PHP: Your first PHP-enabled page - Manual
http://php.net/manual/en/tutorial.firstpage.php
47. 2016-02-03T10:46:34+00:00-phpinfo().pdf
http://www.gonorthwork.com/view/2016-02-03T10:46:34+00:00-phpinfo().pdf
48. c++ scripting with php -Google
49. execute c++ program with php script - Stack Overflow
http://stackoverflow.com/questions/4279003/execute-c-program-with-php-script
50. Run C++ script in PHP - Stack Overflow
http://stackoverflow.com/questions/11789095/run-c-script-in-php
51. Calling a PHP script from a C++ Program - Stack Overflow
http://stackoverflow.com/questions/9470448/calling-a-php-script-from-a-c-program
52. interpreted c++ running under php - Google
https://www.google.co.il/search?q=interpreted+c%2B%2B+running+under+php&ie=utf-8&oe=utf-8&gws_rd=cr&ei=3t6xVpydD4PcUe2drjg
53. c++ to php compiler - Google
54. c++ to php compiler - Google
55. Compile and Execute C++ Online
http://www.tutorialspoint.com/compile_cpp11_online.php
56. writing a script interpreting module for Apache -Google
57. Apache Tutorial: Dynamic Content with CGI - Apache HTTP Server Version 2.2
https://httpd.apache.org/docs/2.2/howto/cgi.html
58. Writing Apache Modules with Perl and C: The Apache API and Mod_perl - Lincoln Stein, Doug MacEachern - Google ספרים
https://books.google.co.il/books?id=qyzTI_eAeHUC&pg=PA5&lpg=PA5&dq=writing+a+script+interpreting+module+for+Apache&source=bl&ots=16jFAAjtSd&sig=ePrYEm6tT2Pe9UNxh_ixGX9wkP4&hl=iw&sa=X&ved=0ahUKEwimna22utvKAhVDJQ8KHdR7CioQ6AEIPTAD#v=onepage&q=writing%20a%20script%20interpreting%20module%20for%20Apache&f=false
59. CgiScripts - Python Wiki
https://wiki.python.org/moin/CgiScripts
60. CGI -Google
https://www.google.co.il/search?q=CGI&ie=utf-8&oe=utf-8&gws_rd=cr&ei=PuCxVtWcFsG4ygOHxrSgCA
61. Apache Tutorial: Dynamic Content with CGI - Apache HTTP Server Version 2.2
https://httpd.apache.org/docs/2.2/howto/cgi.html
62. Writing CGI programs for Windows 7.1 -Google
63. CGI Programming With Apache and Perl on Windows XP
http://www.cgi101.com/book/connect/winxp.html
64. writing a c++ windows cgi program for apache -Google
65. The Megalomaniac Bore: C++ based CGI with Apache on Win32 & Linux
http://megalomaniacbore.blogspot.co.il/2011/07/c-based-cgi-with-apache-on-win32-linux.html
66. How to config apache for C++ CGI scripts? - Stack Overflow
http://stackoverflow.com/questions/9753689/how-to-config-apache-for-c-cgi-scripts
67. A Short Guide to writing server-side CGI programs in C++ - Wikiid
http://www.sjbaker.org/wiki/index.php?title=A_Short_Guide_to_writing_server-side_CGI_programs_in_C%2B%2B
68. C++ Web Programming
http://www.tutorialspoint.com/cplusplus/cpp_web_programming.htm
69. HOW-TO Write a CGI Program in C/C++
http://www.purplepixie.org/cgi/howto.php
70. Introduction to C++ CGI | Guy Rutenberg
https://www.guyrutenberg.com/2007/08/10/introduction-to-c-cgi/
71. Code::Blocks download | SourceForge.net
http://sourceforge.net/projects/codeblocks/?source=typ_redirect
72. c++ compiler for code blocks -Google
73. Installing a supported compiler - CodeBlocks
http://wiki.codeblocks.org/index.php/Installing_a_supported_compiler#Microsoft_Visual_C.2B.2B
74. Borlad C++ - חיפוש ב-Google
https://www.google.co.il/search?q=Borlad+C%2B%2B&ie=utf-8&oe=utf-8&gws_rd=cr&ei=d-SxVqbMOIXVO8aYgrgO
75. Download Borland C++ Compiler For Free - The Crazy Programmer
http://www.thecrazyprogrammer.com/2015/01/download-borland-c-compiler-for-free.html
76. GCC Compiler: Download Code::Blocks 12.11 a Free C/C++ IDE - The Crazy Programmer
http://www.thecrazyprogrammer.com/2013/06/gcc-compiler-download-codeblocks-1211.html
77. download GCC for windows -Google
78. Mingw-w64 - GCC for Windows 64 & 32 bits [mingw-w64]
http://mingw-w64.org/doku.php
79. Win-builds [mingw-w64]
http://mingw-w64.org/doku.php/download/win-builds
80. Intel C/C++ Compiler for Wndows 7 - חיפוש ב-Google
https://www.google.co.il/search?q=Intel+C/C%2B%2B+Compiler+for+Wndows+7&ie=utf-8&oe=utf-8&gws_rd=cr&ei=e-WxVuvmN8fcO9eBjYAE
81. Installing a supported compiler - CodeBlocks
http://wiki.codeblocks.org/index.php/Installing_a_supported_compiler
82. Cygwin
http://www.cygwin.org/
84. Intel C++ compiler in windows 7 64 bits
https://software.intel.com/en-us/forums/intel-c-compiler/topic/279145
85. Intel C++ Compiler 11.1.067 (free) - Download latest version in English on phpnuke
https://2ra5-downloads.phpnuke.org/en/c62877/intel-c-compiler
87. how to use cygwin C++ compiler -Google
88. Cygwin - Part Three - Testing the GCC C++ Compiler
http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_c**k/cygwin/part3/
90. Cygwin - Part Two - Installing GCC
http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_c**k/cygwin/part2/
91. libusb-win32 download | SourceForge.net
http://sourceforge.net/projects/libusb-win32/?source=typ_redirect
6.2参考文献第2部分:
6.2 References part 2:
From Send Tab URLs (31 links)
1. How can I demonstrate C++ scripting via the web with Apache and Windows 7.1 64-bit? - CodeProject
http://www.codeproject.com/Questions/1076387/How-can-I-demonstrate-Cplusplus-scripting-via-the
2. Cygwin - Part Three - Testing the GCC C++ Compiler
http://www2.warwick.ac.uk/fac/sci/moac/people/students/peter_c**k/cygwin/part3/
3. Introduction to C++ CGI | Guy Rutenberg
https://www.guyrutenberg.com/2007/08/10/introduction-to-c-cgi/
4. Introduction to C++ CGI – Processing Forms | Guy Rutenberg
http://www.guyrutenberg.com/2007/09/07/introduction-to-c-cgi-processing-forms/
5. Introduction to C++ CGI | Guy Rutenberg
http://www.guyrutenberg.com/2007/08/10/introduction-to-c-cgi/
6. 404 Not Found
http://localhost/helloworld.cpp
7. c++ CGI - חיפוש ב-Google
https://www.google.co.il/search?q=c%2B%2B+CGI&ie=utf-8&oe=utf-8&gws_rd=cr&ei=sAWyVoqLGMSYsAH4qpK4Aw
8. C++ Web Programming
http://www.tutorialspoint.com/cplusplus/cpp_web_programming.htm
9. 500 Internal Server Error
http://localhost/cgi-bin/cplusplus.cgi
10. Hello World - First CGI Program
http://www.tutorialspoint.com/cgi-bin/cplusplus.cgi
11. Index of ftp://ftp.gnu.org/gnu/cgicc/
ftp://ftp.gnu.org/gnu/cgicc/
12. ftp://ftp.gnu.org/gnu/cgicc/README
ftp://ftp.gnu.org/gnu/cgicc/README
13. 404 Not Found
http://localhost/cplusplus
14. apache server log - חיפוש ב-Google
https://www.google.co.il/search?q=apache+server+log&ie=utf-8&oe=utf-8&gws_rd=cr&ei=wAyyVsT_CMXAOZ69hrAL
15. Log Files - Apache HTTP Server
https://httpd.apache.org/docs/1.3/logs.html
16. apache error End of script output before headers - חיפוש ב-Google
https://www.google.co.il/search?q=apache+error+End+of+script+output+before+headers&ie=utf-8&oe=utf-8&gws_rd=cr&ei=KA2yVpPgN8OSPqqxssAM
17. perl - "End of script output before headers" error in Apache - Stack Overflow
http://stackoverflow.com/questions/22307610/end-of-script-output-before-headers-error-in-apache
18. 500 Internal Server Error
http://localhost/cgi-bin/printenv.pl
19. .pl #! cgi path to perl windows - חיפוש ב-Google
https://www.google.co.il/search?q=cgi+path+to+perl&ie=utf-8&oe=utf-8&gws_rd=cr&ei=8Q2yVoPyO8LCPO2rl-AC#q=.pl+%23!+cgi+path+to+perl+windows
20. Configuring the Apache Web Server to Run Perl Programs on Windows
http://editrocket.com/articles/perl_apache_windows.html
21. Setting up Perl/CGI with Windows
http://www.perlmonks.org/?node_id=44536
22. How to install Perl on Windows | ricocheting.com
http://www.ricocheting.com/how-to-install-on-windows/perl
23. How can I set Perl's inclusion path for modules for a CGI script? - Stack Overflow
http://stackoverflow.com/questions/355267/how-can-i-set-perls-inclusion-path-for-modules-for-a-cgi-script
24. how to restart the apache server httpd - חיפוש ב-Google
https://www.google.co.il/search?q=how+to+restart+the+apache+server+httpd&ie=utf-8&oe=utf-8&gws_rd=cr&ei=2xCyVoWlGoaAPK6tkdAP
25. Start / Stop and Restart Apache 2 Web Server Command
http://www.cyberciti.biz/faq/star-stop-restart-apache2-webserver/
26. Problem loading page
http://localhost/
27. perl for windows 7 64 bit apache - חיפוש ב-Google
https://www.google.co.il/search?q=perl+for+windows+7+64+bit+apache&ie=utf-8&oe=utf-8&gws_rd=cr&ei=TxKyVvnYCYOAU5LotdgP#q=perl+for+windows+7+64+bit+apache&start=10
28. How to install Perl on Windows | ricocheting.com
http://www.ricocheting.com/how-to-install-on-windows/perl
29. Thank you for downloading ActivePerl | ActiveState Software
http://www.activestate.com/activeperl/downloads/thank-you?dl=http://downloads.activestate.com/ActivePerl/releases/5.22.1.2201/ActivePerl-5.22.1.2201-MSWin32-x64-299574.msi
30. CGI #!/path/to/perl windows example - חיפוש ב-Google
https://www.google.co.il/search?q=%23!/path/to/perl+example&ie=utf-8&oe=utf-8&gws_rd=cr&ei=sxOyVpWIMozSUZmmhNgJ#q=CGI+%23!%2Fpath%2Fto%2Fperl+windows+example
31. apache - How to run perl files over xampp in windows? - Stack Overflow
http://stackoverflow.com/questions/7860380/how-to-run-perl-files-over-xampp-in-windows
6.3参考文献第3部分
6.3 References Part 3
5. c++ cgi scripting - Google Search
6. cgicc: A Tutorial Example
http://www.gnu.org/software/cgicc/doc/cgicc_tutorial.html
7. cgicc:
http://www.gnu.org/software/cgicc/doc/index.html
8. cgicc for windows 7 - Google Search
9. gnu cgi (cgicc) does not compile with gcc on Windows using MinGW/Cygwin - Stack Overflow
http://stackoverflow.com/questions/4866451/gnu-cgi-cgicc-does-not-compile-with-gcc-on-windows-using-mingw-cygwin
10. Cgicc - Free Software Directory
https://directory.fsf.org/wiki/Cgicc
更新#1:
我找到一个示例文件printenv.pl并在检查Apache的错误日志后稍微修改了(更改了标题) 。新代码是:
Update #1:
I found a sample file printenv.pl and I modified that slightly (changing the header), after checking the error logs for Apache. The new code is:
#!C:/Perl64/bin/perl.exe
# To permit this cgi, replace # on the first line above with the
# appropriate #!/path/to/perl shebang, and on Unix / Linux also
# set this script executable with chmod 755.
#
# ***** !!! WARNING !!! *****
# This script echoes the server environment variables and therefore
# leaks information - so NEVER use it in a live server environment!
# It is provided only for testing purpose.
# Also note that it is subject to cross site scripting attacks on
# MS IE and any other browser which fails to honor RFC2616.
##
## printenv -- demo CGI program which just prints its environment
##
use strict;
se warnings;
print "Content-type: text/plain; charset=iso-8859-1\n\n";
foreach my $var (sort(keys(%ENV))) {
my $val = $ENV{$var};
$val =~ s|\n|\\n|g;
$val =~ s|"|\\"|g;
print "${var}=\"${val}\"\n";
}
推荐答案
这篇关于如何使用apache和Windows 7.1 64位通过Web演示c ++脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!