Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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.
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.
First I would like to extend my thanks to this forum and the people that frequent here. Over the past week, I've referenced this site numerous times as I worked my way through the initial setup and configurations. It's been frustrating at times, but I'm happy to say I'm excited at being a new Linux user!
A few months ago I took an old computer and started up a small webserver. What originally began as a small interest has turned into an avid hobby of mine, consuming much of my spare time (and some of my "not so" spare time). Since creating my dyndns.org account, I have installed Apache 2.0, Movable Type's weblog, Perl, PHP, and a phpbb2 board running on a MySQL4 database. This poor 450mhz P2 Windows ME machine has been running breathlessly for quite some time now.
With some gift certificates I had to Gateway, I purchased their 920 Server (tinyurl.com/ywkyq) with SUSE Standard Server 8 bundled. My goal is to get everything from my current server switched over to the new Linux machine.
I've done my best to solve most issues, but just can't figure out some. I would like to get these worked out over the next few weeks.
One of them is a problem getting my .php pages to work. The browser tries to download the .php file. If I change the extension to .php3, it will load the page but only show the code.
I followed the instructions in this thread (tinyurl.com/ysvmu), but couldn't resolve the issue. It's possible I'm not applying it correctly. In another thread (tinyurl.com/2we9n), I tried using the ApacheToolbox but got an error "checking for autoconf" and "...gcc" failed when running ./install.sh/
I also tried to upgrade to 2.0 from 1.3 to see if that would help, but couldn't get the program to compile. I read an article saying 1.3 should work fine and stopped there.
What information can I provide to help solve this problem? I can put my httpd.conf file up on my server if that helps.
Well, that should cover everything, I've been so excited working with this I couldn't stop writing. Thanks for taking the time to read everything, I appreciate any assistance you can give me.
Hello Stephen,
glad to have you here and it sounds like your new hobby entitles you to a free propellerhead hat. You are becoming a geek, that's what's happening.
Now, on to your problem.
Quote:
One of them is a problem getting my .php pages to work. The browser tries to download the .php file. If I change the extension to .php3, it will load the page but only show the code.
This sounds as if Apache doesn't recognize the .php file extension.
Make sure you load the php4 module in httpd.conf (the Apache config file, usually in /etc/apache/conf or /etc/httpd/conf):
Code:
LoadModule php4_module libexec/libphp4.so
In the AddModule part of httpd.conf, you need this:
Code:
AddModule mod_php4.c
You also need to tell Apache which file extensions should be parsed by PHP - .php files of course, plus any others that you may want:
Code:
AddType application/x-httpd-php .php .phtml
Save your httpd.conf and exit the editor. Now restart Apache - apachectl restart. If there are any error messages pay attention to them and if there are any instructions you should follow them.
You can use apache -t to verify that the syntax in your configuration file is correct.
One thing that can be really helpful determining problems is using a phpinfo page. Create a file called phpinfo.php in your DocumentRoot (the webserver's root directory) and enter the following code in it:
Code:
<?php
phpinfo();
?>
Try accessing that file with your web browser. If PHP works and is parsed and sent to the browser correctly you should get a page displaying information about your PHP and web server environment. If it doesn't work, well then you will get that ol'd "Save as" box in your browser again.
If you still are having problems post the relevant parts of your httpd.conf file and make sure you're editing the config file that is actually used (in case you have more than one)!
I created a testphp.php file and another "Hello World" test.php file. Both times the browser tried to download the file.
I also looked for any other .conf files in case I was editing the wrong one, but couldn't locate any. Is there a command to find out the location of the current .conf file being used? Also the apache -t command didn't work. (bash: apache: command not found)
I did find a httpd.conf.SuSEconfig file though, which seems to contain everything the httpd.conf file does. I added the lines there also and restarted but no success.
Here are my files if you want to see the whole thing. (Won't let me post URL's yet)
(httpd.conf) shosterman.dyndns.org/errors/httpd.conf
(httpd.conf.SuSEconfig) shosterman.dyndns.org/errors/httpd.conf.SuSEconfig
Stephen
Last edited by shosterman; 01-09-2004 at 12:28 PM.
The apache binary might not be called "apache", it might be called "apache2" or "httpd". Try /usr/sbin/apache2 -t or /usr/sbin/httpd -t instead. As for the config file, I'll leave that until tomorrow. It's time for me to hit bed and it's quite lengthy.
Just a quick thought - did you verify that the module libphp4.so in /usr/lib/apache ?
Just a quick thought - did you verify that the module libphp4.so in /usr/lib/apache ?
Yes, I did a search for that file and it came up in that folder.
Thanks for taking the time to look through the file. For the record, I wasn't implying that I wanted you to read through the whole thing , but I wanted it to be available in case you were looking for something specific.
Last edited by shosterman; 01-10-2004 at 12:45 PM.
I'm no SuSE wiz but there is one interesting Include statement in your httpd.conf - on line 330 it says "Include /etc/httpd/suse_addmodule.conf". I think there's where you should start looking. Also check /etc/httpd/suse_include.conf which is referenced from the last line of httpd.conf.
I just recently started toying around with Gentoo, and coming from Debian it's quite a shock. They have all sorts of non-standard configuration files, but I guess in the end when you're used to it it's much easier. But starting out it's quite confusing.
SuSE also seems to have an /etc/apache2/conf.d directory (like Gentoo), where some extra configuration files are stored, like mod_php4.conf.
There is a SuSE apache2 FAQ as well. It might be worth checking out.
Well, here's an update on what I've got installed so far.
This has been a very frustrating process, especially trying to get this PHP working and not seeming to get anywhere. I figured I would give the apache2 install another try.
I first downloaded the Unix source from Apache.org and gzipped and tarred (however it's said) the file and then moved into the directory. I was having a problem with the $./configure --prefix=/usr/local/apache2 command working. It would start a few lines then come up with a error: no C compiler in $PATH. I did another search for this error and it said something about gcc not being installed, so I went to my install and did a search for gcc. Sure enough, I checked that box and reran the command and voila it worked! I bet it would have been beneficial if I had stated this error earlier.
After that, I tried the $ make command and nothing happened. So again I searched for it and installed it. Once installed I ran $ make and then $ make install which took just a couple minutes to finish.
Finally, I started the server and browsed to localhost. It still says "Apache/1.3.26" at the bottom, how should I go about getting rid of this version and using 2.0? Do I want to remove it through YasT2? Will that remove any shared files or cause problems?
Let us stop for a while and make a few things clear:
1. You have one version of Apache installed from the distribution and you're building another one from source, is this correct? If so, what version are you building and what version did you install directly from the distribution?
2. If you build and install Apache or Apache2 from source the default installation directory is /usr/local/apache (or (...)/apache2 if you're going with Apache2). It shouldn't interfere with the version that shipped with your distribution. You will find the apachectl program (to manually stop and start the web server) and other important executables (like the server itself) in /usr/local/apache2/bin. Config files for the local build should be in /usr/local/apache2/conf. If you're starting Apache with /usr/local/apache2/bin/apachectl start then those are the files you need to edit.
Here is what is installed when I did a search for "apache" in YaST2:
apache 1.3.26-57
mod_perl 1.27-50
mod_python 12.7.8-98
mod_ssl 2.8.10-57
The one I downloaded was httpd-2.0.48.tar.gz. I built and compiled that one during my last step.
To answer your first question, yes, I am trying to install the 2.0.48 from source with the intent of upgrading from 1.3.26-57 to the 2.0.48. I guess maybe I'm used to Windows installs and assumed it would do the upgrade.
Concerning your second statement, I see that there are two apachectl programs. The one you're referring to is in "/usr/local/apache2/bin", but there is also another one in "/usr/sbin/".
When I run the command apachectl start, the return is "/usr/sbin/apachectl start: httpd started". This is even if I run it out of the apache2/bin directory. I guess it's running that program and I don't know how to change it...if it's a problem. I'm guessing the command is embedded somewhere, but I don't know where to begin to look.
Now even after starting and I do a apachectl restart, I get
"/usr/sbin/apachectl restart: httpd not running, trying to start"
"/usr/sbin/apachectl restart: httpd started"
I also tried removing the apache that came installed with the distribution and then running apachectl start, but no luck and I forgot to write down the error message.
About starting Apache when a distribution-supplied version of Apache is already installed:
/usr/sbin is in your path when you're root, but /usr/local/apache2/bin isn't, that's why the apachectl in /usr/sbin is executed when you type the command. However, if you supply the full path to /usr/local/apache2/bin/apachectl (<--- that's what you type, or cd to (...)apache2/bin and type ./apachectl) you tell the shell that this is the program I want to run and no other program by the same name. You should pass arguments to the program as usual (append the "restart" or whatever commands).
To view what directories are in your path type echo $PATH. The $PATH environment variable is a colon-separated list that lists the directories that will be searched when looking for executables. There are several discussions on this forum about configuring the $PATH variable so I won't try to cover that here. We're doing pretty well writing lengthy posts anyway.
You don't really need to remove the distribution version of Apache (it's probably more trouble than you or I need ) as long as you're aware of the difference between the one you have built (where its config files are located, what modules that are installed for it, and so on) and the one that shipped with your distribution.
My PHP code runs, the board works, I just need to do some file swapping now! Well that ./ command makes sense now, I was confused how to run a file from a specific directory.
According to your guidelines heres how I finished it up.
I downloaded the newest source code of PHP4.3.4 from php.net and unzipped that. Then using this page as a reference, I ran the following code:
(I'm not sure what all of it does)
The problem was that I kept getting errors trying to run that code, so I just did a basic compile of:
Code:
./configure --prefix=
I then did make and then make install. Apache loaded fine but the libphp4.so file was nowhere to be found. Assuming I left something out of the compile I went back to the original code. It's then I realized I needed to install the gdbm-devel and the zlib-devel packages.
So I compiled again and tried make, but was getting some errors. After a bit with google I found I needed to run make clean. I guess to clear my previous install? Everything installed fine afterwards.
Do you foresee any problems I might have after running that configure code more than once or doing the make install more than once? I'll leave the 1.3 on there like you said to save myself (or you) from any further hassle.
I guess my last question is how can I change it so when I type apachectl Linux will know to use the new apache2 version? I would have to get rid of or rename the old one and move the new one to my /usr/sbin directory, correct? Although it's not terribly important now that everything is running.
Well, looks like I've already made this long enough. I want to say thanks again for all your help, I can't tell you how many days or weeks this would have taken me otherwise.
Here is one way of making the locally built apachectl command get executed instead of the old one from the distribution: First cd to /usr/sbin and rename apachectl to something sane - mv apachectl apachectl_distro. Then simply create a link called "apachectl" in the /usr/sbin directory pointing to your own apachectl: ln -s /usr/apache2/bin/apachectl /usr/sbin/apachectl.
Running the configure script several times won't hurt a bit. It creates the Makefile(s) used by make to build the program, and running make install will only over-write the files you installed while doing the same thing the last time.
You should also look into how your distribution uses boot scripts in order to have Apache start automatically on boot. You can often (I'm not saying this will work with SuSE) link to apachectl from the /etc/rc.<runlevel> directories for the runlevels that you want Apache to run at.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.