Category Archives: Web Programming

How to use Apache as a proxy server

The following configuration allows you to make Apache forward the request for your domain to a second domain at port 8081. If the user enters “www.domain.com” in his browser he well see the content provided by the server listening at http://www.otherdomain.com:8081/. 


<VirtualHost *:80>
    ServerName www.testdomain.com
    ServerAlias testdomain.com *.testdomain.com
    ProxyRequests Off
    <Proxy *>
        Order deny,allow
        Allow from all
    </Proxy>
 
    ProxyPass / http://www.testdomain.com:8081/
    ProxyPassReverse / http://www.testdomain.com:8081/
    <Location />
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>


PHP Multi File Uploader with Progress Bar using APC

Important Update: If you are using PHP versions greater 5.3 you should use our new multi-file uploader script which does not depend on the APC cache. You find it here:

https://mydailyhacks.wordpress.com/2014/11/05/php-multifile-uploader-for-php-5-4-5-5/

For older PHP versions just continue reading.

This little PHP Script allows you to upload multiple files at a time to a webserver. It is pretty easy to install and can easily be adapted and extended to your specific needs. The Ajax progress bar the script brings is based on jQuery. For a proper operation of the script the Alternative PHP Cache (APC) has to be activated.

Where to get the script?

How to install APC on a linux server?

In Fedora Linux you need the following packages to install APC using the pecl command afterwards.


yum install pcre-devel  php-pear php-devel httpd-devel

pecl install apc

The file /etc/php.ini should contain the following lines:


extension=apc.so
apc.enabled = 1
apc.max_file_size = 2000M
apc.rfc1867 = 1

An introduction how to install it from the source code you find here.
http://www.electrictoolbox.com/install-apc-php-linux/

If you are not sure if APC is installed at your server contact the administrator.