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
Related
Is possible use htaccess on golang application running in heroku??
I had read this link but the solution doesn't work for me (also, the command htpasswd is not recognized in the heroku bash, but I made the htpasswd file usin this tool).
Thank you.
A Go web application is a server so no need to use Apache httpd server, especially on Heroku that has crystal clear deployment instructions for Go :
https://devcenter.heroku.com/categories/go
Follow these instruction closely and you'll find out there is no need for Apache.
htaccess and htpasswd are related to Apache httpd server, they are Apache configuration files.
Finally, Go standard library gives you all the tools you need to implement basic auth yourself :
https://golang.org/pkg/net/http/#Request.BasicAuth
Background: My PHP projects (CakePHP, Wordpress) run on an Ubuntu server in my network, I access them through a development TLD (.dev for example) setup through a local DNS server and I edit the files through a Samba share.
I would like to utilize Livereload for my development, preferably have it running on the server itself. I have basic Node/Gulp knowledge, but haven't been able to get this running.
Livereload (or a middleware server) should proxy the 'real' URLs, making sure all websites run as they would normally and Livereload should be available over the network (so not just localhost, because that runs on the development server)
Desired result:
Livereload runs on my dev server (IP: 10.0.0.1), my project is called helloworld.dev, I browse to 10.0.0.1:3000 on my machine and see helloworld.dev proxied through Livereload. I now edit a CSS file over the Samba share and the CSS is reloaded without a refresh.
I've tried using a few NPM packages, gulp-livereload, livereload, node-livereload, with their provided examples that come with the packages, but haven't been able to get the desired result. They all expect you to run in locally, don't support access to the Livereload URL over the network, cannot proxy the 'real' URLs or require static content.
Can anyone provide an example or 'proof of concept' code of my wish, so I can see where to start?
I found the answer: http://nitoyon.github.io/livereloadx/
This does EXACTLY what I need.
I can run
livereloadx -y http://helloworld.dev -l
open
http://serverip:35729
and I'm ready to roll.
The -y option creates the proxy to the 'real' URL and the -l makes it serve files from local filesystem instead of through its proxy.
I'm trying to setup an LAMP environment with NixOs.
I managed to have mysql and apache running, but I can't find a way
to enable php.
At the moment, apache is serving php file as text instead of executing it.
I've seen there is a enablePHP option in the appache-httpd/default.nix file but it doesn't seem visible (it doesn't appear when I do man configuration.nix and I get an error message if I try to set it to true).
Most likely the version of nixpkgs used to build your system (and the configuration.nix man page) is older than the version of nixpkgs you are looking at. After an update of your system the option should be documented in the configuration.nix man page and work as expected.
I successfully use enablePHP and enableUserDir to render php files in my user's public_html. An .htaccess file with DirectoryIndex index.php further enables php index files.
I'm also in the process of setting up a php stack (using nginx / php-fpm) and I found the following, which might answer your question.
Use the extraModules parameter of the httpd config to enable the php module, like so:
extraModules = [
{ name = "php5"; path = "${pkgs.php}/modules/libphp5.so"; }
];
I found this example here: https://github.com/svanderburg/disnix-stafftracker-php-example/blob/master/deployment/configurations/test-vm1-httpd.nix
PHP GD Extension is loaded and working on local server but it is not loaded correctly on our live server even though I am using all the exact same files.
(PHP GD is working fine here)
Local Server: Microsoft Windows Server 2003 For Small Business Server SP2
IIS Version: 6
Then I copied the whole "C:\PHP" folder from local server to "C:\Program Files (x86)\" on live server. That "PHP" folder does include ext folder and "php_gd2.dll" file inside it. I changed the path from "C:\PHP" to "C:\Program Files (x86)\" in "php.ini" too. However, PHP is not loaded on live server.
PHPINFO Local:http://jsfiddle.net/hFKfx/
PHPINFO Live: http://jsfiddle.net/h77Hy/
I am not very good with PHP. Please help.
In Win2K3 / IIS6, you're running PHP as a ISAPI module (thread-safe).
In Win 7 / IIS7.5, you're running PHP as a FCGI module (non-thread-safe).
This is likely your problem. You can't mix and match thread-safe (TS) / non-thread-safe (NTS) extensions with core PHP. If you just copied everything over, you probably have TS extensions. You need to download and use the NTS ones.
(archive link to PHP 5.2.6 NTS)
To verify this assumption, check where php.ini specifies a log for startup errors. If you're logging startup errors, you should see something similar to:
PHP Warning: PHP Startup: gd Extension: Unable to initialize module
Module compiled with build ID=API20041225,TS,VC6
PHP compiled with build ID=API20041225,NTS,VC6
These options need to match
(note "TS" vs "NTS")
Hope that helps. If not, maybe you'll find something else in the log that indicates what the problem is.
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)