I have read several articles on how to enable CGI use on my IIS8 server. I have configured ISAPI and CGI Restrictions to allow unspecified CGI modules and set the CGI to execute permissions. When I try to invoke the program through the website it just hangs there loading and never does anything.
Probably you have forgotten to add the couple of %s at the end of CGI executable:
perl.exe "%s" %s
Related
I have developed and maintain a web application which acts as a front end for some scrips in cgi-bin which in turn call C programs on the server. The web server is Apache2, hosted both on my office Linux box for testing and on Amazon ECC for the real deployment.
My problem is that I'm off travelling, mostly without any internet connection and with only a small portable linux machine, yet I want to develop the next release of the web pages, scripts, data sets and programs. Testing static web pages is no issue but testing pages which call server-side cgi-bin scripts is always problematic, so my idea is to put a minimal http server on the portable linux box (ubuntu 14.04) which will allow the server and client to be on the same machine without any internet (and maybe with just a socket) in-between.
Of course I can and do test scripts and programs directly, but this does not exercise features such as handling top-bit set characters in $POST_DATA or setting and retrieving cookies so would inevitably result in some divergence of code-base.
So:
Is this way sensible or is there a better or simpler means to do what I want?
If it is sensible, what hppt server would you recommend? I thought of miniWeb but have no experience of it.
PS: I'm expert in the the (maths of the) server-side programs but have much less experience as an apache sysadmin.
For many things this is sufficient:
python3 -mhttp.server --cgi
Unfortunately, it's so minimal, that it doesn't support stuff like setting the HTTP Status: https://bugs.python.org/issue10487
I'm not using lighttpd because I don't want to have to write a configuration file. Another minimal server that can be used is mini-httpd:
sudo apt install mini-httpd
/usr/sbin/mini_httpd -D -p 8000 -c 'cgi-bin/*'
The -D option keeps the server in the foreground instead of daemonizing it. The -p option is the port and -c is a pattern for my cgi scripts.
I also found that the built-in webserver of busybox can handle cgi scripts just fine:
busybox httpd -p 8000 -f
I am currently writing an admin page for my webserver, to make it easier on myself to create new apache domains from my browser. Everything is pretty much working as I want it to, except for one thing.
To elaborate: I have a cron job on my server running a bash script as root that checks a file containing a list of domain names that I want to be created. If the file contains a domain name, it automatically creates a new virtual host for this domain, edits my hosts file, and restarts the server. This all works perfectly, however what I would like for the script to do, is that it activates the domain that it automatically creates before it restarts the server. I tried doing this using apache 2's a2ensite command, however the script returns an error saying the command is not found.
Is there a way to call this command from a bash script, or is there an alternative to this command that I can call?
Any help would be greatly appreciated.
$ which a2ensite
/usr/sbin/a2ensite
Usually, cron has a quite restrictive $PATH, not including /usr/sbin or /sbin, which are system binaries (for use by root). It's always a good idea to use fully qualified path names. So either call /usr/bin/a2ensite in your script, or define a variable:
A2ENSITE=/usr/sbin/a2ensite
...
${A2ENSITE} new-domain.com
I'm running XDebug on Linux CentOS. I want to profile pages on a web app built with CodeIgniter, served by Apache.
XDebug is enabled in php.ini with the following settings:
zend_extension=/usr/lib64/php/modules/xdebug.so
xdebug.profiler_enable = 1
xdebug.profiler_output_dir = /tmp/xdebug
Everything works fine when I trigger php scripts from the command line, and XDebug profile logs are written to /tmp/xdebug, as expected. When I load a url from the web app through the browser, XDebug does not create any profile log files.
Has anyone gotten XDebug to work with Codeigniter? From what I can tell, I should not have to trigger XDebug profiling via GET in the url because profiler_enable is turned on for all php scripts, although I've tried this and it doesn't seem to work either.
Apache needed to have write permissions on the /tmp/xdebug folder.
sudo chown -R apache:apache /tmp/xdebug
XDebug can profile Codeigniter page loads from a browser now.
Thanks #J. Bruni.
It seems to me that the issue is not related to CodeIgniter... It seems you may have multiple php.ini files...
In my Ubuntu installation, I have several sub-directories inside /etc/php5 directory: cgi, cli, fpm, etc. Each one of these has a php.ini file inside it, which is specific to a single "mode".
In other words: PHP may have several different php.ini files... one for CLI (command-line), other for CGI, and so on...
Maybe the xdebug configuration lines you pasted above are not in the php.ini file used when you access PHP scripts from the browser. Maybe you added these lines to /etc/php5/cli/php.ini instead of /etc/php5/cgi/php.ini (or another... in my setup, it is /etc/php5/fpm/php.ini, because I use php-fpm)
I need to contact a server (perhaps Apache) running on a Linux box and have it return the following results. I am new to networking, but can write code in Java, PHP and maybe a little C.
I need to remotely run diagnostic tests from the Linux box on the local area network. Ultimately these tests need to be delivered to a web page on the client side.
I am not sure where to begin on this project and appreciate any suggestions or general strategies. I am familiar with a command written in Java (i.e., Runtime.getRuntime().exec("ping -c 1 " + ip); ), but I don't know if it is necessary to involve Java and I don't know how to startup a Java program on a server and return it to a PHP file. Is it possible to do this without involving Java? Again any specific or high- level suggestions are appreciated.
Perhaps you are looking for the exec function in PHP?
You can use exec function
-for ping:
//ping.php
<?php
exec ("/bin/ping -c 5 www.google.com", $response);
echo "<pre>" . join("\r\n", $response)."</pre>";
?>
use the php command-line in terminal
$ php ping.php
Is there an open source Node.JS webserver available yet that has CGI support?
There is a node-cgi module (found through npm registry) which looks to be actively maintained.
If you are looking for a CGI module to run node.js under webservers like Apache or IIS then cgi-node will allow you to do just that.
Apache example: you can add a .htaccess file within your web folder to point all *.jscirpt files to be executed using Node.js through the cgi-node module. Something like this:
Action cgi-node /cgi-bin/cgi-node.js
AddHandler cgi-node .jscript
Also including the cgi-node.js script found on the cgi-node.org website within the cgi-bin folder.
CGI-Node allows Node.js to behaves exactly like PHP when running under a webserver.
Documentations and tutorials available on the site: cgi-node.org