Useful Snippets


This blog is used to collect useful snippets related to Linux, PHP, MySQL and more. Feel free to post comments with improvements or questions!

Are your smart devices spying on you? Make better purchasing choices and find products that respect your privacy at

RSS Latest posts from my personal blog

Most viewed posts

Subscribe to RSS feed

Best Apache VirtualHost configuration for PHP projects

Stanislav KhromovStanislav Khromov

Here is an example of an Apache VirtualHost config that provides your site with security through open_basedir and writes both a regular access log, as well as a PHP error log.

<VirtualHost *:80>

DocumentRoot    /var/www/html/

php_admin_value open_basedir /var/www/html/

CustomLog       /var/log/httpd/ common
ErrorLog        /var/log/httpd/

In order for open_basedir to work with file uploads, you need to add the following to your php.ini configuration file:

upload_tmp_dir = /tmp

I’m always looking to improve this configuration – send me a comment if you have a better version!

Web Developer at Aftonbladet (Schibsted Media Group)
Any opinions on this blog are my own and do not reflect the views of my employer.
Twitter Profile
Visit my other blog

Comments 1