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.
|
 |
08-31-2003, 06:32 AM
|
#1
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Rep:
|
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!
|
|
|
08-31-2003, 06:47 AM
|
#2
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
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.
|
|
|
08-31-2003, 07:01 AM
|
#3
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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.
|
|
|
09-02-2003, 12:02 AM
|
#4
|
LQ Newbie
Registered: May 2003
Distribution: Debian
Posts: 12
Rep:
|
I'm having this exact same problem under Debian. My AddType and LoadModule lines are uncommented as well. Any help would be greatly appreciated.
|
|
|
09-02-2003, 12:33 AM
|
#5
|
LQ Newbie
Registered: May 2003
Distribution: Debian
Posts: 12
Rep:
|
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.
|
|
|
09-02-2003, 10:55 AM
|
#6
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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! 
|
|
|
09-02-2003, 11:05 AM
|
#7
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
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
|
|
|
09-02-2003, 11:39 AM
|
#8
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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.....
|
|
|
09-02-2003, 11:48 AM
|
#9
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
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.
|
|
|
09-02-2003, 12:12 PM
|
#10
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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 ?
|
|
|
09-02-2003, 12:17 PM
|
#11
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
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?
|
|
|
09-02-2003, 12:31 PM
|
#12
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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...
|
|
|
09-02-2003, 01:57 PM
|
#13
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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 !
|
|
|
09-03-2003, 06:18 AM
|
#14
|
LQ Newbie
Registered: Jul 2003
Location: Western Australia
Distribution: debian, ubuntu, mint, etc...
Posts: 14
Original Poster
Rep:
|
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 ! :-)
|
|
|
09-03-2003, 09:04 AM
|
#15
|
Member
Registered: Apr 2002
Location: New York, USA
Distribution: Redhat 7.2, 9.0 Slackware 9.1
Posts: 428
Rep:
|
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 :-)
|
|
|
All times are GMT -5. The time now is 02: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
|
|