opkg list php*to see what opkg-packages are available.
opkg update opkg install php5 php5-cgi
For configuration please see the wiki-page for the particular web server: http.overview, e.g.
If You encounter PHP errors, like undefined functions, You need take a look into the php.ini file. Search for the appropriate extension line(s), and uncomment them (remove the ; sign). If the problem persists, You need probably install the appropriate extension too. If PHP run out of memory, You can increase the amount of memory which the script can consume:
memory_limit = 8M ; Maximum amount of memory a script may consume. post_max_size = 8M
Do not specify more memory than is available, and remember that other processes need memory too. Please note, some things will probably never run on the router. Especially under Backfire 10.03. PHP compiled without the SimpleXML extension, and libxml is missing too. If they are necessary, You need to recompile Your own PHP. Without this extensions, some software, like Joomla 1.6 will never run. If you do manage to achieve to run, serious software solutions will run extremely slow, and will consume too much memory.