Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
11-09-2004, 08:48 AM
|
#1
|
LQ Newbie
Registered: Sep 2004
Posts: 5
Rep:
|
Installing LAMP with MySQL 4.1 - close but stuck with Apache problem
I am running Fedora Core 1
I want to study and practise using MySQL with an Apache server using Perl and DBI - hence
LAMP - Linux, Apache, MySQL, Perl.
Fedora Core 1 comes with MySQL 3.x and I wanted to upgrade to the newly stabilised MySQL 4.1 because I want foreign key restraints and subselect queries. (I'm interested in databases not fiddling about with all this configuration and installation).
I successfully removed the old MySQL and installed all the various RPMs available from the mysql website so now 4.1 is running with its control center and I can work directly with my favourite practice databases. Everything also works beautifully in Tomcat with JSP.
I upgraded Perl and now I think I'm running 5.8.1 (though I thought I was trying to install 5.8.5. The make, make install process is incredibly time-consuming and bewildering but at the end of the day, perl is working smoothly.
I managed to install the DBI module and the DBD MySQL driver from CPAN. So now, from a shell I can run perl programs which access MySQL successfully.
So, MySQL 4.1 is talking smoothly to Perl.
I used the same syntax to connect to the database and added the relevant bits of HTML to run it in Apache. These files run perfectly well on my other Linux boxes where I'm just using the packages supplied with the distribution (including MySQL 3.x) so the Perl, DBI HTML syntax is sound.
However, I constantly get errors in the error log along these lines:
install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC
(@INC contains:
then there follows a list of paths where Apache is expecting mysql.pm
I have just successfully compiled and installed the latest Apache from apache.org hoping that the compilation process would find the necessary bits of perl and figure out what to do but the basic error of not being able to find mysql.pm is exactly the same.
I'm not trying to use the mysql.pm and I didn't try to install it. I'm trying to use DBI with the DBD driver, so why is Apache looking for mysql.pm?
This is driving me crazy because all I want to do is a bit of bog-standard MySQL/Perl on one of the most popular webservers around. Why is it so fiendishly difficult?
Can anyone help me resolve this problem?
|
|
|
11-09-2004, 01:13 PM
|
#2
|
Member
Registered: Jun 2002
Posts: 411
Rep:
|
did you rename / remove your old /etc/my.cnf ?
here's a wild guess. you say you upgraded mysql. sometimes an upgrade can go slighly off because of an out-of-date my.cnf from a previous installation. did you rename / remove your old /etc/my.cnf ? I wonder if some setting from the old my.cnf could cause this problem.
|
|
|
11-10-2004, 08:19 PM
|
#3
|
LQ Newbie
Registered: Sep 2004
Posts: 5
Original Poster
Rep:
|
update to first post
I've been experimenting with the build configuration and have finally got Apache running and successfully connecting to MySQL version 4.1 with Perl and DBI.
The crucial setting is the architecture-dependent installation directory. The key point is install Apache using default settings, but configure your new Perl installation to ensure that any architecture-dependent files are placed in a directory that Apache expects.
I found that, if I attempted to configure Apache in any way apart from the defaults, I ran into difficulties. The only thing I needed to set was the installation directory.
So, installing Apache from source involved the 4 commands set out in the installation instructions:
# ./configure --prefix=/usr/local/apache2
# make
# make install
#/usr/local/apache2/bin/apachectl start
Now, after installing DBI and DBD from source, I tried to run my test DB connection page and got the usual error about being unable to locate the MySQL driver, but this time I paid more attention to which directories Apache was searching to find a suitable driver for MySQL. When I compared them to the directories where Perl 5.8.5 had installed itself, I realised the default Perl installation had stored various bits and pieces in places that Apache wasn't expecting. After reading through installation instructions for Apache and Perl more carefully, I found there is a setting for choosing a location for architecture-dependent files. Perl 5.8.5, by default, creates some directories with names starting with i686 on Fedora Linux but Apache on this distribution is looking for directories based on the name -i386.
I removed my new Perl 5.8.5 installation and deleted everything I could think of related to it, then re-installed, this time choosing an interactive configuration session.
The sequence of commands is:
# rm -f config.sh Policy.sh
# Configure
# make
# make test
# make install
(In order to enter interactive Configuration mode, you don't type -de after Configure )
You have to stay awake during this because it asks some really obscure questions and often says "if you don't understand this just press return". So, when you get to the questions about the location of the installation directories, slow down, take your time and when they ask about the architecture-dependent installation directory, type:
-i386.
This time, perl installed itself in a directory called /usr/lib/perl5 and created some sub-directories called -i386-linux-thread-multi instead of -i686-linux-thread-multi and hey presto after re-installing DBI and the MySQL DBD module, Apache was able to find the driver it needs to run my test SELECT query.
I've seen many posts in many forums over the last week with a very similar error running Apache with Perl or Python MySQL or PosgreSQL etc so it could be that the solution is to re-build the relevant scripting language (Perl or whatever) but ensure that it's configured to put architecture-dependent files in a location that Apache is expecting.
Hope this helps someone. It's taken me about 10 days of rather late nights to get this to work.
Last edited by David Mann; 11-10-2004 at 08:24 PM.
|
|
|
All times are GMT -5. The time now is 12:48 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|