{{keywords>mybook world edition linux ssh php wget mv gunzip ipkg optware configure make install php.ini}}
====== Install PHP ======
First consider fallowing all the previous steps the [[home|WD MyBook World Edition Hacks]] tutorial
Please read the official PHP documentation before proceeding. [[http://www.php.net/manual/en/install.php|PHP Installation and Configuration]]
* Choose a directory to unpack the distribution.
# cd /tmp
* Download distribution file ([[http://www.php.net/downloads.php|PHP:Donwloads]])
# wget http://ro.php.net/get/php-5.2.5.tar.gz/from/this/mirror
* Rename downloaded file.
# mv mirror php-5.2.5.tar.gz
* Uncompress source archive.
# gunzip php-5.2.5.tar.gz
# tar -xvf php-5.2.5.tar
* Change the location in unpacked distribution directory.
# cd php-5.2.5
* Compile or install some optional shared libraries.
# /opt/bin/ipkg install libxml2
# /opt/bin/ipkg install libxslt
# /opt/bin/ipkg install zlib
# /opt/bin/ipkg install bzip2
# /opt/bin/ipkg install openssl
# /opt/bin/ipkg install openssl-dev
# /opt/bin/ipkg install php-curl
# /opt/bin/ipkg install php-gd
# /opt/bin/ipkg install php-imap
# /opt/bin/ipkg install php-ldap
# /opt/bin/ipkg install php-mbstring
# /opt/bin/ipkg install php-mysql
# /opt/bin/ipkg install php-pear
# /opt/bin/ipkg install libpng
# /opt/bin/ipkg install gettext
* Configure the release.
# ./configure --prefix=/usr/local/php5 --with-config-file-path=/etc
--with-config-file-scan-dir=/etc/php.d --enable-cgi --enable-fastcgi
--enable-force-cgi-redirect --with-curl=shared,/opt --enable-discard-path
--with-openssl=shared,/opt --enable-ftp --with-gd=/opt --enable-gd-native-ttf
--with-freetype-dir=/opt --with-jpeg-dir=/opt --with-png-dir=/opt
--enable-exif=shared --enable-xml=shared --enable-xmlreader=shared
--with-libxml-dir=/opt --with-xpm-dir=/opt --with-xsl=shared,/opt
--with-zlib=shared,/opt --enable-mbstring --enable-mbregex --with-iconv
--with-regex=php --with-gettext=/opt --with-bz2=shared,/opt
--with-mysql=/usr/local/mysql --with-mysqli --with-mysql-sock=/tmp/mysql.sock
--with-pdo-mysql=/usr/local/mysql --with-pdo-sqlite=shared --with-sqlite=shared
--enable-calendar
* Compile and install everything.
# make
# make test
# make install
* Set up php.ini file.
# cp php.ini-dist /usr/local/php5/lib/php.ini