Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm a bit new to freeBSD and trying to set up a webserver.

I've managed to get phpmyadmin installed and phpinfo(); works fine. But when i typ in 'php -v' i get some warnings:

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/pcre.so' - Cannot open "/usr/local/lib/php/20090626/pcre.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/spl.so' - Cannot open "/usr/local/lib/php/20090626/spl.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/gettext.so' - Cannot open "/usr/local/lib/php/20090626/gettext.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/mhash.so' - Cannot open "/usr/local/lib/php/20090626/mhash.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/snmp.so' - Cannot open "/usr/local/lib/php/20090626/snmp.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/sockets.so' - Cannot open "/usr/local/lib/php/20090626/sockets.so" in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/lib/php/20090626/tokenizer.so' - Cannot open "/usr/local/lib/php/20090626/tokenizer.so" in Unknown on line 0
PHP 5.3.8 with Suhosin-Patch (cli) (built: Dec  1 2011 14:19:00) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

Also when i try to install drupal I can not choose mysql as database but I'm not sure if that is related to the above problem.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

It sounds like either those extension files are missing, or else they cannot be read by the user executing PHP (wrong permissions or ownership), or your extensions.ini needs to be updated to match what modules you have installed. Unfortunately, all failure modes produce the same error.

If they are simply missing, you need to reinstall them. I recommend using the php5-extensions meta-port, but you can also install them one by one using:

portinstall -Rc php5-gettext [etc.]

I see that one of the ones listed is pcre.so. I believe that PCRE is now included by default in PHP 5.3.x. Is this installation an upgrade from an older version of PHP? If so, I think that the pcre.so line in your extensions.ini can be commented out.

For example, one of my test systems currently contains:

$ php -v
PHP 5.3.3 with Suhosin-Patch (cli) (built: Nov 13 2010 19:28:38)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

$ cat /usr/local/etc/php/extensions.ini
extension=filter.so
extension=session.so
extension=mbstring.so
extension=xmlwriter.so
extension=sqlite.so
extension=posix.so
extension=dom.so
extension=xmlreader.so
extension=mcrypt.so
extension=simplexml.so
extension=exif.so
extension=zlib.so
extension=tokenizer.so
extension=json.so
extension=gd.so
extension=iconv.so
extension=gettext.so
extension=readline.so
extension=xml.so
extension=bz2.so
extension=mysqli.so
extension=hash.so
extension=mysql.so
extension=ctype.so
extension=pdo.so
extension=pdo_sqlite.so
extension=pdo_mysql.so
extension=openssl.so
extension=pdf.so

... and the directory contains:

$ ls -lA /usr/local/lib/php/20090626/ 
total 4672
-r--r--r--  1 root  wheel    33066 Nov 13  2010 bz2.so
-r--r--r--  1 root  wheel    20401 Nov 13  2010 ctype.so
-r--r--r--  1 root  wheel   231335 Nov 13  2010 dom.so
-r--r--r--  1 root  wheel    66043 Nov 13  2010 exif.so
-r--r--r--  1 root  wheel    48992 Nov 13  2010 filter.so
-r--r--r--  1 root  wheel   370277 Nov 13  2010 gd.so
-r--r--r--  1 root  wheel    16993 Nov 13  2010 gettext.so
-r--r--r--  1 root  wheel   170710 Nov 13  2010 hash.so
-r--r--r--  1 root  wheel    46473 Nov 13  2010 iconv.so
-r--r--r--  1 root  wheel    39465 Nov 13  2010 json.so
-r--r--r--  1 root  wheel  1972043 Nov 13  2010 mbstring.so
-r--r--r--  1 root  wheel    55648 Nov 13  2010 mcrypt.so
-r--r--r--  1 root  wheel    68010 Nov 13  2010 mysql.so
-r--r--r--  1 root  wheel   165450 Nov 13  2010 mysqli.so
-r--r--r--  1 root  wheel   144290 Jan 30  2011 openssl.so
-r--r--r--  1 root  wheel   180661 Jun 16 20:40 pdf.so
-r--r--r--  1 root  wheel   116922 Nov 13  2010 pdo.so
-r--r--r--  1 root  wheel    38100 Nov 13  2010 pdo_mysql.so
-r--r--r--  1 root  wheel    33347 Nov 13  2010 pdo_sqlite.so
-r--r--r--  1 root  wheel    40794 Nov 13  2010 posix.so
-r--r--r--  1 root  wheel    27386 Nov 13  2010 readline.so
-r--r--r--  1 root  wheel    74152 Nov 13  2010 session.so
-r--r--r--  1 root  wheel    58057 Nov 13  2010 simplexml.so
-r--r--r--  1 root  wheel   405571 Nov 13  2010 sqlite.so
-r--r--r--  1 root  wheel    19723 Nov 13  2010 tokenizer.so
-r--r--r--  1 root  wheel    63158 Nov 13  2010 xml.so
-r--r--r--  1 root  wheel    44015 Nov 13  2010 xmlreader.so
-r--r--r--  1 root  wheel    59210 Nov 13  2010 xmlwriter.so
-r--r--r--  1 root  wheel    45523 Nov 13  2010 zlib.so

Notice that all files are present and world-readable, and that pcre.so is not present.

Finally, note that I have a dim memory of the order in extensions.ini being significant, in that loading them in the wrong order can result in module load failures. While your symptoms don't currently seem to indicate that that's a problem, you should be careful to not re-order the lines in extensions.ini unnecessarily.

If you post the contents of your extensions.ini file and a long listing (ls -la) of your extensions directory, I may be able to assist further. I recommend sorting your extensions sorted out, and then if your MySQL issue remains, we can tackle that.

share|improve this answer
    
yes pcre should be included in php5 that's why i cant just instal pcre from the port folder –  FLY Dec 2 '11 at 8:33
    
Aah i see now removed it from the extensions.ini file. now it is not loaded as extension but as part of php. thnx! –  FLY Dec 2 '11 at 9:51
    
You're welcome! And thanks for finding my answer useful - you are my first accepted answer. :-) –  Royce Williams Dec 2 '11 at 13:55
    
Your answer is very clear and complete. I can't vote your answer up because my reputation is only 3 at the moment :P otherwise I would have voted it up. I would like to see more answers like this! –  FLY Dec 5 '11 at 16:47

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.