473,396 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Problems using MySQL client via Apache CGI

Hi there

I'm trying to run some CGI programs under Apache, written in C++,
which use the "libmysqlclient" MySQL library. This is all running on
Solaris.

I build my programs using the following makefile:

all: SCM exampleSQL

SCM: SCM.cpp makefile
@echo "Building SCM"
g++ SCM.cpp -g -o SCM -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 SCM
cp SCM ../cgi-bin

exampleSQL: exampleSQL.cpp makefile
@echo "Building exampleSQL"
g++ -o exampleSQL exampleSQL.cpp -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 exampleSQL
cp exampleSQL ../cgi-bin

where "SCM" is the production program, and "exampleSQL" is a test
program I have written to try and get things working.

As you can see these two programs are compiled identically. When I run
program "exampleSQL", everything is fine, it pulls all the stuff out
of the database and sends everything back to my web browser.

But when I try to run program "SCM", I get an Apache error, and when I
look in /var/apache/logs/error_log I get:
ld.so.1: SCM: fatal: libmysqlclient.so.12: open failed: No such file
or directory
[Sun Jun 6 12:34:36 2004] [error] [client 172.17.1.234] Premature end
of script headers: /var/apache/cgi-bin/SCM

How can one program manage to find the correct library at runtime but
not the other ? Permissions ? Or is it dependent on exactly which
MySQL functions the program tries to call ? (NB I have a SetEnv for
LD_LIBRARY_PATH in httpd.conf which I hoped would fix this but
doesn't.)

Any ideas of how I might start investigating this would be
appreciated.

Best rgds

Griff
Jul 20 '05 #1
3 1836
In alt.apache.configuration Griff <gr*****@aol.com> wrote:
Any ideas of how I might start investigating this would be
appreciated.


I'd suggest to compile the program statically linked instead
of dynamically. It will become way bigger, but you'll solve
all the dynamic linking problems at once.
Davide

--
| Turnaucka's Law: The attention span of a computer is only as long as
| its electrical cord.
|
|
Jul 20 '05 #2
gr*****@aol.com (Griff) wrote in message news:<d6**************************@posting.google. com>...
Hi there

I'm trying to run some CGI programs under Apache, written in C++,
which use the "libmysqlclient" MySQL library. This is all running on
Solaris.

I build my programs using the following makefile:

all: SCM exampleSQL

SCM: SCM.cpp makefile
@echo "Building SCM"
g++ SCM.cpp -g -o SCM -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 SCM
cp SCM ../cgi-bin

exampleSQL: exampleSQL.cpp makefile
@echo "Building exampleSQL"
g++ -o exampleSQL exampleSQL.cpp -I/usr/local/include/mysql
-L/usr/local/lib/mysql -lmysqlclient -lz
chmod 555 exampleSQL
cp exampleSQL ../cgi-bin

where "SCM" is the production program, and "exampleSQL" is a test
program I have written to try and get things working.

As you can see these two programs are compiled identically. When I run
program "exampleSQL", everything is fine, it pulls all the stuff out
of the database and sends everything back to my web browser.

But when I try to run program "SCM", I get an Apache error, and when I
look in /var/apache/logs/error_log I get:
ld.so.1: SCM: fatal: libmysqlclient.so.12: open failed: No such file
or directory
[Sun Jun 6 12:34:36 2004] [error] [client 172.17.1.234] Premature end
of script headers: /var/apache/cgi-bin/SCM

How can one program manage to find the correct library at runtime but
not the other ? Permissions ? Or is it dependent on exactly which
MySQL functions the program tries to call ? (NB I have a SetEnv for
LD_LIBRARY_PATH in httpd.conf which I hoped would fix this but
doesn't.)

Any ideas of how I might start investigating this would be
appreciated.

Best rgds

Griff


You may be doing this already.

You need to set LD_LIBRARY_PATH in apache startup shell script. use
ldd or dump commnd to check the dynamic object path. or you change
system wide dynamic object search path.

-SR
Jul 20 '05 #3
Thanks to everyone for all your help with this, some good pointers there.

Cheers - Griff
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Redding | last post by:
I am using Apache 1.3, MySql 3.23.28-gamma and php 4.0 with Internet Explorer 6 (sp2) on Windows XP. I am using the manual MySql/PHP Database Applications to teach myself php and mysql. I have...
7
by: Torsten Schmidt | last post by:
Hi, I'm trying to connect to a mysql-Server using PHP's mysql-function mysql_connect. The host on which the mysql-server is running is not the same as the host apache and php are running on. The...
6
by: Andres Rosado-Sepulveda | last post by:
Hello, I'm having trouble compiling PHP 4.3.4 on Solaris 8. This is the error message it is showing: -- start -- Undefined first referenced symbol ...
0
by: Robert Mazur | last post by:
MySQL 5.0 alpha (binary install) on Solaris 9 -or- RedHat 8.0 mysql-connector-java-3.0.8-stable ----------------------- Is there something different going on with JDBC and the alpha version...
0
by: Howard | last post by:
I have Apache Web Server 2.0.55 installed locally with MySQL 5.0.18-nt, and of course PHP 5.1.2 I also have installed phpMyAdmin. It is accessible through http://localhost/phpMyAdmin. The pathing...
5
by: Frances | last post by:
a few days ago I installed XAMPP in my Windows 2000 machine, it completely messed my existing MySQL installation.. I've had it installed for over a year now (4.1) have never had any problems with...
2
by: gavino | last post by:
REHDAT LINUX 4S PHP 4.3.9 LEGACY APP I MOVED NOW EATS MEMORY CAN ANYONE TAE A LOOK ? I FIXED ONE PARTIALLY BY CHANGING TO here are my apache settings: 1 page laoding for a few seconds eat like...
27
by: gerrymcc | last post by:
Hello, I'm a php/mysql beginner... Is there any way of making the mysql command line client full-screen? Sometimes it's easier to use the client than go thru php, but since it's only about 80...
3
by: arasub | last post by:
ep 20, 2007 11:25:57 AM org.apache.catalina.core.AprLifecycleListener lifecycleEvent INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.