/home » workblog

Troubleshooting IIS 400.x Access Denied Errors

David Wang writes about troubleshooting 400.x “Access Denied” errors in IIS. The first step is to pull the substatus code out of the logs, which will give you more information on what’s going wrong and narrow down the list of causes.

Alternatives to Select/Multiple

Ryan Cramer details some of the problems with select/multiple and a few good alternatives. It’s useful in certain circumstances, but unintuitive and error-prone. Instead, you can create a list of checkboxes inside an element with overflow:auto set, or use a jQuery plugin he developed.

Automated FTP Uploads/Downloads

ISINC has a writeup on how to pass a batch file of commands to Window’s command line FTP client. You can then create a Scheduled Task to automate them.

CSS Selector Browser Compatbility

kimblim.dk has a chart showing browser support for various CSS selectors, including pseudo selectors. It includes CSS versions 1 through 3 and all of the major browser versions.

PHP Error Logs with Virtuozzo

Virtuozzo sets domains up to have PHP’s display_errors flag turned off by default, so that you’ll only see a blank page when there are critical errors. This is a good thing in production environments because it avoids potential security issues, but it can also be annoying when you’re trying to debug something.

Instead of displaying the errors, you can configure PHP to log them and then use the logs for debugging. For a Linux environment, you’ll need to create a file named vhost.conf inside the domain’s conf directory, /var/www/vhosts/domain.name/conf.


<Directory /var/www/vhosts/domain.name>
php_value error_log /var/www/vhosts/domain.name/statistics/logs/php-errors.log
php_flag display_errors off
php_value error_reporting 6143
php_flag log_errors on
</Directory>

Then create the file and assign it the right permissions


cd /var/www/vhosts/domain.name/statistics/logs/
touch php-errors.log
chown apache php-errors.log

And the last thing is to tell Apache to reread the updated conf file


/usr/local/psa/admin/sbin/websrvmng -a

Troubleshooting htaccess

If you’re troubleshooting an htaccess file and aren’t seeing any changes, no matter what you put in the file, make sure that you have permissions to execute the directives you’re using. Check Apache’s conf file to see if AllowOverride None is set for your site or directory. If it is, add the directives that you want to use, or just set AllowOverride All. You’ll need to restart the Apache service after changing the conf file. If it still isn’t working, try checking Apache’s error log.

Making Coding Mistakes Obvious

Joel Spolsky wrote an interesting article on ways to make coding mistakes obvious, like using semantic prefixes on variable names. If you have unfiltered data from the user, you can make the variable something like $usFoo so that you always remember that the data is unsafe, and won’t output it unfiltered (therefore preventing malicious code injection).

Firewalling an OpenVZ node and containers

The OpenVZ wiki has a nice script for firewalling an OpenVZ node and it’s containers. It creates a service and configures iptables to block all traffic to the node (except the ports you specify), but allow all traffic through to the containers, so that they can manage their own firewall. It also allows the container’s firewalls to be managed on the node through a simple config file.

Content Above Anchors Disappear

It turns out there’s a serous problem with the One True Layout method of creating equal height columns. All of the content above an anchor will be shifted up, making it seem like it disappeared. There aren’t any universal or reliable fixes for this, so the Faux Columns method is probably the best choice if it’ll fit the design.

Working with Qmail’s Queue

qmqtool is a great tool for viewing and changing messages in qmail’s queue. It’ll help you search for and delete spam, for instance. The FAQ has a some examples to get started with.