Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lost PDO, other extensions in Apache #505

Closed
sam452 opened this issue May 19, 2015 · 10 comments
Closed

Lost PDO, other extensions in Apache #505

sam452 opened this issue May 19, 2015 · 10 comments

Comments

@sam452
Copy link

sam452 commented May 19, 2015

In a previous issue, I've reinstalled the +apxs2=/usr/bin/apxs2 for php-5.4.34. Apparently phpbrew does the right thing and sees the manifest in build and rebuilds cleanly all that was installed before. Except now I've lost PDO and other extensions that the CLI reports that I have.

OK, no need to panic, this is phpbrew so I can switch to other variants. Drupal also reports that PDO connections are broken. Hmm. I run phpbrew ext install pdo. Many times it returns a make error, but at this point it returns it is enabled. That's good, except a known-good Drupal app now returns a database error. Googling the error comes up with the same answer: the pdo_mysql extension must be missing from your PHP installation. This is about the same problem as my earlier issue. Except I'm on deadline and I must get back to what used to be a known good. I've purged a version and did a fresh install of another php version with the +pdo +apxs2, etc. Same result in that every app that uses an extension that I have cannot be found by apache.

the output of php -r "phpinfo();" | grep pdo yields:

PHP Warning: PHP Startup: Invalid library (maybe not a PHP library) 'pdo.so' in Unknown on line 0
Warning: PHP Startup: Invalid library (maybe not a PHP library) 'pdo.so' in Unknown on line 0
Configure Command => './configure' '--prefix=/home/sam/.phpbrew/php/php-5.4.33' '--with-config-file-path=/home/sam/.phpbrew/php/php-5.4.33/etc' '--with-config-file-scan-dir=/home/sam/.phpbrew/php/php-5.4.33/var/db' '--with-pear=/home/sam/.phpbrew/php/php-5.4.33/lib/php' '--disable-all' '--enable-phar' '--enable-session' '--enable-short-tags' '--enable-tokenizer' '--with-pcre-regex' '--with-zlib=/usr' '--with-libdir=lib/x86_64-linux-gnu' '--enable-pdo' '--with-apxs2=/usr/bin/apxs2' '--enable-dom' '--enable-libxml' '--enable-simplexml' '--enable-xml' '--enable-xmlreader' '--enable-xmlwriter' '--with-xsl' '--with-libxml-dir=/usr'
/home/sam/.phpbrew/php/php-5.4.33/var/db/pdo.ini

That first line throws me as I I'm unsure how to remove that 'pdo.so' within phpbrew. Haven't found that in Google anywhere.

@c9s
Copy link
Member

c9s commented May 19, 2015

What's your install command? can you show me the complete command?

If you enabled pdo variant, you will also need to enable some more variants like sqlite, mysql or pgsql, because PDO is just an abstract layer of database. when you enabled +pdo+mysql, phpbrew will enable pdo_mysql automatically for you. if you just use +mysql, phpbrew will compile your php with the native mysql extension and exclude the PDO extension.

And the PDO extension must be compiled statically with PHP, it can't be compiled as shared extension (which means you can't install it with the extension installer separately)

@sam452
Copy link
Author

sam452 commented May 19, 2015

phpbrew ext install pdo is the one that produced above.

That first line throws me. Reading your kind reply I then executed
phpbrew ext install mysql

This returns the mystery line and it shows it is failing to run make -C

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'pdo.so' in Unknown on line 0
===> Installing mysql extension...
Log stored at: /home/sam/.phpbrew/build/php-5.4.33/ext/mysql/build.log
Changing directory to /home/sam/.phpbrew/build/php-5.4.33/ext/mysql
===> Running make clean: make -C /home/sam/.phpbrew/build/php-5.4.33/ext/mysql --quiet clean
===> Phpize...
===> Configuring...
===> Building...
===> Running make all: make -C /home/sam/.phpbrew/build/php-5.4.33/ext/mysql all >> /home/sam/.phpbrew/build/php-5.4.33/ext/mysql/build.log 2>&1
Command failed: make -C /home/sam/.phpbrew/build/php-5.4.33/ext/mysql all >> /home/sam/.phpbrew/build/php-5.4.33/ext/mysql/build.log 2>&1 returns

@c9s
Copy link
Member

c9s commented May 19, 2015

