PDO extension

Discussion in 'PHP' started by tophostingcenter, May 23, 2011.

  1. tophostingcenter

    tophostingcenter New Member

    Hello,

    We want to know how to add "PDO extension" in litespeed.

    Can you give us the steps please.

    Thank you
    Eric
  2. webizen

    webizen New Member

    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: May 23, 2011
  3. tophostingcenter

    tophostingcenter New Member

    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
  4. webizen

    webizen New Member

    Yes, you need to include what you already have and ADD the new options.
  5. tophostingcenter

    tophostingcenter New Member

    Thank you very much !

    Eric
  6. tophostingcenter

    tophostingcenter New Member

    Hello,

    We have done what you have mentioned, but we cannot see anymore the php-extension.so, what are your recommendations?

    regards
    eric
  7. webizen

    webizen New Member

    paste here your existing php compile options.
  8. tophostingcenter

    tophostingcenter New Member

    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
  9. webizen

    webizen New Member

    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
    also include the shared module(s) in php.ini like
    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).

  10. tophostingcenter

    tophostingcenter New Member

    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 

      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.sopdo_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
  11. webizen

    webizen New Member

    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: May 27, 2011
  12. tophostingcenter

    tophostingcenter New Member

    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
  13. webizen

    webizen New Member

    /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.
  14. tophostingcenter

    tophostingcenter New Member

    Hello,

    So, that means I will have to copy /usr/local/lsws/phpbuild/php-5.3.2/ext/pdo into /usr/local/lsws/lsphp5/lib/php/extensions/ , right or I'm wrong ?

    Thanks
    Eric
  15. webizen

    webizen New Member

    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. tophostingcenter

    tophostingcenter New Member

    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
  17. tophostingcenter

    tophostingcenter New Member

    Hello,

    Thank you for your good support.

    The issue has been resolved by recompiling everything with --enable-pdo

    Thank you, appreciated!

    Eric
  18. webizen

    webizen New Member

    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.

Share This Page