My linux distro is Arch Linux. I first noticed this error when trying to send emails using the PHP mail() function. Testing with a simple mail-test.php file with the mail() function sends the email when called from the command line, but will not send when using http://localhost/mail-test.php. I get the same error both times, but only using the command line sends the email.

I get the error:

PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/libphp5.so' - /usr/lib/php/modules/libphp5.so: cannot open shared object file: No such file or directory at Unknown#0

Using ls /usr/lib/php/modules shows the file does not exist, and searching the system results in /usr/lib/httpd/modules/libphp5.so existing.

php-apache is installed and apache serves php sites just fine. (tested with a test php file containing <?php phpinfo(); ?>)

I can't seem to find the cause of this error though. Any help is appreciated, thanks!

  • Take a loot at /etc/php5/ there should be some config files in there to help you.
    – SailorCire
    May 19, 2015 at 14:50
  • I have tried to move the file to /usr/lib/php/modules but doing so results in the library not loading with error undefined symbol: ap_server_root May 19, 2015 at 15:03
  • 1
    @DanielSanchez don't recommend moving things that could potentially break a system. If you have to, symlink them. However, config files and library paths are there for a reason.
    – SailorCire
    May 19, 2015 at 15:06
  • @SailorCire /etc/php5 does not exist in my system. /etc/php contains a php.ini which is the default except where I changed sendmail_path to use my MTA. There is also a conf.d directory but that is empty May 19, 2015 at 15:09

1 Answer 1


I have an Arch Linux web server. Looks like my configuration files are way out of date.

However, looking at the ArchWiki Apache HTTP Server page, the section named "PHP" says that you'll need to do some changes to both /etc/httpd/conf/httpd.conf and /etc/php/php.ini to get things to work. If I were in your shoes, I'd probably do pacman -R php-apache and maybe even pacman -R apache, and then re-install both of those packages. Save copies of files you made, and clean up what pacman complains about.

After re-installing, I'd fix up /etc/httpd/conf/httpd.conf and /etc/php/php.ini exactly as the ArchWiki page says to. Then do systemctl start httpd and see if your problem has gone away. I suspect that you've got some mismatched config files, and maybe even something wrong with LD_LIBRARY_PATH for the http user. Doing the uninstall and reinstall will hopefully get those inconsistencies back in synch.

  • I followed all of this advice and upon re-installing php-apache and apache I now get the error PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/httpd/modules/libphp5.so' - /usr/lib/httpd/modules/libphp5.so: undefined symbol: ap_server_root in Unknown on line 0 May 19, 2015 at 21:11
  • @PancakeMaker - ap_server_root is a .BSS segment symbol (C language global variable) in httpd: nm -D /usr/bin/httpd| grep ap_server_root Are you certain you have a good installation of Apache? Is the ServerRoot value set in /etc/httpd/conf/httpd.conf, and is it correct?
    – user732
    May 19, 2015 at 21:31
  • After using pacman -R and cleaning up the results I re-installed both packages and set the new config files exactly according to the Arch wiki. Upon testing the new installation php immediately threw out the same error I mentioned before. ServerRoot has always been set to "/etc/httpd" which is the default value. May 20, 2015 at 15:29
  • @PancakeMaker - do nm -D /usr/bin/httpd | grep ap_server_root to see if the Apache executable even has that symbol defined in it. Also, is package "httpd" up to date? pacman -S httpd should show you.
    – user732
    May 20, 2015 at 15:35
  • @Bruck Ediger nm -D /usr/bin/httpd | grep ap_server_root outputs 000000000068a4e8 B ap_server_root My system does not have an "httpd" package installed and it isn't listed in the Arch repos either. I am not experienced with the deeper workings of Arch (why I started to use it) so I apologize if I do not adequately provide info May 20, 2015 at 16:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .