Shared object "libpcre.so.1" not found

Searching the FreeBSD forums I've found other topic relating to this question, but none of them helped in my case.
I have some missing dependencies on my system. Which gives errors like the following:

Code:
httpd: Syntax error on line 106 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/libphp5.so into server: Shared object "libpcre.so.1" not found, required by "libphp5.so"

What is the most appropriate way of fixing these dependencies?
I am trying to find my way to the ports system, but it isn't really working out for me :)

Is there a way to rebuild all ports and dependencies at once? (without losing configurations) or to fix every package that relies on a given missing shared object?

(I hope I posted this in the right forum)
Thanks in advance!
 
First: welcome to these forums :)

Now, I don't know your level of expertise so just to try and cover most bases I'd like to start by mentioning the (perhaps) totally obvious: it is important not to mix pre-build (binary) packages with the ones from the ports collection itself (so the ones you build yourself). That combination can cause weird problems to occur.

Another thing, though I have no idea if this is related to the cause of your problems, is that you should always pay close attention to /usr/ports/UPDATING before starting the actual upgrade procedure. Some ports require specific steps to be taken, and if you skip those then bad things can happen because of it.

Having that out of the way my advice would be to install ports-mgmt/portmaster. It's a script which can make your life with the port collection maintenance a lot easier.

In your example it appears that the problem isn't so much related with Apache but with PHP. Remember; depending on how you configured PHP it can depend on Apache, but not the other way around. In this case /usr/local/libexec/apache22/libphp5.so has probably been installed by PHP:

Code:
$ pkg_info -W /usr/local/libexec/apache22/libphp5.so
/usr/local/libexec/apache22/libphp5.so was installed by package php5-5.4.25
And the PCRE library is indeed a dependency:

Code:
root@smtp2:/usr/ports/lang/php5 # make all-depends-list | grep pcre
/usr/ports/devel/pcre
So my advice would be to rebuild PHP (probably lang/php5) and all its dependencies. As mentioned earlier portmaster is the perfect tool for that. Merely use something like: # portmaster -f lang/php5.

Be careful: I am now assuming that you are indeed using lang/php5. If you're using something else you should obviously replace my example with the port you're using.

After all of this is done this particular problem should be a thing of the past.
 
ShelLuser said:
First: welcome to these forums :)

Now, I don't know your level of expertise so just to try and cover most bases I'd like to start by mentioning the (perhaps) totally obvious: it is important not to mix pre-build (binary) packages with the ones from the ports collection itself (so the ones you build yourself). That combination can cause weird problems to occur.

I know a bit about Unix, can work wit vim. And right now I have a FreeBSD server running for almost a year, without lots of troubles...
But i'm indeed a beginner :p


Another thing, though I have no idea if this is related to the cause of your problems, is that you should always pay close attention to /usr/ports/UPDATING before starting the actual upgrade procedure. Some ports require specific steps to be taken, and if you skip those then bad things can happen because of it.

Well, doing my research today, I've found many people talking about these UPPDATING file. Which I had never read before. So next time I'll will do :)


So my advice would be to rebuild PHP (probably lang/php5) and all its dependencies. As mentioned earlier portmaster is the perfect tool for that. Merely use something like: # portmaster -f lang/php5.

I will give that a try!


Be careful: I am now assuming that you are indeed using lang/php5. If you're using something else you should obviously replace my example with the port you're using.

Here comes the dumbest question ever... How do I know that I have installed php5, and not php53 (or another port?)


I must already thank you for typing such a clear and detailed answer!
Thanks!
 
DenBeke said:
Here comes the dumbest question ever... How do I know that I have installed php5, and not php53 (or another port?)
Not a dumb question, especially not since php5 used to be PHP 5.3.x before it got upgraded to 5.4.x and the 'old' 5.3.x was moved to php53.

But pkg_info -x php5 should give you the exact version that's installed. Pay close attention if the version is 5.3.x, you will need to change some origins on dependencies to switch to lang/php53. Or follow the procedures and upgrade to 5.4.x.
 
This means I have installed a specific version?
I am however 99% sure that I installed a more general version than this. Like php5 or php53...

Code:
$ pkg_info -x php5
Information for php53-5.3.18:

Comment:
PHP Scripting Language


