As for the MySQL under the previous article, PHP should already be installed on your development platform. This installation has been done with the default flags and, therefore, may not match the installation that the host of your personal pages is using. To clarify which modules we have to import, I'm using a little script that I've put at the root of my local web site and, also, at the root of my hosted pages. This script informs us about the PHP's versions available on the server and, a bit more interesting, it provides us a good mean for comparing wich modules and options are installed on both servers. Here is the scritpt named test.php:
<html>
<head>
<title>PHP config</title>
</head>
<body>
<?php phpinfo(); ?>
</body>
</html>
Access these files with your regular browser at http://127.0.0.1/test.php and http://YourSiteURL/test.php. By default, PHP is installed with development in mind, not production. Thus, keeping these local and remote scripts at hands is a good trick to help you tune your installation. On both script output in your browser, after the section "PHP Core", there are several sections showing the installed modules. By comparing these sections, it gives you a rough idea of what need to set under the installation. To get the currrent USE flags used during your installation and the available ones, just type in:
equery uses php
Once, you've determined which flags you need to set, put them into your Portage tree. Hereafter, I show you an example based on the USE flags that I've set for my installation:
echo "dev-lang/php bcmath berkdb bzip2 calendar cdb cgi cli crypt ctype curl curlwrappers doc exif flatfile gd-external gdbm iconv imap inifile ipv6 kerberos ldap mhash mysql ncurses nls odbc pcre pic postgres readline reflection session simplexml soap sockets spell spl ssl threads tokenizer truetype unicode wddx xml xmlreader xmlwriter zlib xsl xmlrpc" >> /etc/portage/package.use
As there are strong chances that you re-perform this installation to add or removed modules, it is a very good time to install ccache if you have never already done. ccache allows you to easily modify your USE flags and recompile only the necessary part: it shortens a lot these kind of tuning.
Once ccache is set up, just re-install PHP:
emerge dev-lang/php
To check if your new installation matches more the installation of your web site's host, just reload your http://127.0.0.1/test.php.