Call us Toll-Free:
1-800-218-1525
Live ChatEmail us

 Sponsors

How to: Install PHP w/ FPM + Memcached + GD + MySQL on FreeBSD 8

Adrian Singer, 11-30-2011
Enjoy our step-by-step guide to configuring PHP 5 with FPM, NGinx Web server, Memcached and MySQL 5.1, on FreeBSD 8:

1. Install FreeBSD 7 compatibility and standard packages


cd
/usr/ports/misc/compat7x
make all
make install

pkg_add
-r libevent
pkg_add
-r libtool
pkg_add
-r m4
pkg_add
-r pcre
pkg_add
-r pdftk
pkg_add
-r rsync
pkg_add
-r vim
pkg_add
-r wget

2. Install ProFTPD


cd
/usr/ports/ftp/proftpd
make all
make install

3. Install NGinx

Make sure you click to enable 'HTTP_GZIP_STATIC_MODULE', 'HTTP_SSL_MODULE' and 'HTTP_ZIP_MODULE'


cd
/usr/ports/www/nginx
make all
make install

echo "nginx_enable=YES" >> /etc/rc.conf
echo "<?php phpinfo(); ?>" >> /usr/local/www/nginx/phpinfo.php

You can always run make config to redo the configuration options

4. Install CURL+LibXML


cd
/usr/ports/ftp/curl
make all
make install

cd
/usr/ports/textproc/libxml
make all
make install

5. Install MySQL client and server


cd
/usr/ports/databases/mysql51-server
make all
make install

cd
/usr/ports/databases/mysql51-client
make all
make install

cd
/usr/tmp
fetch
"http://api6.softwareprojects.com/files/auto/my.cnf"
mv my.cnf /etc/my.cnf

mkdir
/usr/local/mysql
mkdir
/usr/local/mysql/data
chmod 777
/usr/local/mysql
chown
-R mysql:mysql /usr/local/mysql

/usr/local/bin/mysql_install_db
chmod
-R 777 /usr/local/mysql
chown
-R mysql:mysql /usr/local/mysql

6. Install GD


cd
/usr/ports/graphics/ruby-libpng
make all
make install

7. Install PHP 5


cd
/usr/ports/security/libmcrypt
make all
make install

cd
/usr/ports/devel/php5-pcntl
make all
make install

cd
/usr/tmp
fetch
"http://api6.softwareprojects.com/files/auto/php-5.2.8.tar.gz"
tar xvfz php-5.2.8.tar.gz

fetch
"http://api6.softwareprojects.com/files/auto/php-5.2.8-fpm-0.5.10.diff.gz"
gzip -cd php-5.2.8-fpm-0.5.10.diff.gz | patch -d php-5.2.8 -p1

fetch
"http://api6.softwareprojects.com/files/auto/suhosin-patch-5.2.8-0.9.6.3.patch.gz"
gzip -cd suhosin-patch-5.2.8-0.9.6.3.patch.gz | patch -d php-5.2.8 -p1

cd php
-5.2.8
./configure --with-config-file-path=/usr/local/lib/ --enable-pcntl --enable-fastcgi --enable-fpm --enable-calendar --enable-ftp --enable-mbstring --with-mysql --with-curl --with-mcrypt --with-gd --with-iconv --with-jpeg-dir=/usr/lib --with-mysql=/usr/local/mysql --enable-memcache --with-openssl --enable-soap --enable-sockets --with-zlib --enable-zip --enable-bcmath --with-ttf --enable-gd-native-ttf --with-freetype-dir=/usr/local/lib/ --enable-pdo --with-pdo_mysql --enable-suhosin
make all install

fetch
"http://api6.softwareprojects.com/files/auto/php-fpm.conf"
mv php-fpm.conf /usr/local/etc/php-fpm.conf

fetch
"http://api6.softwareprojects.com/files/auto/nginx.conf"
mv nginx.conf /usr/local/etc/nginx/nginx.conf

8. Install Memcached


cd
/usr/ports/databases/memcached
make all
make install

9. Install HAProxy


cd
/usr/ports/net/haproxy
make all
make install

10. Start MySQL and NGinx


/usr/local/bin/mysqld_safe &
/
usr/local/sbin/php-fpm start
/usr/local/etc/rc.d/nginx start

--

Verify MySQL is working properly:

Attempt connecting to MySQL:

/usr/local/bin/mysql -uroot

Verify NGinx is working properly:

Point your browser to http://1.2.3.4/ (replacing 1.2.3.4 with the PUBLIC ip address of the server)

Verify PHP is working properly:

Point your browser to http://1.2.3.4/phpinfo.php (replacing 1.2.3.4 with the PUBLIC ip address of the server).

If you see the PHP info screen, all is well
Enjoyed this post?

Subscribe Now to receive new posts via Email as soon as they come out.

 Comments
Post your comments












Note: No link spamming! If your message contains link/s, it will NOT be published on the site before manually approved by one of our moderators.



About Us  |  Contact us  |  Privacy Policy  |  Terms & Conditions