Click to See Complete Forum and Search --> : Need help in compiling php with oci8 extension
angelina
08-09-2006, 09:49 AM
Hey,
I am totally new to all this,i needed to know how to compile oci8 on my server which has php4.Please help! :)
tsinka
08-09-2006, 12:32 PM
Hi,
is oracle installed on that server (at least the oracle client including the libraries and include files) ? Are the environment variables set (ORACLE_HOME, NLS_LANG, ....) ? Which OS/version is installed ?
Thomas
angelina
08-09-2006, 02:42 PM
yes we have oracle 10g and windows xp and i am trying to install invision power board on it.
tsinka
08-09-2006, 03:24 PM
So the server is running Windows XP ? In that case you don't need to recompile anything. The php_oci8 extension already comes with the zip package. If you installed php with the installer then the php_oci8.dll file might be missing. In that case download the zip package (which contains that extension), copy php_oci8.dll to the extension directory and enable the extension in php.ini.
Thomas
angelina
08-09-2006, 03:59 PM
how to acheive all this??
tsinka
08-09-2006, 04:04 PM
First download the zip package that matches your php version from the releases (http://www.php.net/releases.php) page and unpack the file. The directory ext contains a file named php_oci8.dll. Copy that file to the ext directory of your already working php installation. Then modify the php.ini file and add the line
extension=php_oci8.dll
to the extension section. If you can't find php.ini then create a little phpinfo() script and check the top of the output. One row of the table contains the full path to php.ini.
Edit: Then restart the web server.
angelina
08-09-2006, 04:07 PM
do you know where to check phpinfo()
angelina
08-09-2006, 04:15 PM
i have not done any installations so far , sorry about that!
tsinka
08-09-2006, 04:16 PM
Create a PHP script that just contains
<?PHP
phpinfo();
?>
The output contains information about the php configuration.
Thomas
angelina
08-09-2006, 04:18 PM
can you please take a look at this and tell me if you can make out if php on my server is enabled with oci8??http://hunstem.uhd.edu/phpinfo.php
tsinka
08-09-2006, 04:35 PM
No, that php version doesn't support the oci8 extension. But this is a redhat linux server. It is possible to enable the oci8 extension without rebuilding PHP from scratch. The windows stuff doesn't help in this case.
Luckily enough the Environment section near the end of the page shows that oracle 10g is installed and that the most important environment variables are all set.
If there's Redhat Enterprise Linux installed on the server then a php-oci8 rpm package might be available that you can install (easy way).
The other way is to compile the oci8 extension yourself:
The steps in short (assuming that gcc, make and some other development tools are installed):
1. download the php-4.3.9.tar.gz file from the releases page I posted above.
2. copy that file somewhere onto your server and extract the file (tar xzf php-4.3.9.tar.gz)
3. that will create a directory named php-4.3.9
Now some commands:
1. cd php-4.3.9/ext
2. /usr/bin/phpize
3. ./configure --with-oci8 --with-php-config=/usr/bin/php-config
4. make
5. make install
You can add the ORACLE_HOME directory to the --with-oci8 switch in step 3 if something fails. But in this case it should work without the path since the environment variables are set.
I'm not sure about the next step completely but I think there are two solutions to enable the extension according to the output of phpinfo:
a) add the line extension=oci8.so at the end of /etc/php.ini
b) create a new file /etc/php.d/oci8.ini that just contains the line extension=oci8.so
Then restart apache.
Thomas
angelina
08-09-2006, 04:46 PM
can i copy the php-4.3.9 folder which i extracted onto /var/www/html/
tsinka
08-09-2006, 04:54 PM
You can do that but I wonder if that is a good idea since this seems to be a public html folder.
I'd suggest to copy/move the extracted folder to e.g. /usr/src or a home directory and to compile stuff there.
angelina
08-09-2006, 05:00 PM
cd php-4.3.9/ext when i cd there what exactly do i do??
tsinka
08-09-2006, 05:03 PM
Ooops, my fault. I missed one directory. If you're in ext then cd to oci8 (php-4.3.9/ext/oci8).
Then execute the commands 2. to 5.
Thomas
angelina
08-09-2006, 05:05 PM
o.k. i have put the folder php-4.3.9 in /usr/src ---------is this o.k??
tsinka
08-09-2006, 05:07 PM
Yes, that's ok. It doesn't really matter where that folder is. You can delete it after compiling and installing the extension.
angelina
08-09-2006, 05:08 PM
i owe you something big for this!!really !!cos i don't know anything!!our System admin sucks,that is why i want to do it on my own!!
angelina
08-09-2006, 05:13 PM
i cannot find oci8 inside ext??
angelina
08-09-2006, 05:14 PM
sorry i found it ,really sorry??
angelina
08-09-2006, 05:21 PM
o.k. not my sftp looks like[root@hunstem oci8]#--------what do i do for this step:/usr/bin/phpize
tsinka
08-09-2006, 05:29 PM
Those steps are commands so just type that commands and then hit enter to execute each of the commands. Post any errors you may get.
Thomas
angelina
08-09-2006, 05:31 PM
when i type /usr/bin/phpize in front of oci8]# it says no such file or directory?
angelina
08-09-2006, 05:33 PM
i need to give u something for your time!!you r so helpful and patient!
tsinka
08-09-2006, 05:43 PM
Ok, I was assuming that phpize and php-config are in /usr/bin since according to the output of phpinfo the prefix of the php installation is /usr.
execute the following command:
find / -name phpize
If that doesn't return anything then the php-devel package may be missing.
Execute the following command to get the OS version and post the results if the find command doesn't return anything:
cat /etc/redhat-release
Thomas
tsinka
08-09-2006, 05:45 PM
I forgot one command. Post the results of the command
rpm --query php
angelina
08-09-2006, 05:51 PM
find / -name phpize
cat /etc/redhat-release
both of the above commands reture no such file or directory
i executed these commands at oci8]#
for this command rpm --query php
it returned php4.3.9-3.12
tsinka
08-09-2006, 06:08 PM
Does the command
find --help
print anything ?
Besides that execute the command
ls -l /etc/redhat*
and post the results.
angelina
08-09-2006, 06:09 PM
i'm confused if you are still talking to me or not??
angelina
08-09-2006, 06:13 PM
it prints a lot of things!
angelina
08-09-2006, 06:16 PM
ls -l /etc/redhat* gives me invalid option
but just ls-l at oci8 gives all these:
config.m4
CREDITS
oci8.c
oci8.dsp
php_oci8.h
tests
tsinka
08-09-2006, 06:24 PM
I know that I'm asking a lot of questions but they're neccessary for me to get an idea about the system setup.
The problem is that you need the phpize and php-config executables in order to compile the oci8 extension successfully. Those commands are part of the php-devel package so I need to know which redhat version is installed and if the php-devel package is installed.
Let's do it the other way:
I now know that the php-4.3.9-3.12 packages are installed. Execute the command
rpm --query php-devel
If that command doesn't return anything then you need to install the php-devel package.
Depending on the redhat version installed the release file can have another name. Execute the following command:
ls -l /etc/*release
to get the name of the release file. Then use the cat command to print the contents of the release file returned by the ls command.
I hope I didn't explain things too complicated.
angelina
08-09-2006, 06:31 PM
no, you are awesome ,please take as much time as you want and also ask as many questions as you would like?
but all of the commands are giving me "not valid option"
so i am wondering if i am typing them wrong??i will try again??
angelina
08-09-2006, 06:32 PM
i have also sent a mail to sa asking what is the redhat version and the devel package but i am pretty sure i will not get a reply anytime soon??sorry about our IT dept sucks like crazy!!
angelina
08-09-2006, 06:40 PM
i am executing at oci8?? is the directory o.k.??
tsinka
08-09-2006, 06:42 PM
Ok,
try to cd to the /etc directory and to execute two ls commands:
cd /etc
ls -l *release
ls -l *version
Can you copy'n'paste the commands from my posts to the command line (do use use a ssh client like e.g. putty to access the server) ?
angelina
08-09-2006, 06:51 PM
o.k. i know devel is not installed because rpm command returned package php-devel not installed
and for ls -l /etc/*release
it returned 1 root root feb 15 16.40 /etc/redhat-release
angelina
08-09-2006, 06:55 PM
for ls -l /etc/*release
it returned 1 root root 56 feb 15 16.40 /etc/redhat-release
angelina
08-09-2006, 06:56 PM
i only know how to use ssh client
tsinka
08-09-2006, 07:27 PM
Ok,
the command
cat /etc/redhat-release
should give you the redhat version info. Post that info and I'll post a url where you can download the devel package.
Thomas
angelina
08-10-2006, 09:34 AM
redhat version installed is RedHat 4EL 2.6.9-34.0.1.ELsmp
php-ldap-4.3.9-3.12
php-pear-4.3.9-3.12
php-odbc-4.3.9-3.12
php-mysql-4.3.9-3.12
php-4.3.9-3.12
php-devel is not installed.
i hope this gives you some idea of what cofigurations are there on my server,please do respond when you get this mail!
Thanks a lot !!
tsinka
08-10-2006, 01:05 PM
Ok,
please download and install the php-devel-4.3.9-3.12 rpm package at e.g. http://centos.arcticnetwork.ca/4.3/updates/i386/RPMS/ or from the RHEL4 update site.
you can install that package with the command rpm -Uvh <packagefile> like .e.g
rpm -Uvh php-devel-4.3.9-3.12.i386.rpm
The package version needs to match the version of the other installed php packages (....-4.3.9-3.12).
Then check if the files phpize and php-config exist in /usr/bin
Thomas
angelina
08-10-2006, 01:11 PM
good that you replied,i was hoping you will get back to me!
hey i have installed devel package please take a look at http://hunstem.uhd.edu/phpinfo.php one more time and tell me if oci8 is enabled?Please!
tsinka
08-10-2006, 01:18 PM
No, it isn't installed but that's what I expected. Installing the rpm package was the first step. Please check if the files phpize and php-config exist by executing the two commands
/usr/bin/phpize --version
/usr/bin/php-config --version
Both commands should print version information. If you get the version info then cd to the ext/oci8 directory and follow the steps I posted to compile and install the extension.
Thomas
angelina
08-10-2006, 01:29 PM
for the first command it returned
cannot find config.m4
for the second command it returned
4.2.3
tsinka
08-10-2006, 01:33 PM
Ok,
phpize doesn't support the --version switch (nothing to worry about).
But I wonder why php-config prints 4.2.3
What does the command
rpm --query php-devel
print ?
angelina
08-10-2006, 01:36 PM
phpize and phpconfig exist in /usr/bin
angelina
08-10-2006, 01:37 PM
rpm --query php-devel returns
php-devel-4.3.2-10
angelina
08-10-2006, 01:39 PM
i am executing all these commands from the root@hunstem ----is it o.k.??
tsinka
08-10-2006, 01:50 PM
php-devel-4.3.2-10 is the wrong version. Remove that package with the command
rpm -e php-devel-4.3.2-10
and install php-devel-4.3.9-3.12.i386.rpm
angelina
08-10-2006, 02:10 PM
O.k new one is installed.how do i check if this is the right version!!
Thanks a million Thomas, i need to give you something for this!
tsinka
08-10-2006, 02:13 PM
With the command I already posted:
/usr/bin/php-config --version
angelina
08-10-2006, 02:15 PM
this command returned 4.3.9
angelina
08-10-2006, 02:18 PM
does the version look o.k.now , what do i do next??
tsinka
08-10-2006, 02:20 PM
Ok,
now's the time to compile the extension :)
first of all make sure that the command
echo $ORACLE_HOME
returns a path.
Then cd to the ext/oci8 directory and execute the following four commands:
/usr/bin/phpize
./configure --with-oci8 --with-php-config=/usr/bin/php-config
make
make install
Post any error messages you get.
angelina
08-10-2006, 02:23 PM
echo command returned
/opt/oracle/oracle/product/10.2.0/db_1
does this look good??tell me before i cd to oci8 please!
angelina
08-10-2006, 02:32 PM
/usr/bin/phpize
i only executed this and it returned no errors but a lot of data and the last few lines are like this :
configuring for :
php api version: 20020918
ZEND api no: 20020429
ZEND api extension no: 20021010
please tell me this is o.k.
angelina
08-10-2006, 02:35 PM
./configure --with-oci8 --with-php-config=/usr/bin/php-config
this returned a hell lot of data but the last line is :
config.status: creating config.h
angelina
08-10-2006, 02:37 PM
make returned
build complete
i hope these are good signs!!??
angelina
08-10-2006, 02:39 PM
make install returned
installing shared extensions: /usr/lib/php4
please tell me something good also what did i just do ??cos i was praying !!
angelina
08-10-2006, 02:43 PM
Thomas where r u??????please say something!
tsinka
08-10-2006, 02:47 PM
Looks very good. Now edit /etc/php.ini and add the following line at the end of the file:
extension=oci8.so
Then restart apache (the final step).
angelina
08-10-2006, 02:53 PM
problem problem there is no phpini in folder etc
now what??to do??
angelina
08-10-2006, 02:54 PM
etc is empty?? how come?? don't tell me i messed up ??i mean tell me if i messed up somewhere??
angelina
08-10-2006, 03:02 PM
Thomas where r u??????please say something!
angelina
08-10-2006, 03:04 PM
Also tell me what you like??????????;):p
tsinka
08-10-2006, 03:07 PM
Execute the commands
cd /etc
ls -l php.ini
angelina
08-10-2006, 03:10 PM
cd /etc returned
you have new mail
ls -l php.ini returned
root root 38450 apr 12. 03 :14php.ini
tsinka
08-10-2006, 03:11 PM
Ok,
everything seems to be ok with the /etc directory and php.ini is there. Now edit php.ini and add the line
extension=oci8.so
Then restart apache
angelina
08-10-2006, 03:13 PM
no,i cannot see anything in the /etc folder how do i edit it??please tell me ??
tsinka
08-10-2006, 03:17 PM
Execute the following commands to add that line:
cp /etc/php.ini /etc/php.ini.bak
echo "extension=oci8.so" >> /etc/php.ini
Then restart apache.
angelina
08-10-2006, 03:19 PM
it worked ;) let me restart and get back to you!!!!!!
angelina
08-10-2006, 03:32 PM
o.k. i restarted the apache!!
can you make out if oci8 is enabled??????????(i guess this is the billion dollar question at this time)
tsinka
08-10-2006, 03:37 PM
Well done :)
The extension is enabled :)
Check the output of the phpinfo script. There should be an oci8 extension section.
Alternatively, create the following script:
if (extension_loaded('oci8')) {
echo 'The oci8 extension is enabled<br>';
if (function_exists('oci_connect')) {
echo 'The function oci_connect exists<br>';
}
} else {
echo 'The oci8 extension is not enabled<br>';
}
Thomas
angelina
08-10-2006, 03:48 PM
o.k. i created the php file ??where do i place it ??i also see the oci8 in the phpinfo.php
Please check your personal message and please reply to that too!!please!!Thomas!
tsinka
08-10-2006, 03:51 PM
Put that script into the directory where the phpinfo script is so you can request it with your browser.
Ooops, I just noticed the bunch of PMs you sent me. Sorry, I didn't check my PMs for some days.
angelina
08-10-2006, 03:55 PM
what do i name the script as ??i know u r thinking right now that i am an idiot!!!!but i really don't know all this web stuff and terminologies!
tsinka
08-10-2006, 04:04 PM
You can name the script e.g. checkoci.php or something like that. The most important thing is that the extension of the file has to be .php because that makes apache to feed the php module with the file in this case (that depends on the apache/php setup).
Do you use notepad as editor ? In that case make sure that notepad saves the file with an extension of .php instead of .php.txt because .txt is the default extension notepad uses.
You can make sure that notepad saves the file correctly by enclosing the filename in double quotes in the save dialog, like "checkoci.php"
angelina
08-10-2006, 04:06 PM
please reply to my pm??
angelina
08-10-2006, 04:13 PM
do you have an icq account??
PHP Builder
Copyright WebMediaBrands Inc. All Rights Reserved.