From the information you've provided, it looks like you've compiled most of your required packages from scratch rather than using the Gentoo package management system known as Portage. Taking the install-from-source route is generally a bad idea unless you know exactly what you're doing. While it is true that the default behaviour of Portage is also to install packages from source, it has an advanced dependency management toolset which handles most complex dependencies automatically, and makes updating and removing packages quite painless.
The following files and directory locations which you specified are all non-standard in a typical Gentoo configuration, and will most certainly cause interdependent packages to fail or crash unexpectedly:
/usr/local/lib64/php5/php.ini
/etc/init.d/httpd
/usr/local/php5/bin/phpize
If this is not a production box, and you can spare the downtime, I suggest completely removing Apache and PHP, and then reinstall them using Portage as follows:
Install Apache:
emerge -av www-servers/apache
Next, you'll need to install PHP, but be sure to set the apache2
USE flag. Adding your USE flags to /etc/portage/packages.use
ensures that they will be retained across future updates. A typical set of USE flags set for PHP in /etc/portage/packages.use
will look like this:
dev-lang/php apache2 berkdb bzip2 calendar cli crypt ctype curl curlwrappers fileinfo filter ftp gd gdbm hash iconv imap inifile ipv6 json ldap mssql mysql mysqli nls pdo phar posix readline session simplexml snmp soap sockets spell sqlite ssl threads tokenizer truetype unicode xml xmlrpc xsl zip zlib
You should be able to remove most of the USE flags I provided in this example, except for the apache2
flag. Your particular requirements will determine the USE flags you need to set, but for a base installation of PHP which will work with Apache, you only require the apache2
flag to be set.
Now that you have the USE flags set, you can go ahead and install PHP:
emerge -av dev-lang/php
Once PHP has installed successfully, you can confirm that it has been correctly configured to work with Apache by opening /etc/conf.d/apache2
in a text editor and checking that the line starting with APACHE2_OPTS
contains the directive -D PHP5
.
You can now start Apache by invoking the correct init script:
/etc/init.d/apache2 start
There should be no problems starting Apache at this point. The next step requires some changes to PHP, so you should stop Apache again in the meantime.
Gentoo splits the PHP configuration files into two separate directories, one for configuring the PHP CLI, and the other for configuring PHP used with Apache. These directories are as follows:
/etc/php/cli-php5/php.ini
/etc/php/apache2-php5/php.ini
Your exact path may differ slightly depending on the exact version of PHP you have installed.
The last step is to install APC, again using Portage:
emerge -av dev-php5/pecl-apc
Once APC has been successfully installed, you may need to edit the /etc/php/apache2-php5/php.ini
file to check that APC is correctly configured and to ensure that PHP loads the extension when Apache is started. Check that the following are present in the php.ini
file:
apc.enabled=1
apc.shm_size=32
The full list of APC configuration directives are available here on the PHP online docs.
You have now completed all steps required for correctly configuring Apache, PHP and the APC extension for a Gentoo environment. Restart Apache to finish.
/etc/init.d/apache2 restart
Best Answer
Do a quick search with:
for e.g: