PDO extension

webizen

Well-Known Member
#2
you can add "PDO extension" in LSPHP in two ways:
1. recompile lsphp
you need to go through LSPHP compile process (http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:lsapi) with "--with-pdo-extension" or "--with-pdo-extension=shared" option added. put "extension=pdo-extension.so" in php.ini for shared object built.

2. dynamic shared extension (no lsphp recompile)
build dynamic shared object from source as indicated in http://www.litespeedtech.com/support/wiki/doku.php?id=litespeed_wiki:php:opcode_cache. there is no need to recompile PHP for this.
 
Last edited:
#3
Hello webizen,

Thank you very much for your quick reply.

I'm assuming also that if we have already some -with... that I will have to include them and add the other options as well or during the compilation Litespeed will include the current options automatically + the new ones that I will add ?

regards
eric
 
#8
Hello,

Here :

'./configure' '--prefix=/usr/local/lsws/lsphp5' '--with-bz2' '--enable-ctype' '--enable-dba' '--enable-ftp' '--with-gettext' '--enable-mbstring=all' '--with-gd' '--with-mhash' '--with-mcrypt=/usr/local/lsws/phpbuild/php-5.3.2/ext/' '--with-openssl=/usr' '--enable-overload' '--enable-posix' '--enable-session' '--enable-sockets' '--enable-standard' '--enable-tokenizer' '--with-xml' '--with-xsl' '--with-zip' '--with-zlib' '--with-zlib-dir' '--with-freetype-dir' '--with-png-dir' '--with-jpeg-dir' '--with-expat-dir' '--with-iconv-dir' '--with-libxml-dir' '--enable-gd-native-ttf' '--with-ttf' '--enable-mbstr-enc-trans' '--with-expat-dir' '--with-xslt-sablot' '--with-gnu-ld' '--with-curl' '--with-curlwrappers' '--with-dom' '--with-dom-xslt' '--with-dom-exsltd' '--with-dom' '--with-fileinfo' '--with-gmp' '--with-iconv' '--with-imap' '--with-imap-ssl' '--with-mcal' '--with-mysql=/usr' '--with-mysqli=shared' '--with-pgsql=/usr' '--with-sqlite=shared' '--enable-sqlite-utf8' '--with-xmlrpc' '--enable-htscanner' '--enable-track-vars' '--enable-trans-sid' '--enable-memory-limit' '--enable-magic-quotes' '--with-pear' '--with-mime-magic' '--with-inifile' '--with-flatfile' '--enable-pdo=shared' '--with-pdo-sqlite=shared' '--with-pdo-mysql=shared' '--with-pdo-pgsql=shared' '--enable-sysvshm' '--enable-sysvsem' '--enable-shmop' '--with-kerberos' '--enable-suhosin' '--with-litespeed' '--with-pdo-extension=shared'

---
This is the error message from the application that needs the PDO Extension

FATAL ERROR: MODx Setup cannot continue.

* MODx requires the PDO extension when native PDO is being used and it does not appear to be loaded.
---

Thank you
Eric
 

webizen

Well-Known Member
#9
you already have needed options: '--enable-pdo=shared' '--with-pdo-sqlite=shared' '--with-pdo-mysql=shared' '--with-pdo-pgsql=shared'.

make sure extension_dir in your php.ini points to the place holds all the so files.