Hi @sam452

I need to know the command you install php, e.g.

phpbrew install 5.4.33 .....???

@c9s
Copy link
Member

c9s commented May 19, 2015

Warning: PHP Startup: Invalid library (maybe not a PHP library) 'pdo.so' in Unknown on line 0

This is for sure because PDO extension can't be compiled as shared extension.

@c9s
Copy link
Member

c9s commented May 19, 2015

Let me show you my installation variants:

phpbrew list -v
  php-5.4.34
    Variants:  +pdo +mysql +pgsql=/opt/local/lib/postgresql92/bin  +fpm +sqlite +pcntl \
              +posix +gettext +intl +openssl +default +curl +readline +session +xml_all \
              +phpdbg +soap +bcmath +exif +fileinfo +ipc +imap +mbregex +mbstring +mhash \
              +opcache +xml +zts +icu -- --with-icu-dir=/opt/local \
              --with-icu-dir=/opt/local --with-icu-dir=/opt/local \
              --with-icu-dir=/opt/local
* php-5.5.17
    Variants:  +pdo +mysql +pgsql=/opt/local/lib/postgresql92/bin  +fpm +sqlite +pcntl \
              +posix +gettext +intl +openssl +default +curl +readline +session +xml_all \
              +phpdbg +soap +bcmath +exif +fileinfo +ipc +imap +mbregex +mbstring +mhash \
              +opcache +xml +zts +icu -- --with-icu-dir=/opt/local \
              --with-icu-dir=/opt/local
  php-5.6.2
    Variants:  +pdo +mysql +pgsql=/opt/local/lib/postgresql92/bin  +fpm +sqlite +pcntl \
              +posix +gettext +intl +openssl +default +curl +readline +session +xml_all \
              +phpdbg +soap +bcmath +exif +fileinfo +ipc +imap +mbregex +mbstring +mhash \
              +opcache +xml +zts +icu -- --with-icu-dir=/opt/local \
              --with-icu-dir=/opt/local
  php-5.6.5
    Variants:  +bcmath +bz2 +calendar +cli +ctype +dom +fileinfo +filter +ipc +json \
              +mbregex +mbstring +mhash +pcntl +pcre +pdo +phar +posix +readline +sockets \
              +tokenizer +xml +curl +zip +openssl=yes

@sam452
Copy link
Author

sam452 commented May 19, 2015

Yes, that would help. Looking at my bash history:
phpbrew install php-5.4.33 +pdo +apxs2=/usr/bin/apxs2

I will purge and try one with mysql in addition.

@c9s
Copy link
Member

c9s commented May 19, 2015

The one you used is not enough for real world use, you need to install php with all the variants you might need. +default will help you a lot and it can save your time. if you want to run Drupal, you will also need +int and +icu

@sam452
Copy link
Author

sam452 commented May 19, 2015

Yes, I got the json error even though I have the latest json. Looking around I find where you suggest to turn off phpbrew and let the system php take over but it does not also have the json either.
php -r 'var_dump(json_decode("{}"));';

Fatal error: Call to undefined function json_decode() in Command line code on line 1

With phpbrew off, how should I let the system php know to use the json?

@c9s
Copy link
Member

c9s commented May 19, 2015

What's your linux distribution? if you're using Ubuntu, you can try apt-get install php5-json or apt-get install php-json

@sam452
Copy link
Author

sam452 commented May 19, 2015

Yes, 14.04 ubuntu. I already have the latest version. System PHP.ini for CLI is having trouble with failing to load a dynamic library. Googling now, thx.
I'm unable to find where the install php5-json file is to force php.ini to find it.
Yes, after turning off phpbrew, I just ran this command and it seems to work and installed:
phpbrew --debug install 5.4.33 +default +gd +gettext +hash +mbstring +mcrypt +mysql +openssl +pdo +pcre +session +soap +xml +curl +intl +posix +fpm +pcntl +readline +xml_all +bcmath +exif +fileinfo +ipc +imap +mbregex +xml +zts +icu +apxs2=/usr/bin/apxs2

I'm grateful for your time in this crisis. The lesson is that PDO only works with another database abstraction layer, in my case mysql. I will work on the ldap issue later and now I can get back to work. Thx again.

@sam452 sam452 closed this as completed May 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants