Здравствуйте уважаемые!
Никак не могу решить следующий затык:Есть скрипт на perl который обращается к БД (простой селект)
Если его запускать из консоли, то он нормально отрабатывает и получает данные.
Если пытаюсь запускать из Апача, то он вываливает в лог Апача:
/var/www/localhos: relocation error: /usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so: symbol dbopen, version FLSSL_1 not defined in file libsybdb.so with link time referenceПричём "/var/www/localhos:" не хватает t и это не моя опечатка. Косяк конфига? какого? Апач перерыл...
Просто мозг сломал, что это может быть?..
На всякий случай:#!/usr/bin/perl
print "Content-type: text/html\n\n";
use Sybase::DBlib;
print 'test';
#exit();
$dbh = Sybase::DBlib->new("login", "passwd", "1.1.1.1");$status = $dbh->dbuse("db_name");
$dbh->dbcmd("EXEC xp_name 2,4596605,1,0,0,'ss',1,10");
$dbh->dbsqlexec;
while($dbh->dbresults != NO_MORE_RESULTS) {
while(@data = $dbh->dbnextrow) {
print "@data\n";
}
}
#$dbh->disconnect;
$dbh->dbclose;Если снять комментарий с exit, то он выведет в браузер test и умрет. Иначе умирает ничего не выведя.
UPDATE:
если попробовать запустить этот скрипт из под РНР
exec('script.pl');
получаю следующее:
/usr/bin/perl: relocation error: /usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so: symbol dbopen, version FLSSL_1 not defined in file libsybdb.so with link time referenceТоже самое получаю если из консоли пишу sudo ./script.pl
/usr/bin/perl: relocation error: /usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so: symbol dbopen, version FLSSL_1 not defined in file libsybdb.so with link time reference
Что с ним может быть???
Что мне приходит на ум - проблемы с правами. Только вот где и какими?..
UPDATE:
куски stracestrace ./script.pl
open("/usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 Y\0\0004\0\0\0"..., 512) = 512
fstat64(8, {st_mode=S_IFREG|0555, st_size=145879, ...}) = 0
mmap2(NULL, 128488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0xb7ba2000
mmap2(0xb7bc0000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x1e) = 0xb7bc0000
close(8) = 0
open("/opt/sybase/DataAccess/ODBC/lib/libsybdb.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/opt/sybase/OCS-15_0/lib/libsybdb.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0D\321\0\0004\0\0\0"..., 512) = 512
fstat64(8, {st_mode=S_IFREG|0755, st_size=791527, ...}) = 0
mmap2(NULL, 679456, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0xb7afc000
mmap2(0xb7b8f000, 57344, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x93) = 0xb7b8f000
mmap2(0xb7b9d000, 20000, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0xb7b9d000
close(8) = 0
open("/opt/sybase/DataAccess/ODBC/lib/libsybunic.so", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/opt/sybase/OCS-15_0/lib/libsybunic.so", O_RDONLY) = 8
read(8, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\\k\1\0004\0\0\0"..., 512) = 512
fstat64(8, {st_mode=S_IFREG|0755, st_size=652568, ...}) = 0
mmap2(NULL, 445984, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 8, 0) = 0xb7a8f000
mmap2(0xb7abb000, 266240, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 8, 0x2b) = 0xb7abb000
close(8) = 0
mprotect(0xb7bc0000, 4096, PROT_READ) = 0
stat64("/etc/perl/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/etc/perl/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfc4c560) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/Exporter/Heavy.pmc", 0xbfc4c64c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/Exporter/Heavy.pm", {st_mode=S_IFREG|0444, st_size=6397, ...}) = 0
open("/usr/lib/perl5/5.8.8/Exporter/Heavy.pm", O_RDONLY|O_LARGEFILE) = 8
ioctl(8, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfc4c3a8) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(8, 0, [0], SEEK_CUR) = 0
read(8, "package Exporter::Heavy;\n\nuse st"..., 4096) = 4096
read(8, "ols. Optimise the lookup by addi"..., 4096) = 2301
brk(0x8224000) = 0x8224000
read(8, "", 4096) = 0
close(8) = 0
read(6, "", 4096) = 0
close(6) = 0
open("/opt/sybase/interfaces", O_RDONLY) = 6
fstat64(6, {st_mode=S_IFREG|0644, st_size=493, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f84000
read(6, "\nBASIS\n\tmaster tcp ether delliri"..., 4096) = 493
read(6, "", 4096) = 0
open("/etc/resolv.conf", O_RDONLY) = 8
fstat64(8, {st_mode=S_IFREG|0644, st_size=105, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f83000
read(8, "# Generated by net-scripts for i"..., 4096) = 105
read(8, "", 4096) = 0
read(8, "", 4096) = 0
close(8) = 0
munmap(0xb7f83000, 4096) = 0
open("/opt/sybase/interfaces", O_RDONLY) = 8
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 10
setsockopt(10, SOL_SOCKET, SO_KEEPALIVE, [1], 4) = 0
setsockopt(10, SOL_SOCKET, SO_LINGER, {onoff=0, linger=0}, 8) = 0
fcntl64(10, F_GETFL) = 0x2 (flags O_RDWR)
fcntl64(10, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(10, {sa_family=AF_INET, sin_port=htons(5000), sin_addr=inet_addr("10.1.1.101")}, 16) = -1 EINPROGRESS (Operation now in progress)
select(11, NULL, [10], NULL, {1, 0}) = 0 (Timeout)
connect(10, {sa_family=AF_INET, sin_port=htons(5000), sin_addr=inet_addr("10.1.1.101")}, 16) = -1 EALREADY (Operation already in progress)
select(11, NULL, [10], NULL, {1, 0}) = 0 (Timeout)
connect(10, {sa_family=AF_INET, sin_port=htons(5000), sin_addr=inet_addr("10.1.1.101")}, 16) = -1 EALREADY (Operation already in progress)
select(11, NULL, [10], NULL, {1, 0}) = 1 (out [10], left {0, 144000})
connect(10, {sa_family=AF_INET, sin_port=htons(5000), sin_addr=inet_addr("10.1.1.101")}, 16) = 0
fcntl64(10, F_SETFL, O_RDWR) = 0
uname({sys="Linux", node="dellirium", ...}) = 0
write(10, "\2\0\2\0\0\0\0\0dellirium\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 512) = 512
write(10, "\2\1\0]\0\0\1\0\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0iso"..., 93) = 93
select(11, [10], NULL, NULL, {1, 0}) = 1 (in [10], left {0, 764000})
read(10, "\4\1\0\330\0\0\0\0", 8) = 8
select(11, [10], NULL, NULL, {1, 0}) = 1 (in [10], left {1, 0})
read(10, "\343\20\0\1\7kinomir\6master\2533\0E\26\0\0\2\0\'\0Ch"..., 208) = 208
brk(0x8245000) = 0x8245000
open("/opt/sybase/locales/us_english/iso_1/common.loc", O_RDONLY) = 11
read(11, "; comment character is a semicol"..., 512) = 512
read(11, " members of a list. \n\tescape=\\\t\t"..., 512) = 512
read(11, "tes.\\\n\tSybase, Inc. 6475 Christi"..., 512) = 512
read(11, "y of a US week. \n\n\t; The date fo"..., 512) = 512
read(11, "arts: \n\t; \n\t;\t1) The letter \"B\" "..., 512) = 512
read(11, "rency symbol when \n\t; converting"..., 512) = 168
read(11, "", 512) = 0
close(11) = 0
strace sudo ./script.plopen("/usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 Y\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0555, st_size=145879, ...}) = 0
mmap2(NULL, 128488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7da8000
mmap2(0xb7dc6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x1e) = 0xb7dc6000
close(4) = 0
open("/etc/ld.so.cache", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=26845, ...}) = 0
mmap2(NULL, 26845, PROT_READ, MAP_PRIVATE, 4, 0) = 0xb7f85000
close(4) = 0
open("/usr/lib/libsybdb.so", O_RDONLY) = 4
read(4, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0q\0\0004\0\0\0"..., 512) = 512
fstat64(4, {st_mode=S_IFREG|0755, st_size=262376, ...}) = 0
mmap2(NULL, 260516, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 4, 0) = 0xb7d68000
mmap2(0xb7da6000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 4, 0x3e) = 0xb7da6000
close(4) = 0
mprotect(0xb7dc6000, 4096, PROT_READ) = 0
munmap(0xb7f85000, 26845) = 0
open("/etc/locales.conf", O_RDONLY) = 4
fstat64(4, {st_mode=S_IFREG|0644, st_size=203, ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f8b000
read(4, "[default]\n\tdate format = %b %d %"..., 4096) = 203
read(4, "", 4096) = 0
close(4) = 0
munmap(0xb7f8b000, 4096) = 0
stat64("/etc/perl/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/etc/perl/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/5.8.8/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/vendor_perl/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/5.8.8/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/site_perl/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/i686-linux/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/i686-linux/Exporter/Heavy.pm", 0xbfb50d60) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/Exporter/Heavy.pmc", 0xbfb50e4c) = -1 ENOENT (No such file or directory)
stat64("/usr/lib/perl5/5.8.8/Exporter/Heavy.pm", {st_mode=S_IFREG|0444, st_size=6397, ...}) = 0
open("/usr/lib/perl5/5.8.8/Exporter/Heavy.pm", O_RDONLY|O_LARGEFILE) = 4
ioctl(4, SNDCTL_TMR_TIMEBASE or TCGETS, 0xbfb50ba8) = -1 ENOTTY (Inappropriate ioctl for device)
_llseek(4, 0, [0], SEEK_CUR) = 0
read(4, "package Exporter::Heavy;\n\nuse st"..., 4096) = 4096
read(4, "ols. Optimise the lookup by addi"..., 4096) = 2301
brk(0x8224000) = 0x8224000
read(4, "", 4096) = 0
close(4) = 0
read(3, "", 4096) = 0
close(3) = 0
writev(2, [{"/usr/bin/perl", 13}, {": ", 2}, {"relocation error", 16}, {": ", 2}, {"/usr/lib/perl5/site_perl/5.8.8/i"..., 68}, {": ", 2}, {"symbol dbopen, version FLSSL_1 n"..., 87}, {"", 0}, {"", 0}, {"\n", 1}], 10) = 191
exit_group(127) = ?
Ошибка скорее всего из-за несоответствия версий библиотек. Убедись что система синхронизирована, что ничего не ставилось в обход менеджера пакетов, при необходимости сделай апдейт системе. Если что-то ставил напрямую с CPAN, то убедись что все используемое тоже стоит из CPAN, то есть нет ситуации что один модуль поставлен из репозитария дистрибутива, а другой из CPAN, возможно стоит переустановить проблемные модули. Ну и наконец если работает в консоли и не работает в апаче, то возможно установлены разные версии одной библиотеки в разные каталоги перла и поиск происходит в разном порядке. Поищи все места где стоит libsybdb.so, попробуй некоторые из них временно перенести(Ну или менять @INC в скрипте, кстати стоит его вывести в обоих случаях и сравнить) дабы найти работающий вариант.
@INC из консоли:
/etc/perl
/usr/lib/perl5/vendor_perl/5.8.8/i686-linux
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/site_perl/5.8.8/i686-linux
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib/perl5/5.8.8/i686-linux
/usr/lib/perl5/5.8.8
/usr/local/lib/site_perl
.из апача:
/home/httpd/perl -такого пути вообще нет
/etc/perl
/usr/lib/perl5/vendor_perl/5.8.8/i686-linux
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl
/usr/lib/perl5/site_perl/5.8.8/i686-linux
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib/perl5/5.8.8/i686-linux
/usr/lib/perl5/5.8.8
/usr/local/lib/site_perl
.
/usr/lib/apache2libsybdb.so лежит тут:
/usr/lib/libsybdb.so
/opt/sybase/OCS-15_0/devlib/libsybdb.so
/opt/sybase/OCS-15_0/lib/libsybdb.soвременно убрал из /usr/lib/, не помогло.
Зато апач стал по другому ругаться:
Can't load '/usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so' for module Sybase::DBlib: libsybdb.so: cannot open shared object file: No such file or directory at /usr/lib/perl5/5.8.8/i686-linux/DynaLoader.pm line 230.
at /var/www/localhost/perl/places.pl line 3
Compilation failed in require at /var/www/localhost/perl/places.pl line 3.
BEGIN failed--compilation aborted at /var/www/localhost/perl/places.pl line 3.Уважаемый, ВЫРУЧАЙ! Своей головой не дойду!
Расскажи подробнее как проверить версии библиотек? Что ещё нажать? и куда посмотреть?
>[оверквотинг удален]
>/opt/sybase/OCS-15_0/lib/libsybdb.so
>
>временно убрал из /usr/lib/, не помогло.
>
>Зато апач стал по другому ругаться:
>Can't load '/usr/lib/perl5/site_perl/5.8.8/i686-linux/auto/Sybase/DBlib/DBlib.so' for module Sybase::DBlib: libsybdb.so: cannot open shared object file:
>No such file or directory at /usr/lib/perl5/5.8.8/i686-linux/DynaLoader.pm line 230.
> at /var/www/localhost/perl/places.pl line 3
>Compilation failed in require at /var/www/localhost/perl/places.pl line 3.
>BEGIN failed--compilation aborted at /var/www/localhost/perl/places.pl line 3.Вообщем что выясняется: /usr/lib/libsybdb.so вроде как используется РНР (потому как после его удаления Апач перестал загружаться), но в РНР из под Апача всё отлично работает!..
Есть конечно ещё один вар-т - ход конём - который мне сильно упростит жизнь: научить РНР запускать хранимые процедуры Sybase...