2

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!

PancakeMaker
  • 21
  • 1
  • 3
  • Take a loot at `/etc/php5/` there should be some config files in there to help you. – SailorCire May 19 '15 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` – PancakeMaker May 19 '15 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 '15 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 – PancakeMaker May 19 '15 at 15:09

1 Answers1

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` – PancakeMaker May 19 '15 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? –  May 19 '15 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. – PancakeMaker May 20 '15 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. –  May 20 '15 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 – PancakeMaker May 20 '15 at 16:04
  • @PancakeMaker - my mistake. It's the "apache" package. Try un-installing and re-installing "apache". `pacman -Q apache` tells me "apache 2.4.12-4" –  May 20 '15 at 16:36
  • I see. `pacman -Q apache` also tells me "apache 2.4.12-4" I re-installed Apache using `pacman -S apache` before making my first post here. It unfortunately did not change anything. I also removed apache using `pacman -R apache` and then wiped the system clean of all Apache configs and libraries that were not dependencies of other packages. Following this I re-installed Apache and PHP and only changed configs need to get the two working together as shown in the Arch Wiki – PancakeMaker May 20 '15 at 16:44
  • @PancakeMaker - last things I can think of is to look in /var/log/httpd/error_log when you run the PHP script from the web. You may also want to go into /etc/php/php.ini and turn up error reporting: "error_reporting = E_ALL" and "display_errors = On" and "display_startup_errors = On". That might give you some extra info to go on. Also: now that you're getting a different error, open a new question, complete with version numbers for all the packages involved, and the smallest piece of PHP that triggers the problem. –  May 20 '15 at 22:51
  • Thanks for all the help. I will dig around some more before opening a new question to see if I can find the root issue. – PancakeMaker May 21 '15 at 14:39