the path to php.ini should be
/usr/local/lsws/fcgi-bin/lsphp5 -i | grep "Loaded Configuration File"
also include the shared module(s) in php.ini like
extension=pdo.so;
extension=pdo_mysql.so;
...
then make a phpinfo page to verify if these modules are loaded by make a request to that page (http://test.yourdomain.com/phpinfo.php).

echo "<?php phpinfo(); ?>" > phpinfo.php
 
#10
Hi,

Didn't work.

Here the php.ini section where I added the extensions:

--
PHP:
  engine = 1
  zend.ze1_compatibility_mode =  
  short_open_tag = 1
  asp_tags = 
  precision = 14
  y2k_compliance = 1 
  output_buffering = 4096
  zlib.output_compression = 
  implicit_flush =  
  unserialize_callback_func =
  serialize_precision = 100
  allow_call_time_pass_reference =
  safe_mode = 
  safe_mode_gid = 1
  safe_mode_include_dir = 
  safe_mode_exec_dir = 
  safe_mode_allowed_env_vars = PHP_
  safe_mode_protected_env_vars = LD_LIBRARY_PATH
  disable_functions =
  disable_classes = 
  highlight.string = #DD0000
  highlight.comment = #FF9900
  highlight.keyword = #007700
  highlight.bg = #FFFFFF
  highlight.default = #0000BB
  highlight.html = #000000
  expose_php = 1
  max_execution_time = 50
  max_input_time = 60
  memory_limit = 128M
  error_reporting =  E_ALL & ~E_DEPRECATED
  display_errors = 0
  display_startup_errors =
  log_errors = 1
  log_errors_max_len = 1024
  ignore_repeated_errors =
  ignore_repeated_source =
  report_memleaks = 1
  track_errors =
  html_errors =
  error_log = /hsphere/local/var/httpd/logs/php_error.log
  variables_order = EGPCS
  register_globals = 1
  register_long_arrays = 1
  register_argc_argv = 1
  auto_globals_jit = 1
  post_max_size = 8M
  magic_quotes_gpc = 1
  magic_quotes_runtime =
  magic_quotes_sybase =
  auto_prepend_file =
  auto_append_file =
  default_mimetype = text/html
  always_populate_raw_post_data = 1
  include_path = .:/usr/local/lsws/phpbuild/php-5.3.2/ext
  doc_root =
  user_dir =
  extension_dir = /usr/local/lsws/phpbuild/php-5.3.2/ext/
  cgi.fix_pathinfo = 1
  file_uploads = 1
  upload_tmp_dir =
  upload_max_filesize = 100M
  allow_url_fopen = 1
  allow_url_include =
  default_socket_timeout = 60
  auto_detect_line_endings = 1
  extension=pdo.so;
  extension=pdo_mysql.so;
  extension=pdo-extension.so;
--

I have checked if the pdo.so, pdo_mysql.so and pdo-extension.so were in extension_dir = /usr/local/lsws/phpbuild/php-5.3.2/ext/ and they are there
drwxr-xr-x  4 lsadm lsadm  4096 Jun 12  2010 pdo
drwxr-xr-x  2 lsadm lsadm  4096 Mar  3  2010 pdo_dblib
drwxr-xr-x  3 lsadm lsadm  4096 Mar  3  2010 pdo_firebird
drwxr-xr-x  4 lsadm lsadm  4096 Jun 12  2010 pdo_mysql
drwxr-xr-x  3 lsadm lsadm  4096 Mar  3  2010 pdo_oci
drwxr-xr-x  3 lsadm lsadm  4096 Mar  3  2010 pdo_odbc
drwxr-xr-x  4 lsadm lsadm  4096 Jun 12  2010 pdo_pgsql
drwxr-xr-x  4 lsadm lsadm  4096 Jun 12  2010 pdo_sqlite

Also please refer to the info.php page to have a better view.

http://www.gongcha.ph/info.php

===

The issue is they don't load, what is the solution ?

regards
eric
 

webizen

Well-Known Member
#11
your extension directory should be "/usr/local/lsws/lsphp5/lib/php/extensions/no-debug-non-zts-20090626" or "/usr/local/lsws/lsphp5/lib/php/extensions/20090626" for php 5.3.*. please double check if directory exists.

another option is compile with '--enable-pdo' instead of '--enable-pdo=shared'
 
Last edited:
#12
Hello ,

Thank you !

Here what is we have, I don't see any folders that you mentioned, what we should do now ?

--
[root@xxxxxx~]# ls -l /usr/local/lsws/phpbuild/php-5.3.2/ext/pdo
total 876
-rwxr-xr-x 1 lsadm lsadm 102 Mar 23 2006 CREDITS
-rw-r--r-- 1 lsadm lsadm 937 Sep 26 2007 Makefile.frag
-rwxr-xr-x 1 lsadm lsadm 2000 Sep 26 2007 README
-rwxr-xr-x 1 lsadm lsadm 2425 Jul 25 2007 TODO
-rwxr-xr-x 1 lsadm lsadm 1865 Jul 25 2008 config.m4
-rwxr-xr-x 1 lsadm lsadm 349 Jul 24 2008 config.w32
-rw-r--r-- 1 lsadm lsadm 5095 Jul 14 2009 package2.xml
-rwxr-xr-x 1 lsadm lsadm 10339 Jan 3 2010 pdo.c
-rw-r--r-- 1 lsadm lsadm 834 Jun 12 2010 pdo.la
-rw-r--r-- 1 lsadm lsadm 308 Jun 12 2010 pdo.lo
-rw-r--r-- 1 lsadm lsadm 71280 Jun 12 2010 pdo.o
-rwxr-xr-x 1 lsadm lsadm 1231 Sep 26 2007 pdo.php
-rwxr-xr-x 1 lsadm lsadm 48966 Jan 3 2010 pdo_dbh.c
-rw-r--r-- 1 lsadm lsadm 320 Jun 12 2010 pdo_dbh.lo
-rw-r--r-- 1 lsadm lsadm 150184 Jun 12 2010 pdo_dbh.o
-rw-r--r-- 1 lsadm lsadm 17152 Mar 3 2010 pdo_sql_parser.c
-rw-r--r-- 1 lsadm lsadm 17890 Mar 3 2010 pdo_sql_parser.c.orig
-rw-r--r-- 1 lsadm lsadm 341 Jun 12 2010 pdo_sql_parser.lo
-rw-r--r-- 1 lsadm lsadm 69808 Jun 12 2010 pdo_sql_parser.o
-rw-r--r-- 1 lsadm lsadm 14261 Jan 3 2010 pdo_sql_parser.re
-rw-r--r-- 1 lsadm lsadm 13777 Jan 3 2010 pdo_sqlstate.c
-rw-r--r-- 1 lsadm lsadm 335 Jun 12 2010 pdo_sqlstate.lo
-rw-r--r-- 1 lsadm lsadm 54264 Jun 12 2010 pdo_sqlstate.o
-rwxr-xr-x 1 lsadm lsadm 79258 Feb 11 2010 pdo_stmt.c
-rw-r--r-- 1 lsadm lsadm 323 Jun 12 2010 pdo_stmt.lo
-rw-r--r-- 1 lsadm lsadm 199960 Jun 12 2010 pdo_stmt.o
-rwxr-xr-x 1 lsadm lsadm 3141 Jan 3 2010 php_pdo.h
-rwxr-xr-x 1 lsadm lsadm 24214 Jan 3 2010 php_pdo_driver.h
-rwxr-xr-x 1 lsadm lsadm 3794 Jan 3 2010 php_pdo_int.h
drwxr-xr-x 2 lsadm lsadm 4096 Mar 3 2010 tests


--

regards
eric
 

webizen

Well-Known Member
#13
/usr/local/lsws/phpbuild/php-5.3.2/ext/pdo part of your php source NOT the compiled so file. the shared module should be in "/usr/local/lsws/lsphp5/lib/php/extensions/..." as pointed out previously. pls double check.
 

webizen

Well-Known Member
#15
Do NOT copy source to extensions directory. It is useless. The shared module so files should be generated in the extensions directory automatically during php compile.
 
#16
Ok!

In the admin panel, you have an "extra path" when you compile PHP, is it there that we should add /usr/local/lsws/lsphp5/lib/php/extensions/ , because the way I can see it , the issue is PDO is not at the good place !

Thanks
eric
 

webizen

Well-Known Member
#18
the extra path in admin console is to tell lsws when compile php what extra path to look for tool like wget, patch. you can leave it empty.

the compile option --prefix=/usr/local/lsws/lsphp5 makes sure all the shared extensions get created in /usr/local/lsws/lsphp5/lib/php/extensions/

if building shared extension doesn't work for you, try using the following options to build static modules (no 'extension=...' needed in php.ini) as pointed out before.

'./configure' '--prefix=/usr/local/lsws/lsphp5' '--with-bz2' '--enable-ctype' '--enable-dba' '--enable-ftp' '--with-gettext' '--enable-mbstring=all' '--with-gd' '--with-mhash' '--with-mcrypt=/usr' '--with-openssl=/usr' '--enable-overload' '--enable-posix' '--enable-session' '--enable-sockets' '--enable-standard' '--enable-tokenizer' '--with-xml' '--with-xsl' '--with-zip' '--with-zlib' '--with-zlib-dir' '--with-freetype-dir' '--with-png-dir' '--with-jpeg-dir' '--with-expat-dir' '--with-iconv-dir' '--with-libxml-dir' '--enable-gd-native-ttf' '--with-ttf' '--enable-mbstr-enc-trans' '--with-expat-dir' '--with-xslt-sablot' '--with-gnu-ld' '--with-curl' '--with-curlwrappers' '--with-dom' '--with-dom-xslt' '--with-dom-exsltd' '--with-dom' '--with-fileinfo' '--with-gmp' '--with-iconv' '--with-imap' '--with-imap-ssl' '--with-mcal' '--with-mysql=/usr' '--with-mysqli' '--with-pgsql=/usr' '--with-sqlite' '--enable-sqlite-utf8' '--with-xmlrpc' '--enable-htscanner' '--enable-track-vars' '--enable-trans-sid' '--enable-memory-limit' '--enable-magic-quotes' '--with-pear' '--with-mime-magic' '--with-inifile' '--with-flatfile' '--enable-pdo' '--with-pdo-sqlite' '--with-pdo-mysql' '--with-pdo-pgsql' '--enable-sysvshm' '--enable-sysvsem' '--enable-shmop' '--with-kerberos' '--enable-suhosin' '--with-litespeed'
 
Top