Monitoring File Uploads using Ajax and PHP
Before we can begin implementing our file upload monitor we must install the Alternative PHP Cache extension (APC). If you are using a UNIX based operating system, the simplest way to install APC is to use the PECL command line installer.
Specifically, you should use the following command:
# pecl install apc
Executing this command should result in the necessary files being downloaded, compiled and installed. You will then need to modify your
php.ini file to load the extension. If you built PHP from source the typical location for
/usr/local/lib/php.ini. If you use FreeBSD and used ports to install PHP then
php.ini can be found in
If you are instead running PHP on Windows, the extension DLL file should already exist – it simply needs to be activated in the
php.ini (typically in
c:\windows\php.ini) file using a similar command to above:
Enabling File Upload Monitoring
Next the feature of APC that monitors file uploads must be activated. To do so, the
apc.rfc1867 setting must be switched on.
Simply add the following line to your
apc.rfc1867 = On
Restarting Your Web Server
Once the changes described in this section have been made you must restart your web server. To do so you can type
apachectl restart in UNIX or simply restart the Apache service in Windows.
After the web server has been restarted, confirm the changes by viewing the phpinfo() output for your web server. If all is working, there will be an APC section on this page (in which the
apc.rfc1867 setting will be switched to