Required by:
php53-bz2-5.3.18
php53-ctype-5.3.18
php53-curl-5.3.18
php53-dom-5.3.18
php53-exif-5.3.18
php53-fileinfo-5.3.18
php53-filter-5.3.18
php53-ftp-5.3.18
php53-gd-5.3.18
php53-gettext-5.3.18
php53-hash-5.3.18
php53-iconv-5.3.18
php53-imap-5.3.18
php53-json-5.3.18
php53-mbstring-5.3.18
php53-mysql-5.3.18
php53-mysqli-5.3.18
php53-openssl-5.3.18
pecl-pdflib-2.1.9
php53-pdo-5.3.18
php53-pdo_sqlite-5.3.18
php53-phar-5.3.18
php53-posix-5.3.18
php53-session-5.3.18
php53-simplexml-5.3.18
php53-sqlite-5.3.18
php53-sqlite3-5.3.18
php53-tokenizer-5.3.18
php53-xml-5.3.18
php53-xmlreader-5.3.18
php53-xmlwriter-5.3.18
php53-zip-5.3.18
php53-extensions-1.6
php53-zlib-5.3.18
php53-bcmath-5.3.18
php53-calendar-5.3.18
php53-dba-5.3.18
php53-gmp-5.3.18
pecl-ssh2-0.11.3
pecl-geoip-1.0.8
 
Yes, you have lang/php53 installed, not lang/php5. It should be fine for the time being if you want to keep it this way. Just make sure you upgrade to the latest version because you do seem to be a few versions behind (including a couple of security fixes).
 
Alright thank you!

I have noticed that this is not the only missing dependency.
Is there a way to fix everything at once?
 
Not a safe one, at least that's my opinion. Considering that you haven't followed /usr/ports/UPDATING makes that a very liable cause for your problems. So if you now simply re-install the whole lot then it is possible that you'll run into more problems. As mentioned; some ports require extra, specific, actions in order to update them. If you ignore those actions you could end up with quite a mess.

Even so; the portmaster(8) manualpage is your friend here. It is possible to simply re-install the whole lot and while doing so let portmaster sort out all the further dependencies (actually it's the ports collection itself which does that, but I'm simply blaming portmaster in order to provide an easier explanation).

From the manualpage:

Code:
     Using portmaster to do a complete reinstallation of all your ports:
           1. portmaster --list-origins > ~/installed-port-list
           2. Update your ports tree
           3. portmaster -ty --clean-distfiles
           4. portmaster --check-port-dbdir
           5. portmaster -Faf
           6. pkg_delete -a
           7. rm -rf /usr/local/lib/compat/pkg
           8. Back up any files in /usr/local you wish to save,
              such as configuration files in /usr/local/etc
           9. Manually check /usr/local and /var/db/pkg
              to make sure that they are really empty
           10. Re-install portmaster
           11. portmaster `cat ~/installed-port-list`
This could fix a lot of problems because you'd basically be doing a complete re-installation instead of upgrading individual ports (and trying to keep their dependencies together). Should you decide to try this approach then be aware that this will probably take it's sweet time (depending on your environment and the amount of ports you have installed). Also pay specific and close attention to step 8 because this line of action will basically set you up with a clean slate. In other words it removes everything and then reinstalls the whole lot with the default configuration. Which also means that all your changes to the configuration files would be gone; hence the need to back those up first so that you can restore them afterwards.

Hope this can give you some ideas.
 
Before reinstalling everything, install sysutils/bsdadminscripts. Run pkg_libchk -q. If it reports anything, those ports need to be rebuilt. Do them all at once, as a list to portmaster, so it can rebuild them and their dependencies in the right order. Most of the time, this can get the system back on track.
 
Code:
$  pkg_libchk -q
git-1.8.4.3                                     
php53-5.3.18                                     
php53-curl-5.3.18

I expected worse. :)
How to reinstall these package with portmaster (and the missing dependencies?)
 
A portmaster lang/php53 should do the trick, any missing dependencies will get built in the process. Then portmaster ftp/php53-curl and finally portmaster devel/git.
 
SirDice said:
A portmaster lang/php53 should do the trick, any missing dependencies will get built in the process. Then portmaster ftp/php53-curl and finally portmaster devel/git.

Thank you!
I really appreciate your helpful answers!
 
Back
Top