You have just compiled and installed PHP. Then, you find that one (or more) modules/extensions were missing during last compiling. Instead of re-compile the whole PHP source, time consuming job, you can use this tip to add them manually.
For example: A user complain that built-in PHP on his computer was compiled without mysql. That is the reason why he could not connect to mysql using PHP.
– Logon to his machine and check for PHP version
PHP 5.1.6 (cli) (built: Sep 12 2007 11:10:42) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
– As you can see, current PHP version is 5.1.6, and this is built-in package. To troubleshoot this problem, we need approriate PHP source file. So, we need to download PHP-5.1.6 source then copy it to his machine.
– Extract PHP source file, then change directory to
where [extension_name] is the name of extension/module that you want to add to PHP.
– In this case, it should be mysql, so i will change to php-5.1.6/ext/mysql directory
– Run these following commands to compile and install this module:
– In the last step (“make install”), it will print out the location of installed module. Please copy or take note that location.
– Edit PHP configuration file to load new installed module. To do this, add or modify this line in php.ini file
extension_dir = "The_location_of_previous_installed_module"
– Save that file then restart apache for the new setting takes effect