Original Post: August 27, 2006
I have to admit, this task is not for the faint of heart. This entry goes with my “PHP Upload Progress Bar“ entry. I ported the entry from my old server, FC2 on Go Daddy’s Virtual Dedicated, to my new system, FC4 on Go Daddy’s Virtual Dedicated.
My goal is to recompile PHP with the PHP upload progress bar patch applied, while not breaking anything with Plesk!
All I am going to do is replace the “/etc/httpd/modules/libphp5.so” file on my system, and that’s it! Remember, I don’t want to break anything with my Plesk installation.
Ok, so first things first, backup the /etc/httpd/modules/libphp5.so file:
I started out by making a phpinfo.php page, so I could see my existing configure line. Turns out it looks like this:
Now, download the latest PHP tarball and patch tarball:
Untar PHP and the patch:
tar -xzvf upload-progress-php-5.0.1-patch.tar.gz
Install patch, so I can patch the source:
Patch the PHP source:
patch -p1 < ../upload-progress-php-5.0.1-patch/upload-progress-php-5.0.1-patch
There was some fuzz, but the patch applied fine for me. Good, 5.0.1 patch still works on 5.1.6!
Then, I proceded with a series of “configure”, fix error, repeat procedure: pasting the configure line from above, receive error, resolve error, repeat. The packages I needed to install to get the configure command to complete without error are:
yum install flex
yum install libxml2-devel
yum install httpd-devel
yum install openssl-devel
yum install bzip2-devel
yum install bzip2-devel
yum install curl-devel
yum install gmp-devel
yum install unixODBC-devel
yum install pspell-devel
Next, run the make, but for me, the make failed:
/usr/local/src/php-5.1.6/main/rfc1867.c: In function ‘update_progress_metter_file’:
/usr/local/src/php-5.1.6/main/rfc1867.c:792: error: ‘MYSQL’ undeclared (first use in this function)
/usr/local/src/php-5.1.6/main/rfc1867.c:792: error: (Each undeclared identifier is reported only once
/usr/local/src/php-5.1.6/main/rfc1867.c:792: error: for each function it appears in.)
/usr/local/src/php-5.1.6/main/rfc1867.c:792: error: syntax error before ‘mysql’
/usr/local/src/php-5.1.6/main/rfc1867.c:793: error: ‘MYSQL_RES’ undeclared (first use in this function)
/usr/local/src/php-5.1.6/main/rfc1867.c:793: error: ‘result’ undeclared (first use in this function)
/usr/local/src/php-5.1.6/main/rfc1867.c:794: error: ‘MYSQL_ROW’ undeclared (first use in this function)
/usr/local/src/php-5.1.6/main/rfc1867.c:794: error: syntax error before ‘row’
/usr/local/src/php-5.1.6/main/rfc1867.c:811: error: ‘mysql’ undeclared (first use in this function)
make: *** [main/rfc1867.lo] Error 1
This presented a challenge to me. There may be other ways around this, but what I did was download the MySQL 4.1 binary distribution from a mirror, then untar it, like this:
tar -xzvf mysql-standard-4.1.21-pc-linux-gnu-i686.tar.gz
ln -s mysql-standard-4.1.21-pc-linux-gnu-i686 mysql
Then changed my configure line, getting rid of “‘–without-mysql'” and adding “‘–with-mysql=/usr/local/mysql/'”, did the configure again, then ran the make again, now it’s working! Not sure why the original configure line excluded mysql, I would think you’d want it compiled in, probably is extended later, but let’s just compile in now…
Wow, that was not for the faint of heart, but near the end of the process, I have a PHP upload bar enabled ./.libs/libphp5.so file ready. I’m excited.
Remember, I already backed up my existing /etc/httpd/modules/libphp5.so file, in case this doesn’t work. Also I AM NOT GOING TO RUN “make install” – I DO NOT WANT to replace my existing PHP installation, only the libphp5.so file!
Let’s drop it in place, and restart httpd:
cp .libs/libphp5.so /etc/httpd/modules/libphp5.so
service httpd restart
Ug, my new libphp5.so module is looking for the mysql.sock file in the /tmp DIR. Oops, probably could have corrected that during the configure/compile stages, but it’s simple enough to just sym link it, works in a snap:
Now, I don’t touch the httpd.conf file, as suggested in the instructions. Instead, I drop a .htaccess file in the DIR I want to enabled the upload meter. I cd’d into my upload5 dir, created a .htaccess file and dropped this in:
php_value upload_max_filesize 2097152
php_value upload_metter_mysql_host localhost
php_value upload_metter_mysql_user uploaduser
php_value upload_metter_mysql_pass xxxxxxxxxxxxxxxx
php_value upload_metter_mysql_db uploadbar
Comments are closed.