apache

PHP extension on a Mac

I wrote a PHP extension, and I'm trying to get it running on Mac's Apache server. It runs fine via the command line, for example: $ php -r 'dl("mylib.dylib"); I also tried building Apache from source, and it works perfectly when I run that (I set it up to use the same PHP as Mac's built-in Apache, too, so no difference there). How...

Is using a Web Server like Lighttpd and nginx in most cases just Premature Optimization?

I'm currently using Lighttpd on a VPS. Before that it was nginx, but I came back to Lighttpd because I needed CGI. Apache's HTTPD is mainstream. All documentations include examples for Apache and most modules are only available for Apache. Is the effort to use something different from Apache really worth it? ...

What is the best way with Apache to redirect a blank subdomain to another subdomain?

I want any request to http://example.com/* to be redirected to http://www.example.com/*. Where * is any arbitrary path. ...

How do I set the don't cache header for an html file using apache?

I'm doing a little bit of ajax where I get a static html file that is actually changed on the disk from time to time. Of course IE has a problem where it wants to help out by caching the file which I don't want. I know how to fix this when grabbing a dynamic file: you just change the header in the dynamic file. But how do I do this fo...

How do I configure apache2 to run Perl CGI scripts?

Hello, Im would like to configure apache2 running on Kubuntu to execute Perl CGI scripts. I've tried some steps I came across by googling, but nothing seems to work. Can someone please point me to the right way of achieving this? Thank You. ...

How can mod_perl and Passenger run on the same Apache server?

Is this even possible? I have a Rails app running on Passenger and a mod_perl site that need to run on the same server. I've tried setting up two VirtualHosts and I've tried just using one VH and an Alias/Location for the mod_perl. In both cases, Passenger tries to serve the mod_perl app and tells me it can't find the correct files. ...

Why would .htaccess fire twice in IE when downloading a protected XLS file?

Certain directories are protected by Basic Auth using a .htaccess file on an older Apache 1.x server. Today a user pointed out that the username/password was requested twice for the file he had just posted - once when entering the directory to see the index, and then AGAIN when downloading the file. Finding this odd, I researched the usu...

Cache Expire Control with Last Modification

In the Apache's mod_expires module, there is the Expires directive with two base time periods: access, and modification ExpiresByType text/html "access plus 30 days" understandably means, the cache will request for fresh content after 30 days. However, ExpiresByType text/html "modification plus 2 hours" doesn't make intuitive sense. ...

CodeIgniter Install Problem

Hi All, I'm having a problem getting CodeIgniter to work on my shared hosting account. The URL is http://test.tallgreentree.com. It's not giving me a .php error, but it is displaying a 404 page for everything I type into the address bar. Here's the beginning of my config.php file. <?php if ( ! defined('BASEPATH')) exit('No direct s...

Mod Rewrite: apply to all js and css files except ...

Hi I need to apply a minify actions to all the javascript and CSS files, except the ones I indicate. I have this condition and rule that applies to all the files (css and js): RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^(.*\.)(js|css)$ minify.php?q=$1$2 [L,NC] I need to add the conditions to say: Apply to all except: jquery.js,...

Is PHP allowed to modify .htaccess file in current folder?

I have a PHP web app located on shared hosting. My goal is to modify .htaccess file from PHP code when the PHP page is running. I need that .htaccess to insert a couple of mod_rewrite lines into it. The problem is that on Windows+Apache I can dinamically modify .htaccess file but the same code on Linux reports a problem when I try to ac...

Force https for entire server/domain

I am developing a number of forms which should only be accessed via https. I have a dedicated server with its own cert and all the good stuff. So my question is two-fold really: 1). What's the best way to force every request to be https? Is there a better way than this .htacess/mod_rewrite rule: RewriteCond %{HTTPS} off RewriteRule (....

Apache2 Reverse Proxy to an end-point that requires BasicAuth but want to hide this from user

Basically my scenario is that I have an internal website that requires a SINGLE hard-coded username and password to access (and this can't be turned off, only changed). I am exposing this website through a reverse proxy for various reasons (hiding the port, simplifying url, simplifying NAT, etc). However, what I would like to do is be ...

How to set up SVN with files that are in an /htdocs directory structure

I'm having a slight issue wrapping my head around on how to set up Subversion when working with php files. I store all my files at c:\www[nameOfProject]\htdocs and I setup virtual hosts for each project. (c:\www\project1\htdocs\index.php maps to http://localhost/project1/index.php). How do you guys handle using SVN? Lets say I have c:\...

Is there any api for getting the value of UseCanonicalName in Apache WebServer?

We need to check the value of UseCanonicalName in httpd.conf in Apache Webserver(any version) from an application using an api. I have googled for it and couldn't find any api related to it. Please help. TIA ...

Using ProxyPass for pages but not images

As a result of horrible, horrible errors, we've changed how we connect Apache to Tomcat. We were using mod_jk: JkMount /path ajp13 Now we're using mod_proxy_ajp: ProxyPass /path ajp://localhost:8009/path ProxyPassReverse /path ajp://localhost:8009/path However, there's a feature that JkMount offered but ProxyPass doesn't: the abili...

How to get Google like speeds with php?

I am using PHP with the Zend Framework and Database connects alone seem to take longer than the 0,02 seconds Google takes to do a query. The wierd thing today I watched a video that said Google connects to 1000 servers for a single query. With latency I would expect one server for every query to be more efficent than having multiple serv...

Apache2 isn't serving index.php

My server is fairly old (based on SuSE 9), and while I try to go through the pain of updating to the latest Apache2, PHP5 and MySQL, I ran into this problem with one of my hosted domains. The site has an index.php, and if I browse to their site example.org/index.php it displays fine. But if I navigate to http://example.org or http://ex...

Apache/PHP closes connection after short time (12 secs)

I am getting a peculiar problem. Apache closes connection after 12 seconds or so. This leads to a "connection reset by peer" message on the browser. I am on Linux Centos 5. Using apache2/php5.x/mod_gzip. (php with eAccelerator) I tested some variations: Usually, I will print all the HTML output as the last step. It always closes conn...

Sharing PHP-CGI between Apache and NGINX

Hi, I've been running most of my PHP apps on my website on a fastcgi backend, served by NGINX. I have a new application which seems pretty well integrated with Apache; it's heavily dependent on dynamically written .htaccess files, for example. I'm working on modifying it to work natively with NGINX, but that's not yet ready. In the mean...