Jump to content

dariyoosh

Members
  • Posts

    13
  • Joined

  • Last visited

Posts posted by dariyoosh

  1. Ok, I solved the problem.

     

    It was SELinux which was blocking the library load. Now I have OCI8 entry in phpinfo(). At the same time as we saw before the PHP in command line could detect OCI8, maybe this means that SELinux doesn't have the same impact in CLI as in GUI.

    I also wrote a test SQL script (SELECT employee_id FROM employees WHERE department_id = 100) and the result was printed on the screen perfectly.

    So for those who may have encountered the same problem with the same environment parameters I'm going to give a summary of how I proceeded in the case where it might be helpful for others.

    My environment
    OS: Linux Fedora Core 17 (X86_64)
    Oracle version: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
    Apache version (httpd): Apache 2.0
    PHP version: 5.4.13



    Before the installation
    Before the installation I disabled SELinux. At the time of writing I'm not an expert of SELinux so I don't know any rule modification in order to modify SELinux policy accordingly allowing to OCI8 module to load oracle libraries. As a result I finally disabled completely the SELinux on my system which may have serious security impacts! This can be done in the following way (being as root)
     

     

    # vim  /etc/selinux/config
     

     

    The file content is something similar to the following
     

     

    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected.
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
     

    So what I did was that I put a comment at the beginning of the line SELINUX=enforcing and instead I added a new line right after that line which was SELINUX=disabled.

    Finally I rebooted the system.


    Installation:
    - Make sure that all oracle environment variables are defined in ~/.bash_profile of the user who installs OCI8. Otherwise you will have to enter manually the path to $ORACLE_HOME. I tested both ways and each method works pretty well. Yet I find the first one more elegant because it detects automatically everything

    - In my case, PHP, Apache and Oracle server were all on the same physical machine, therefore I didn't need to install the Oracle Instant client. All the required oracle libraries for OCI8 were therefore already available.

    - being as ROOT, I run the following (I don't know whether this was mandatory but I prefered to stop httpd before installing OCI8)
     

     

    # pecl install oci8
     
    

    (On my machine pecl was already there, if not you can install it by using yum)

    - Once installation is over, at the end of the installation report in the terminal you will get something like this
     

    Build process completed successfully
    Installing '/usr/lib64/php/modules/oci8.so'
    install ok: channel://pecl.php.net/oci8-1.4.9
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=oci8.so" to php.ini



    The two bold lines above shows what you have to put in your php.ini file (on my computer this file is in /etc/php.ini)
    So I updated the php.ini file in the following way:

     

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Dynamic Extensions ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    ; If you wish to have an extension loaded automatically, use the following
    ; syntax:
    ;
    ;   extension=modulename.extension
                           .
                           .
                           .
    extension=oci8.so
                           .
                           .
                           .
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ; Paths and Directories ;
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
     
    ; UNIX: "/path1:/path2"
    ;
    ;
                           .
                           .
                           .
    extension_dir="/usr/lib64/php/modules"
     

    Then you have to define the required oracle environment variables for Apache. According to what I read in  http://www.oracle.com/technetwork/topics/php/underground-php-oracle-manual-098250.html and in several forums while I was googling for this problem and also based on my own tests, it seems to me that depending on which Apache version you're using, the syntax for declaring the environment variables in /etc/sysconfig/httpd is not the same.

    Here is what I added at the end of the file /etc/sysconfig/httpd

     

    .
    .
    .
    ORACLE_BASE=/u01/app/oracle
    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/db_1/lib:/u01/app/oracle/product/11.2.0/db_1/network/lib
    TNS_ADMIN=/u01/app/oracle/product/11.2.0/db_1/network/admin
    NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    ORACLE_SID=db01
     


    I tried to use the export keyword before the variable names but it didn't work for me, yet I saw in other forums that there were people who apparently had used that syntax successfully. So again it is a matter of personal observation. For me using Apache 2.0, only the above syntax works. Also if I use $ in order to expand the environment variables it doesn't work
    so for example instead of writing
     

     

    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
    LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
     

     

    I had to write explicitly the expanded values myself, that is,
     

    ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
    LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/db_1/lib:/u01/app/oracle/product/11.2.0/db_1/network/lib
     


    Once this is done, restart httpd
     

    # service httpd start
     


    If everything went well, normally you will see the OCI8 entry if you run phpinfo() in a test PHP script.

    Hope this may help others,

     


    Regards,
    Dariyoosh

  2. Hello there,

     

     

    Thank you very much for your attention to my problem.

     

    First of all, after a bit googling I understood that the environment variables inside /etc/sysconfig/httpd as I specified by using PassEnv are those used internally by apache and have nothing to do with the OS environment variables. Apparently for OS environment variables the same syntax applies as ~/.bash_profile.

     

    So instead of adding

    PassEnv ORACLE_BASE
    PassEnv ORACLE_HOME
    PassEnv LD_LIBRARY_PATH64
    PassEnv LD_LIBRARY_PATH
    PassEnv TNS_ADMIN
    PassEnv NLS_LANG
    PassEnv ORACLE_SID

    I added the following lines at the end of /etc/sysconfig/httpd

    ORACLE_BASE=/u01/app/oracle
    export ORACLE_BASE

    ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
    export ORACLE_HOME

    LD_LIBRARY_PATH64=$LD_LIBRARY_PATH64:$ORACLE_HOME/lib:$ORACLE_HOME/network/lib
    export LD_LIBRARY_PATH64

    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$LD_LIBRARY_PATH64
    export LD_LIBRARY_PATH

    TNS_ADMIN=$ORACLE_HOME/network/admin
    export TNS_ADMIN

    NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252
    export NLS_LANG

    ORACLE_SID=db01
    export ORACLE_SID

     

    However, I'm not sure that these variables are actually being taken into account by Apache because when I restart the server, here is what I can read in the log file

    # cat /var/log/httpd/error_log
    [Wed Apr 03 20:37:27 2013] [notice] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
    [Wed Apr 03 20:37:27 2013] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
    [Wed Apr 03 20:37:27 2013] [notice] Digest: generating secret for digest authentication ...
    [Wed Apr 03 20:37:27 2013] [notice] Digest: done
    PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/oci8.so' - libclntsh.so.11.1: cannot open shared object file: No such file or directory in Unknown on line 0
    [Wed Apr 03 20:37:27 2013] [warn] mod_wsgi: Compiled for Python/2.7.2.
    [Wed Apr 03 20:37:27 2013] [warn] mod_wsgi: Runtime using Python/2.7.3.
    [Wed Apr 03 20:37:27 2013] [notice] Apache/2.2.23 (Unix) DAV/2 PHP/5.4.13 mod_wsgi/3.3 Python/2.7.3 configured -- resuming normal operations
    #

    Looking for the missing file

    # locate libclntsh.so.11.1
    /home/oracle/oracle_extract_folder/database/stage/ext/lib/libclntsh.so.11.1
    /u01/app/oracle/product/11.2.0/db_1/inventory/Scripts/ext/lib/libclntsh.so.11.1
    /u01/app/oracle/product/11.2.0/db_1/inventory/backup/2012-06-25_12-08-41PM/Scripts/ext/lib/libclntsh.so.11.1
    /u01/app/oracle/product/11.2.0/db_1/lib/libclntsh.so.11.1

    Yet /u01/app/oracle/product/11.2.0/db_1/lib/ is exactly what I specified as LD_LIBRARY_PATH in /etc/sysconfig/httpd. So it seems that (maybe) apache doesn't see my environment variables.

     

     

    Load up a page via your webserver that outputs phpinfo() and then look for the Loaded Configuration File entry.

    I proceeded accordingly as you said when I see the output of the phpinfo() in my browser

    I have

     

    Loaded Configuration File = /etc/php.ini

     

    It's common that the webserver uses a different php.ini file than the CLI version of PHP

    Very interesting, I didn't even know that there are two different php.ini files

    However, it seems that on my system both of them point to the same file

     

    # php -i | grep Configuration
    
    Configuration File (php.ini) Path => /etc
    
    Loaded Configuration File => /etc/php.ini
    
    Configuration
    
    #
    

     

    I'm really confused !

     

     

    Regards,

    Dariyoosh

  3. Hello everybody,

     

     

    I'm trying to setup a connection from PHP to an oracle database by using OCI8. According to the documentation, upon a successfull installation, I'm supposed to see some information about OCI8 in phpinfo().

     

    Problem: Nothing shows up in phpinfo about OCI8

     

    Just to see what would be the output I run the very same PHP test script in the article

     

    <?php
    
        $conn = oci_connect('myuser', 'mypassword', 'localhost/DB01');
    
        $stid = oci_parse($conn, 'select table_name from user_tables');
    
        oci_execute($stid);
    
        echo "<table>\n";
    
        while
    
            (
    
                (
    
                    $row =
    
                        oci_fetch_array
    
                        (
    
                            $stid, OCI_ASSOC+OCI_RETURN_NULLS
    
                        )
    
                )
    
                != false
    
            )
    
        {
    
            echo "<tr>\n";
    
            foreach ($row as $item)
    
            {
    
                echo "  <td>".
    
                    ($item !== null ? htmlentities($item, ENT_QUOTES) :
    
                        " ")."</td>\n";
    
            }
    
            echo "</tr>\n";
    
        }   
    
        echo "</table>\n";
    
    ?>
    

     

    And the output was

     

     

    Fatal error: Call to undefined function oci_connect() in /var/www/html/myscript.php on line ...
    

     

    Which shows that something serious is missing.

     

    As a result, I would like to ask you to kindly take a look to the below details about how I proceeded in order to setup OCI8 and to see where I made mistake(s)

     

     

    Here are some details about my working platform

     

    OS: Linux Fedora Core 17 (64 bits)
     
    DBMS: Oracle Enterprise Edition 11gR2 (11.2.0.1.0)
     
    PHP Version: 5.4.13
     
    Apache version: 2.2.23
    

     

     

    I installed OCI8 based on the following article (except that I already had both server and client installed on the same physical machine, therefore I didn't need to install/reinstall the instant client)

    http://www.oracle.com/technetwork/articles/technote-php-instant-084410.html

     

    So being as ROOT I run the following

     

    # pecl install oci8
    

    Which gave me the following output

    # pecl install oci8
    downloading oci8-1.4.9.tgz ...
    Starting to download oci8-1.4.9.tgz (169,255 bytes)
    .....................................done: 169,255 bytes
    10 source files, building
    running: phpize
    Configuring for:
    PHP Api Version:         20100412
    Zend Module Api No:      20100525
    Zend Extension Api No:   220100525
    Please provide the path to the ORACLE_HOME directory. Use 'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] : /u01/app/oracle/product/11.2.0/db_1
    building in /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9
    running: /var/tmp/oci8/configure --with-oci8=/u01/app/oracle/product/11.2.0/db_1
    checking for grep that handles long lines and -e... /usr/bin/grep
    checking for egrep... /usr/bin/grep -E
    checking for a sed that does not truncate output... /usr/bin/sed
    checking for cc... cc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether cc accepts -g... yes
    checking for cc option to accept ISO C89... none needed
    checking how to run the C preprocessor... cc -E
    checking for icc... no
    checking for suncc... no
    checking whether cc understands -c and -o together... yes
    checking for system library directory... lib
    checking if compiler supports -R... no
    checking if compiler supports -Wl,-rpath,... yes
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for PHP prefix... /usr
    checking for PHP includes... -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib
    checking for PHP extension directory... /usr/lib64/php/modules
    checking for PHP installed headers prefix... /usr/include/php
    checking if debug is enabled... no
    checking if zts is enabled... no
    checking for re2c... no
    configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
    checking for gawk... gawk
    checking for Oracle Database OCI8 support... yes, shared
    checking PHP version... 5.4.13, ok
    checking for ANSI C header files... yes
    checking for sys/types.h... yes
    checking for sys/stat.h... yes
    checking for stdlib.h... yes
    checking for string.h... yes
    checking for memory.h... yes
    checking for strings.h... yes
    checking for inttypes.h... yes
    checking for stdint.h... yes
    checking for unistd.h... yes
    checking size of long int... 8
    checking checking if we're on a 64-bit platform... yes
    checking Oracle ORACLE_HOME install directory... /u01/app/oracle/product/11.2.0/db_1
    checking ORACLE_HOME library validity... lib
    checking Oracle library version compatibility... 11.1
    checking how to print strings... printf
    checking for a sed that does not truncate output... (cached) /usr/bin/sed
    checking for fgrep... /usr/bin/grep -F
    checking for ld used by cc... /usr/bin/ld
    checking if the linker (/usr/bin/ld) is GNU ld... yes
    checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
    checking the name lister (/usr/bin/nm - B) interface... BSD nm
    checking whether ln -s works... yes
    checking the maximum length of command line arguments... 1572864
    checking whether the shell understands some XSI constructs... yes
    checking whether the shell understands "+="... yes
    checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
    checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
    checking for /usr/bin/ld option to reload object files... -r
    checking for objdump... objdump
    checking how to recognize dependent libraries... pass_all
    checking for dlltool... no
    checking how to associate runtime and link libraries... printf %s\n
    checking for ar... ar
    checking for archiver @FILE support... @
    checking for strip... strip
    checking for ranlib... ranlib
    checking for gawk... (cached) gawk
    checking command to parse /usr/bin/nm -B output from cc object... ok
    checking for sysroot... no
    checking for mt... no
    checking if : is a manifest tool... no
    checking for dlfcn.h... yes
    checking for objdir... .libs
    checking if cc supports -fno-rtti -fno-exceptions... no
    checking for cc option to produce PIC... -fPIC -DPIC
    checking if cc PIC flag -fPIC -DPIC works... yes
    checking if cc static flag -static works... no
    checking if cc supports -c -o file.o... yes
    checking if cc supports -c -o file.o... (cached) yes
    checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
    checking whether -lc should be explicitly linked in... no
    checking dynamic linker characteristics... GNU/Linux ld.so
    checking how to hardcode library paths into programs... immediate
    checking whether stripping libraries is possible... yes
    checking if libtool supports shared libraries... yes
    checking whether to build shared libraries... yes
    checking whether to build static libraries... no
    configure: creating ./config.status
    config.status: creating config.h
    config.status: executing libtool commands
    running: make
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8.c -o oci8.lo
    libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8.c  -fPIC -DPIC -o .libs/oci8.o
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_lob.c -o oci8_lob.lo
    libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_lob.c  -fPIC -DPIC -o .libs/oci8_lob.o
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_statement.c -o oci8_statement.lo
    libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_statement.c  -fPIC -DPIC -o .libs/oci8_statement.o
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_collection.c -o oci8_collection.lo
    libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_collection.c  -fPIC -DPIC -o .libs/oci8_collection.o
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=compile cc  -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -c /var/tmp/oci8/oci8_interface.c -o oci8_interface.lo
    libtool: compile:  cc -I. -I/var/tmp/oci8 -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo -DHAVE_CONFIG_H -g -O2 -c /var/tmp/oci8/oci8_interface.c  -fPIC -DPIC -o .libs/oci8_interface.o
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=link cc -DPHP_ATOM_INC -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/include -I/var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/main -I/var/tmp/oci8 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/u01/app/oracle/product/11.2.0/db_1/rdbms/public -I/u01/app/oracle/product/11.2.0/db_1/rdbms/demo  -DHAVE_CONFIG_H  -g -O2   -o oci8.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules  oci8.lo oci8_lob.lo oci8_statement.lo oci8_collection.lo oci8_interface.lo -Wl,-rpath,/u01/app/oracle/product/11.2.0/db_1/lib -L/u01/app/oracle/product/11.2.0/db_1/lib -lclntsh
    libtool: link: cc -shared  -fPIC -DPIC  .libs/oci8.o .libs/oci8_lob.o .libs/oci8_statement.o .libs/oci8_collection.o .libs/oci8_interface.o   -L/u01/app/oracle/product/11.2.0/db_1/lib -lclntsh  -O2 -Wl,-rpath -Wl,/u01/app/oracle/product/11.2.0/db_1/lib   -Wl,-soname -Wl,oci8.so -o .libs/oci8.so
    libtool: link: ( cd ".libs" && rm -f "oci8.la" && ln -s "../oci8.la" "oci8.la" )
    /bin/sh /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/libtool --mode=install cp ./oci8.la /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules
    libtool: install: cp ./.libs/oci8.so /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules/oci8.so
    libtool: install: cp ./.libs/oci8.lai /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules/oci8.la
    libtool: finish: PATH="/usr/bin:/usr/lib64/qt-3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/dariyoosh/.local/bin:/home/dariyoosh/bin:/usr/local/jdk1.7.0_17/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/u01/app/oracle/product/11.2.0/db_1/bin:/usr/local/texlive/2011/bin/x86_64-linux:/opt/libreoffice4.0/program/soffice:/usr/local/apache-tomcat-7.0.37/bin:/sbin" ldconfig -n /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules
    ----------------------------------------------------------------------
    Libraries have been installed in:
       /var/tmp/pear-build-dariyooshszFGdb/oci8-1.4.9/modules

    If you ever happen to want to link against installed libraries
    in a given directory, LIBDIR, you must either use libtool, and
    specify the full pathname of the library, or use the `-LLIBDIR'
    flag during linking and do at least one of the following:
       - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
         during execution
       - add LIBDIR to the `LD_RUN_PATH' environment variable
         during linking
       - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
       - have your system administrator add LIBDIR to `/etc/ld.so.conf'

    See any operating system documentation about shared libraries for
    more information, such as the ld(1) and ld.so( 8) manual pages.
    ----------------------------------------------------------------------

    Build complete.
    Don't forget to run 'make test'.

    running: make INSTALL_ROOT="/var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9" install
    Installing shared extensions:     /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr/lib64/php/modules/
    running: find "/var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9" | xargs ls -dils
    3164435   4 drwxr-xr-x. 3 root root   4096 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9
    3164467   4 drwxr-xr-x. 3 root root   4096 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr
    3164469   4 drwxr-xr-x. 3 root root   4096 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr/lib64
    3164470   4 drwxr-xr-x. 3 root root   4096 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr/lib64/php
    3164474   4 drwxr-xr-x. 2 root root   4096 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr/lib64/php/modules
    3164466 596 -rwxr-xr-x. 1 root root 606873 Apr  3 12:00 /var/tmp/pear-build-dariyooshszFGdb/install-oci8-1.4.9/usr/lib64/php/modules/oci8.so

    Build process completed successfully
    Installing '/usr/lib64/php/modules/oci8.so'
    install ok: channel://pecl.php.net/oci8-1.4.9
    configuration option "php_ini" is not set to php.ini location
    You should add "extension=oci8.so" to php.ini

    #

     

    After that I added to php.ini

    ;;;;;;;;;;;;;;;;;;;;;;
    ; Dynamic Extensions ;
    ;;;;;;;;;;;;;;;;;;;;;;

    ; If you wish to have an extension loaded automatically, use the following
    ; syntax:

    ;
    ;   extension=modulename.extension
    ;
    ; For example, on Windows:
    ;
    ;   extension=msql.dll
    ;
    ; ... or under UNIX:
    ;
    ;   extension=msql.so
    extension=
    "oci8.so"
    ;
    ; ... or with a path:
    ;
    ;   extension=/path/to/extension/msql.so

                                .

                                .

                                .

    extension_dir="/usr/lib64/php/modules"

     

     

    I also run the following command in the terminal

     

    # php --ri oci8

    oci8

    OCI8 Support => enabled
    Version => 1.4.9

    Revision => $Id: e2241cffb72c940cb2ca267b7a6a0ce436de7e5e $
    Active Persistent Connections => 0
    Active Connections => 0
    Oracle Run-time Client Library Version => 11.2.0.1.0
    Oracle Version => 11.2
    Compile-time ORACLE_HOME => /u01/app/oracle/product/11.2.0/db_1
    Libraries Used => -Wl,-rpath,/u01/app/oracle/product/11.2.0/db_1/lib -L/u01/app/oracle/product/11.2.0/db_1/lib  -lclntsh

    Temporary Lob support => enabled
    Collections support => enabled

    Directive => Local Value => Master Value
    oci8.max_persistent => -1 => -1
    oci8.persistent_timeout => -1 => -1
    oci8.ping_interval => 60 => 60
    oci8.privileged_connect => Off => Off
    oci8.statement_cache_size => 20 => 20
    oci8.default_prefetch => 100 => 100
    oci8.old_oci_close_semantics => Off => Off
    oci8.connection_class => no value => no value
    oci8.events => Off => Off
    [root@localhost ~]#

     

    So looking at the above bold output, I think we can say that there is however some link between the installed oci and my oracle server.

     

    Also, I added to the /etc/sysconfig/httpd configuration file the following environment variables which had already been defined in ~/.bash_profile

     

    # Configuration file for the httpd service.

    #
    # Note: With previous versions of httpd, the MPM could be changed by
    # editing an "HTTPD" variable here.  With the current version, that
    # variable is now ignored.  A particular systemd service must be
    # chosen corresponding to the desired MPM:
    #
    #   httpd.service         => prefork MPM
    #   httpd-worker.service  => worker MPM
    #   httpd-event.service   => event MPM
    #
    # Use systemctl to stop/start between MPMs, and to disable/enable
    # whichever service is required to start at boot time.
    #

    #
    # To pass additional options (for instance, -D definitions) to the
    # httpd binary at startup, set OPTIONS here.
    #
    #OPTIONS=

    #
    # This setting ensures the httpd process is started in the "C"
    # locale by default:
    #
    LANG=C

     


    PassEnv ORACLE_BASE
    PassEnv ORACLE_HOME
    PassEnv LD_LIBRARY_PATH64
    PassEnv LD_LIBRARY_PATH
    PassEnv TNS_ADMIN
    PassEnv NLS_LANG
    PassEnv ORACLE_SID

     

    Once the variables were defined I restarted the httpd

     

     

    service httpd restart
    

     

    Yet, the same problem, no oci8 in phpinfo()

     

    Could someone kindly make some clarification?

     

     

    Thanks in advance,

     

    Dariyoosh

  4. . . .Yes, passing an associative array would be the only way you could require that the names a function uses internally matches what a user passes into it.

    Hello there,

     

    Thank you very much for this nice and clear description. Just one more question (as I'm newbie :)) which method among the following is more common and is considered to be a good style of programming? (so that I follow it in the future)

     

    1 - Simply call the function (according to the position of the parameters) by directly providing the value

    2 - Call the function by writing

    functionName(paramName1 = value1, paramName2=value2, . . .)
    

    Although that according to what you said, PHP takes into account only the position (just to make the code more explicit for the reader)

    3 - using an associative array

     

    Thanks a lot,

     

    Regards,

    Dariyoosh

  5. Dear all,

     

    I have a question about function call in PHP and I would appreciate if you could kindly make some clarification. Generally, I prefer to call my functions by name, that is, instead of writing

    functionName(paramValue, paramValue, . . .)
    

    I prefer to provide the name of the formal parameters as they were specified in the function prototype.

    functionName(param1Name=paramValue, param2Name=paramValue, . . .)
    

    Well, maybe it's just a matter of personal taste, but It seems to me more elegant and in particular for someone who reads my code might be more clear and easier to understand what I provide exactly in terms of parameters while calling the function. And this could be even more helpful, particularly if the function includes so many arguments among them several with default values.

     

    Yet, I've just found (I'm Newbie :)) that PHP, actually doesn't care about the fact that the name of the effective parameters are different of those of formal parameters. Consider the following example

     

    function myFunction($param1, $param2)
    {
        echo "param1 = " . $param1 . "<br>";
        echo "param2 = " . $param2 . "<br>";
    }
    
    myfunction
    (
        $param1=300, 
        $param2="id-01001GGKK"
    );
    

    As you can see in this example the name of the effective parameters in the function call correspond to those specified in function prototype, resectively, param1 and param2.

    Yet, I tested successfully the following

    myfunction
    (
        $size=120, 
        $code="id-010012F"
    );
    

    Although the name of the parameters were completely different, again the function was executed successfully without any problem.

     

    Is that normal?

     

    In addition, the only way that I found to enforce the parameters names was to use an associative array including the list of parameters. Something like this:

     

    function myFunction($paramArray)
    {
        if (isset($paramArray["param1"]) AND
            isset($paramArray["param2"]))
        {
            echo "param1 = " . $paramArray["param1"] . "<br>";
            echo "param2 = " . $paramArray["param2"] . "<br>";
        }
        else
            die("Bad argument list");
    }
    

    Yet, it's not clear. I would like that each parameter name be visible.

     

    So, I would like to ask, is there any other way to enforce the effective parameter names to be the same as those specified in the function prototype?

     

    One other reason I ask this question is that until now, whenever I wanted to call a built-in PHP function, I used to check its documentation in order to first understand its functionality and second to view in detail its parameter list, formal parameter names to use them in my code. And I was thinking that I was doing fine and PHP takes them into account!! :(

     

    Thanks in advance,

     

     

    Regards,

    Dariyoosh

  6. Thanks, from the link you provided I conclude that it is moderated and notes become part of the documentation

     

    . . .

    Please note that periodically the developers go through the notes and may incorporate information from them into the documentation. This means that any note submitted here becomes the property of the PHP Documentation Group and will be available under the same license as the documentation.

    . . .

     

    Thanks for the reply

     

    Regards,

    Dariyoosh

  7. Hi,

     

     

    What I'm going to ask may seem to many among you a very trivial/strange question. :)

    Actually I'm a beginner in PHP and obviously I need to read regularly the online documentation
    for different topics related to PHP (in particular functions).

     

    Whenever I check the documentation for a given subject, let's say a function, I can read
    the official presentation with examples, but then, at the bottom of the page I often see many
    people who have written their comments. Sometimes, these comments seem to me really
    interesting and helpful.

     

    Yet, I would like to ask, are these moderated and approved comments? I mean, do they
    reflect the PHP official documentation point of view? and therefore the suggested solutions could safely
    be used on my projects? or it's just simply personal opinions based on personal experience?

     

    Thanks in advance,

     

    Regards,

    Dariyoosh

  8. Hello everyone

     

     

    OS: Fedora Core 17 (x86_64)

    Browser: Firefox 18.0

    PHP version: 5.4.11

    Apache version: 2.2.22

     

     

    I would like to know whether it is possible to print different kinds of PHP errors (at least parsing errors) in the browser screen. for example

    <?php
    myVariable = 12
    ?>
    

    This should give a syntax/parse error because there is not $ before the variable name nor the ";" at the end of the statement.

     

    I modified the file /etc/php.ini by removing comments for the two following options:

    . . .

    display_errors=On

    ; Default Value: On

    ; Development Value: On

    ; Production Value: Off

     

    ; display_startup_errors

    ; Default Value: Off

    ; Development Value: On

    ; Production Value: Off

     

    error_reporting=E_ALL

    ; Default Value: E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED

    ; Development Value: E_ALL

    ; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT

    . . .

    Then I restarted the apache service

    # service httpd restart
    

     

    Yet, I don't see any change, and whenever there is an error, I just have a blank page in the browser.

     

    Any idea? What are the further actions to be taken in order to print errors and warnings on the screen? (Of course, I want to do this only for development/training purpose, here we are not talking about a production environment)

     

     

    Thanks in advance,

     

    Regards,

    Dariyoosh

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.