[ start | index | login ]

php

Created by kron. Last edited by paolo, 2 years and 207 days ago. Viewed 4,573 times. #17
[diff] [history] [edit] [rdf]
labels
attachments
mailtest.php (622)

Compiling PHP mcrypt extension

Note: These instructions are for RHEL4-based distributions.

You'll need the PHP 'devel' package, g++ and libtool to build mcrypt

apt-get install php-devel autoconf cpp gcc-c++ libtool

Grab it and install it

function installmcrypt() {
wget "http://easynews.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.7.tar.gz"
if [ $? -ne 0 ]; then return 1; fi
tar xzf libmcrypt-2.5.7.tar.gz
if [ $? -ne 0 ]; then return 1; fi
cd libmcrypt-2.5.7
if [ $? -ne 0 ]; then return 1; fi
./configure --disable-posix-threads
if [ $? -ne 0 ]; then return 1; fi
replace "CFLAGS = -g -O2" "CFLAGS = -g -O2 --disable-posix-threads" -- Makefile
if [ $? -ne 0 ]; then return 1; fi
make && make install
if [ $? -ne 0 ]; then return 1; fi
}
installmcrypt

Now grab the PHP source and build the extension. You'll need the source tarball matching your distributions PHP version (4.3.7 for RHEL4).

function phpizemcrypt() {

wget "http://www.php.net/get/php-4.3.9.tar.gz/from/www.php.net/mirror"

if [ $? -ne 0 ]; then

wget "http://museum.php.net/php4/php-4.3.9.tar.gz"

if [ $? -ne 0 ]; then return 1; fi

fi

tar xvzf php-4.3.9.tar.gz

if [ $? -ne 0 ]; then return 1; fi

cd php-4.3.9/ext/mcrypt

if [ $? -ne 0 ]; then return 1; fi

phpize

if [ $? -ne 0 ]; then return 1; fi

./configure

if [ $? -ne 0 ]; then return 1; fi

make && make install

if [ $? -ne 0 ]; then return 1; fi

}

phpizemcrypt

phpize failing? Try an older version of automake and then re-run phpize, configure, make, make install.

{
apt-get install automake-1.7
mv /usr/bin/aclocal /usr/bin/aclocal.old
ln -s /usr/bin/aclocal-1.7 /usr/bin/aclocal
}

Finally, setup the extension in your php.ini or /etc/php.d if RHEL4-based, and restart Apache:

{
echo "extension=mcrypt.so" > /etc/php.d/mcrypt.ini
/etc/init.d/httpd restart
}

Check to see that mcrypt shows up in a test phpinfo() page.

Other extensions can be built in a similar way (i.e. make sure you have the dependancies, grab the PHP tarball, and use phpize, configure, make, make install).

Testing php send mail capabilities

From: >>http://www.webcheatsheet.com/php/send_email_text_html_attachment.php

Edit and save the following file in a externally accessible directory from your web server (usually /var/www/html or /var/www):

>>http://bliki.rimuhosting.com/space/knowledgebase/linux/webserver/apache/php/mailtest.php

Then if you saved it as test.php, go to >>http://207.210.242.17/test.php and see if you got the e-mail. If you didn't check the mail logs (/var/log/maillog or /var/log/mail.log) to see what happened.

Enabling an upload directory for PHP scripts in Debian

The default php.ini file lacks the configuration directive for upload_tmp_dir, which is needed for file uploads. That is default on Debian for security purposes.

In order to use an upload directory, set the upload_tmp_dir parameter in php.ini to a directory that can be read and modified by the HTTP server user.

no comments | post comment
Powered by snipsnap.org Found a mistake in a howto? Let us know via an email to p.blikibugs at rimuhosting com.