PHP $_SERVER[‘HTTP_HOST’] vs. $_SERVER[‘SERVER_NAME’], am I understanding the man pages correctly?

That’s probably everyone’s first thought. But it’s a little bit more difficult. See Chris Shiflett’s article SERVER_NAME Versus HTTP_HOST. It seems that there is no silver bullet. Only when you force Apache to use the canonical name you will always get the right server name with SERVER_NAME. So you either go with that or you … Read more

Accessing localhost (xampp) from another computer over LAN network – how to?

Localhost is just a name given for the loopback, eg its like referring to yourself as “me” .. To view it from other computers, chances are you need only do http://192.168.1.56 or http://myPcsName if that doesnt work, there is a chance that there is a firewall running on your computer, or the httpd.conf is only … Read more

How to Set AllowOverride all

In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf (here we have an example of /var/www): <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> and change it to; <Directory /var/www/> Options Indexes FollowSymLinks AllowOverride All Require all granted </Directory> then, sudo service apache2 restart You may need to also do sudo … Read more

How to debug Apache mod_rewrite

One trick is to turn on the rewrite log. To turn it on, try this line in your Apache HTTP Server main configuration or current virtual host file (not in .htaccess): LogLevel alert rewrite:trace6 Before Apache httpd 2.4 mod_rewrite, such a per-module logging configuration did not exist yet. Instead you could use the following logging … Read more

XAMPP – Port 80 in use by “Unable to open process” with PID 4! 12

Open a CMD prompt as administrator and execute the following command: net stop was /y Open the Run dialog box (press Win+R), then type: services.msc Then search for World Wide Web Publishing Service (WWW-Publishing Service) and Web Deployment Agent Service and stop them. You should also disable them. Start Apache again with XAMPP 🙂 Link … Read more

Why use deflate instead of gzip for text files served by Apache?

Why use deflate instead of gzip for text files served by Apache? The simple answer is don’t. RFC 2616 defines deflate as: deflate The “zlib” format defined in RFC 1950 in combination with the “deflate” compression mechanism described in RFC 1951 The zlib format is defined in RFC 1950 as : 0 1 +—+—+ |CMF|FLG| … Read more

apache redirect from non www to www

Using the rewrite engine is a pretty heavyweight way to solve this problem. Here is a simpler solution: <VirtualHost *:80> ServerName example.com Redirect permanent / http://www.example.com/ </VirtualHost> <VirtualHost *:80> ServerName www.example.com # real server configuration </VirtualHost> And then you’ll have another <VirtualHost> section with ServerName www.example.com for your real server configuration. Apache automatically preserves anything … Read more

ab load testing

The apache benchmark tool is very basic, and while it will give you a solid idea of some performance, it is a bad idea to only depend on it if you plan to have your site exposed to serious stress in production. Having said that, here’s the most common and simplest parameters: -c: (“Concurrency”). Indicates … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)