LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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


Reply
  Search this Thread
Old 08-31-2003, 07:32 AM   #1
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Rep: Reputation: 0
Question Apache / PHP / Mysql config problem - debian


Hi,
I need some ideas/help with Apache, PHP, (MYSQL) issues.... I am in the process of setting up a web server using Apache, PHP, mysql, etc... (nuke/postnuke?) and have hit a snag.

and just in case you are wondering --- I have googled! (and searched various LUG's, etc... to no avail)

I currently have three domains configured ( using name based virtual domains ) but they are not live yet, so I can't provide the address... Two of the domains use standard html based pages and the third uses php.... The html pages work perfectly - using the correct domain name - but the php ones don't and fail with the following error: "file index.php is of the type application/x-httpd-php, and Mozilla does not know to handle this file type"... followed by the option to "save the file". If I replace the index.php page with an index.html file, it works fine. I have tried this from a few local machines... (I don't think the problem is with the browser - I can read other PHP based sites just fine :-)

Background - I have apache installed and running (html pages served correctly), apache-php module installed, PHP4 installed, etc....

note: I have checked httpd.conf and it contains the lines:
LoadModule php4_module /usr/lib/apache/1.3/libphp4.so and
DirectoryIndex index.html index.htm index.shtml index.cgi index.php
etc.

I checked and re-checked the config files..... Mysql is working (I can create and edit databases), but the php pages just won't load....

I also can't view local PHP based (non-database linked) pages: eg. If I point my browser to /usr/share/phpmyadmin/index.php I get the same error as above.

What am I missing?

Any ideas.... anyone!
 
Old 08-31-2003, 07:47 AM   #2
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Do you have a line that says:

AddType application/x-httpd-php .php

That is what tells apache it needs to parse the php page before serving it. I didn't see you mention that so you might want to plug that line in.
 
Old 08-31-2003, 08:01 AM   #3
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for your reply Marcus,

Yes, I do have that line as well. (sorry, should have put it in the original post)

Any other ideas/suggestions welcome!

Thanks.
 
Old 09-02-2003, 01:02 AM   #4
Deathwind
LQ Newbie
 
Registered: May 2003
Distribution: Debian
Posts: 12

Rep: Reputation: 0
I'm having this exact same problem under Debian. My AddType and LoadModule lines are uncommented as well. Any help would be greatly appreciated.
 
Old 09-02-2003, 01:33 AM   #5
Deathwind
LQ Newbie
 
Registered: May 2003
Distribution: Debian
Posts: 12

Rep: Reputation: 0
Hmm well I appear to have fixed mine when I uncommented the lines and restarted apache, but it seems Mozilla had cached the server response for the one php file I was testing with and wanted to download it. Going to a different php file in Moz worked, and using a different browser on the php file I was testing with worked as well. You might want to try the same strategy and see if that's what's happening to you.
 
Old 09-02-2003, 11:55 AM   #6
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
Unhappy Fatal error: Call to undefined function: mysql_connect()

Thanks for the replies and tips, however my problem still exists, although it has changed a bit....

I am not getting the above error anymore. I now get this instead:

"Fatal error: Call to undefined function: mysql_connect() in /usr/share/postnuke/pnadodb/drivers/adodb-mysql.inc.php on line 170"

this line relates to database authenticaion... but I have no trouble connecting to mysql using 'msqlcc', 'mysql Navigator', 'phpmyadmin' etc. so I guess it is some kind of apache - php - mysql issue still.

I am running debian (SID) using a custom 2.4.20 -6 SMP kernel
almost everything has been installed using apt-get and I have no incomplete/broken packages.... (just so you know)

note: I have completely uninstalled and reinstalled the following using debian's apt-get .... (using unstable versions = SID)
apache 1.3.27 (Debian/GNU Linux)
mysql-common
mysql-server
php4 (4.1.2)
php4-mysql
postnuke & drupal (I am trying both)
& any other dependecies

(i have checked again that all the required lines relating to php are in the httpd.conf file)

Note also, vigorous "googling" revealed that the above problem occurs (has occured) with some regularity on RH7* in relation to a php4-msql issue, but I have found no examples of this problem using debian.... (I did try a downgrade to the stable (woody) version of php4 / php4-mysql but again, nothing)

The *really* frustrating part is I have an almost identical configuration on my laptop and it works perfectly -

I am willing to look at *ANY* suggestions, ideas, hunches.... anyone?

Thanks for your time in reading this huge post!
 
Old 09-02-2003, 12:05 PM   #7
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
I am not familier with apt-get, did you compile php? If you did you need to compile in mysql support into php, A basic configure line I use is:

./configure --with-mysql=/usr/local/mysql

Make sure to change the path to wherever the mysql is installed to. From the sounds of it you now have php working correctly if you are getting that error, You can see if you have mysql installed into php by creating a file called phpinfo.php and putting this line in the file:

<? phpinfo() ?>

Look for a section called mysql and that might help you out. Post back if you run into any more problems
 
Old 09-02-2003, 12:39 PM   #8
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
Thanks for the input Marcus.

No I didn't compile php (although I am getting to the point where I probably will). 'apt-get' is the debian download manager. the version of php4 I am using has mysql suport compiled in... some of the output from your <? phpinfo() ?> file: (mysql is listed near the end)

'../configure' '--prefix=/usr' '--with-apxs=/usr/bin/apxs' '--with-regex=php' '--with-config-file-path=/etc/php4/apache' '--disable-rpath' '--disable-debug' '--enable-memory-limit' '--enable-calendar' '--enable-sysvsem' '--enable-sysvshm' '--enable-track-vars' '--enable-trans-sid' '--enable-bcmath' '--with-bz2' '--enable-ctype' '--with-db2' '--with-iconv' '--with-ndbm' '--enable-exif' '--enable-filepro' '--enable-ftp' '--with-gettext' '--enable-mbstring' '--with-pcre-regex=/usr' '--enable-shmop' '--enable-sockets' '--enable-wddx' '--with-xml=/usr' '--with-expat-dir=/usr' '--enable-yp' '--with-zlib' '--without-pgsql' '--disable-static' '--with-layout=GNU' '--with-curl=shared,/usr' '--with-dom=shared,/usr' '--with-zlib-dir=/usr' '--with-gd=shared,/usr' '--with-jpeg-dir=shared,/usr' '--with-xpm-dir=shared,/usr/X11R6' '--with-png-dir=shared,/usr' '--with-freetype-dir=shared,/usr' '--with-imap=shared,/usr' '--with-ldap=shared,/usr' '--with-mcal=shared,/usr' '--with-mhash=shared,/usr' '--with-mm' '--with-mysql=shared,/usr' '--with-unixODBC=shared,/usr' '--with-recode=shared,/usr' '--enable-xslt' '--with-xslt-sablot=shared,/usr' '--with-snmp=shared' '--enable-ucd-snmp-hack' '--with-sybase-ct=shared,/usr' '--with-ttf=shared,/usr' '--with-t1lib=shared,/usr'

Thanks again for your time.....
 
Old 09-02-2003, 12:48 PM   #9
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Ok I see that, What does it say lower in that page if the section for mysql? If you don't mind and its a public page post the address to that phpinfo.php page so I can take a quick look at it.
 
Old 09-02-2003, 01:12 PM   #10
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
OK, now it is getting interesting: my server says this:

Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php4/apache/php.ini
ZEND_DEBUG disabled
Thread Safety disabled


but my laptop (working) says a lot more:

Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /etc/php4/apache/php.ini
PHP API 20020918
PHP Extension 20020429
Zend Extension 20021010
Debug Build no
Thread Safety disabled
Registered PHP Streams php, http, ftp, compress.bzip2, compress.zlib


There is nothing specific about mysql... but the laptop is working and serving postnuke pages perfectly...

my guess is that last line is important.... "Registered PHP streams..."

.... I think I can ... I think I can ... I think I can ?
 
Old 09-02-2003, 01:17 PM   #11
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
So your laptop can bring up the pages you were having problems with with mysql?

If so, are you using a desktop as your server? if you are you might just have something cached in your browser that is giving you problems, if your laptop is working fine then your server is probably working fine.

So I guess my question for you is: Is your laptop being able to serve pages off the server, that is pages that connect to a database?
 
Old 09-02-2003, 01:31 PM   #12
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
Marcus,

My server and my laptop have practically the same config (debian, apache, mysql, etc..)

I can access postnuke (php) pages on my laptop from my server and from the laptop itself using mozilla, konqueror, netscape, whatever.....

But I can't access any php/mysql stuff on my server...

The laptop, confiigured as a 'server' works fine! ... it 'serves' php/mysql pages & html pages

The 'server' configured as a server is broken it only serves html pages

(it could be a case of split personalities laptop <-> server ???)

still trying...
 
Old 09-02-2003, 02:57 PM   #13
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
Marcus (and anyone else reading this....)

I have played some more and am now getting the same output from the phpinfo file on my Server as I was getting on the Laptop. Guess that means I am a step closer but still no joy.

At least the the phpinfo file is now telling me that :

Registered PHP Streams php, http, ftp, compress.bzip2, compress.zlib

However, it's now almost 3 AM 'down-under' and i've got to be at work in the morning -> boring windows nt4/w2k server stuff

Anyone want to 'fix' this while I'm sleeping ?

Thanks for your help so far!

zzz ZZZZ !
 
Old 09-03-2003, 07:18 AM   #14
bandit
LQ Newbie
 
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14

Original Poster
Rep: Reputation: 0
IT WORKS !!!!

Thanks for all the comments and tips above... Thanks Marcus, you got me looking in the right direction.

In the end it was simply one of these -> ;

The following line was commented out in /etc/php4/apache/php.ini:

;extension=mysql.so

I removed the ; and restarted apache and BINGO!

- end of thread ! :-)
 
Old 09-03-2003, 10:04 AM   #15
cli_man
Member
 
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428

Rep: Reputation: 30
Well I am glad I could at least get you thinking in the correct direction, now sit back and glow in the knowledge that you have it working, you have conquered the beast and you are king on your domain :-)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Mysql,php or apache problem? intercodes Linux - Software 3 11-18-2005 12:20 PM
Debian + Apache + PHP + MySQL.so = Error critical Linux - Software 4 08-04-2005 05:18 AM
help with apache php mysql config slinky2004 Linux - General 3 03-22-2005 08:36 PM
Debian, Apache, PHP, MySQL rossp Linux - Software 2 10-30-2004 07:51 AM
php or apache config problem mattkat Linux - Software 2 04-30-2003 07:25 PM


All times are GMT -5. The time now is 11:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration