LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Apache PHP MySQL Setup after Slackware 9.0 Installation (https://www.linuxquestions.org/questions/slackware-14/apache-php-mysql-setup-after-slackware-9-0-installation-54320/)

initself 04-09-2003 11:47 PM

Apache PHP MySQL Setup after Slackware 9.0 Installation
 
For whatever reasons, Apache, PHP and MySQL are not fully setup for use after an initial Slackware 9.0 installation. Below are some steps that helped me quickly setup all three:

Apache/PHP/MySQL Setup

1. Set Apache to boot at startup:

chmod 755 /etc/rc.d/rc.httpd

2. Add PHP support to httpd.conf:

vi /etc/apache/httpd.conf

#add the following to sections containing similar code:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

You might want to also add an index.php entry to the DirectoryIndex section as well:

#
# DirectoryIndex: Name of the file or files to use as a pre-written HTML
# directory index. Separate multiple entries with spaces.
#
<IfModule mod_dir.c>
DirectoryIndex index.html index.php
</IfModule>


3. Set permissions on MySQL files:

cd /var/lib
chown -R mysql mysql mysql
chgrp -R root mysql mysql
su mysql
#prompt changes from # to $
mysql_install_db
safe_mysqld --user=mysql & #hit enter once the db loads
exit
#prompt changes from $ to #
mysqladmin -u root status #verify the database is running

4. Add MySQL to startup scripts::

vi /etc/rc.d/rc.local
echo Starting MySQL server:
safe_mysqld --user=mysql &
sleep 2

Good Luck!

mb

320mb 04-10-2003 06:00 PM

Slack 9 does have some probs yes, here is a bug I found.....
the kernel configurator does not even get installed on my system, and the Bash setup in not complete either. I have a Slack subscription, so I have the 4 CD set. I am gonna put 8.1 back in and just upgrade everything and see how it works.:study:

rivang 05-06-2003 08:34 PM

Location of Apache on Slackware 9.0
 
I am trying to install Apache 2.0 on Slackware 9.0... using DevShed's "The Soothingly Seemless Setup of Apache, SSL, MySQL and PHP guide.

What is the location of the default install of Apache in Slackware 9.0?

I am looking to install Apache 2.0 in /usr/local per the instructions from the guide mentioned above.

The recommended paths are

/usr/local/apache
/usr/local/mysql
/usr/local/ssl

Can you uninstall the default installation of Apache, SSL, MySQL and PHP?

initself 05-08-2003 10:32 AM

Re: Location of Apache on Slackware 9.0
 
Quote:

What is the location of the default install of Apache in Slackware 9.0?
/etc/apache - index.html is located in /etc/apache/htdocs

You can add your own index.html file in this directory to test.
Quote:

Can you uninstall the default installation of Apache, SSL, MySQL and PHP?
I understand your desire to work within the guidelines of your book but one of the great things about Slackware 9.0 is that it handles the installation for you.

If you follow the directions in my first post, you'll have everything installed and working in 10 minutes. Then you can concentrate on what's important: using these tools!

If you really want to uninstall these modules, use the 'pkgtool' command as root and remove the packages.

mb

tentonipete 05-27-2003 06:19 AM

genius - that setup tip is great thanks

*scribbles it down*

immortal 06-29-2003 10:28 AM

great tips

thnx

Astro 06-29-2003 02:36 PM

Personally I never liked how slack installed apache/php/sql from 8.0, so I install them myself from source. :-)

C++freak 06-30-2003 02:18 AM

That is a good peice of advice. That has been stored away in my collection of priceless documents (HOW-TOs, Guides, etc), in a very secure place. Thanks!

deanglass 06-30-2003 05:19 AM

htdocs location in default RH9 setup
 
Hello all,

This is my first thread in this forum, so be gentle.

Main problem:

Cannot find htdocs folder in my RH9 installation.
-----
I am trying to locate the usual html file to replace with my content but for some reason cannot find it! I have viewed /etc/httpd/conf/httpd.conf to see the location of the server is poniting at /var/www/html/, which is empty. I have tested http://localhost in mozilla and everything is ok, but it is wierd that i cannot find the main directories. Is there a generic 'search' terminal command that would get me out of future situations like this?

Thanx in advance

initself 06-30-2003 10:52 AM

Deanglass,

This forum is for information regarding the 'Slackware' distribution, not RH9. I would suggest posting here:

http://www.linuxquestions.org/questions/forumdisplay.php?s=&forumid=5

Thanks.
.
mb

ignavus 07-24-2003 01:24 AM

A very helpful thread, initself.

I've been having trouble installing and running MySQL since I obtained it a few days ago, until I figured out it actually is installed as a package along with Slackware. Using the few steps you mentioned had the server up and running in less than five minutes.

Now I just have to figure out how to upgrade it to the newest version of MySQL - as the one provided with Slackware 9.0 only is 3.23.56.


Thanks alot.


:study:

woodsta 07-30-2003 11:08 AM

Hi, newcomer to slackware (recent convert from debian), so excuse any lame/obvious questions.

I've tried the method for setting up mysql after installing a fresh copy of slack9, but I appear not to have a mysql dir in /var/lib - seem to have the rest of mysql installed ok.

Cheers,

initself 07-30-2003 11:23 AM

Full Installation?
 
Quote:

Originally posted by woodsta
I've tried the method for setting up mysql after installing a fresh copy of slack9, but I appear not to have a mysql dir in /var/lib - seem to have the rest of mysql installed ok.
Can you verify that your Slackware 9.0 installation was a full installation?

mb

woodsta 07-30-2003 11:58 AM

Re: Full Installation?
 
Quote:

Originally posted by initself
Can you verify that your Slackware 9.0 installation was a full installation?

mb

as far as I remember, it was a full install.

initially, /usr/share/mysql/mysql.server start crashed out as /var/lib/mysql/ dir was not found, I have now created the mysql dir in /var/lib, and no longer gives the directory not found error.

now when I run the following:
# cd /usr ; /usr/bin/safe_mysqld &
[1] 1043

I get this:
# Starting mysqld daemon with databases from /var/lib/mysql
030730 17:05:06 mysqld ended

and mysqld exits straight away (presumably due to finding no databases).

Cheers,

initself 07-30-2003 12:06 PM

Re: Re: Full Installation?
 
Quote:

Originally posted by woodsta
[B]as far as I remember, it was a full install.
If you are just starting out with your installation, I would try it again from the start and make sure you install every package. I can't imagine that any Slackware 9.0 full installation would differ on the placement of the mysql installation directory.

You shouldn't have to create any directories at all. You should just be able to follow my instructions line by line.

mb

woodsta 07-30-2003 05:01 PM

Re: Re: Re: Full Installation?
 
Quote:

Originally posted by initself
If you are just starting out with your installation, I would try it again from the start and make sure you install every package.
mb

Thanks, I'll give it a go, not much hassle as I haven't set much up on it yet. Thanks again for the help.

figadiablo 07-30-2003 09:10 PM

Re: Apache PHP MySQL Setup after Slackware 9.0 Installation
 
Quote:

Originally posted by initself
3. Set permissions on MySQL files:

# cd /var/lib
# chown -R mysql mysql mysql
# chgrp -R root mysql mysql
# su mysql
$ mysql_install_db
$ safe_mysqld --user=mysql & [hit enter once the db loads]
$ exit
# mysqladmin -u root status [verify the database is running]

Right on the money, thanks.
It just so happened that today I tried Mysql on Slack 9 for the first time. Did a search and the first return that I got back was this one. Right On!!

Figa

woodsta 07-31-2003 12:51 PM

just had a thought...I have /var mounted on a different drive to the root, would this cause problems with sql setting up its var directory? I mounted it in slackware setup before installing - are there any properties of /var that make it unsuitable for locating on a different drive to the root? if so I'll keep var on root and move something else to the other drive on setup... apologies if this is verging on the off-topic

cheers,

ne21 08-07-2003 06:28 PM

Re: Apache PHP MySQL Setup after Slackware 9.0 Installation
 
Quote:


2. Add PHP support to httpd.conf:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

I have a question about this part of the install...in the httpd.conf...is there a specific location in the file you do this? Do you have to add the LoadModule part in the section where all the other modules are loaded and place the others elsewhere? Or can you just add this section to any other location? (Getting ready to install phpNuke so this is pretty important.)

Also, you mentioned that you need to add the apachectl to the rc.local to make apache run at boot time...an easier way to do that is to simply chmod 755 /etc/rc.d/rc.httpd

BigBadPenguin 08-07-2003 08:34 PM

good call on the rc.httpd, otherwise this post was excellent (shame i just saw it after struggling to install apache on this comp...) As far as adding php to httpd.conf goes, it should just be a matter of uncommenting lines that are already there, so search for them and you'll be sure the lines are in the right place.

pbhj 08-08-2003 06:57 AM

Woodsta,

If you're installing mysql I think you'll need a flag to tell ./configure the location (if it's anything other than under /usr/local/mysql - the default).

Also the problems you described (from what I've experienced) are due to access rights on the databases. Mysql needs an access rights database to be created (by the ./scripts/mysql_install_db script, or is it just install_db?).

The README / INSTALL in the tarball IIRC gives details about the install procedure and how to create a mysql user in a mysql group and set the relevant access rights for the /mysql directory and /mysql/data directory. It's pretty similar to what Initself said.

Knock yourself out ... now if I could only get php to work properly!

pbhj

initself 08-08-2003 10:14 AM

Re: Re: Apache PHP MySQL Setup after Slackware 9.0 Installation
 
Quote:

Originally posted by ne21
[B]I have a question about this part of the install...in the httpd.conf...is there a specific location in the file you do this? Do you have to add the LoadModule part in the section where all the other modules are loaded and place the others elsewhere? Or can you just add this section to any other location?
Actually I don't believe there is a specific location in the httpd.conf file but I would recommend adding those codes to sections with similar code. I updated the tip:

2. Add PHP support to httpd.conf:

#vi /etc/apache/httpd.conf - add the following to sections containing similar code:

LoadModule php4_module libexec/libphp4.so
AddModule mod_php4.c
AddType application/x-httpd-php .php

initself 08-08-2003 10:20 AM

Quote:

Originally posted by BigBadPenguin
good call on the rc.httpd, otherwise this post was excellent (shame i just saw it after struggling to install apache on this comp...) As far as adding php to httpd.conf goes, it should just be a matter of uncommenting lines that are already there, so search for them and you'll be sure the lines are in the right place.
I updated the first tip as well:

1. Add Apache to startup scripts:

# vi /etc/rc.d/rc.local
echo Starting Apache server:
apachectl start

An alternative solution to make Apache start automatically on boot: chmod 755 /etc/rc.d/rc.httpd

There's more than one way to do it!

mb

KevB 08-10-2003 01:09 PM

Thanks very much for these instructions, but I have a problem I wonder if anyone else has?

I'm using the full install of Slackware 9 and followed all the instructions in this post. I have apache & mysql up and running and PHP appears to work as the the phpinfo() function works correctly.

My problem happens when I try to access my public_html directory under my home directory. When I visit:

http://localhost/~kev

I get a directory listing and not the index.htm as I would expect.

And my other problem is when using an HTML page with a form that posts data to a PHP file, when I try to Post I get:

405 Method not allowed
The requested method POST is not allowed for the URL /~kev/search.html

Can anyone please help me with this?

initself 08-10-2003 01:18 PM

Quote:

Originally posted by KevB
My problem happens when I try to access my public_html directory under my home directory. When I visit:

http://localhost/~kev

I get a directory listing and not the index.htm as I would expect.
The URL you are using assumes you have a directory called '~kev' added to /var/www/htdocs. You probably don't have that directory in there so you are probably getting a blank index. With Apache running, typing localhost into your browser is going to run the index.html file located in /var/www/htdocs. So you need to either edit that file or tell type a URL with a specific file or directory that you create there.

For example: http://localhost/kev/test.php
Quote:

And my other problem is when using an HTML page with a form that posts data to a PHP file, when I try to Post I get:

405 Method not allowed
The requested method POST is not allowed for the URL /~kev/search.html

Can anyone please help me with this? [/B]
Again, sounds like a problem regarding creating the proper dirctory and file in /var/www/htdocs.

mb

ne21 08-10-2003 04:39 PM

Also, if you get that error and you do in fact have the directory called ~kev make sure it is chmod at least 755 or it will likely not execute. Also, did you edit your httpd.conf file to tell Apache to accept .htm files? By default, Apache only translates .html files

BigBadPenguin 08-10-2003 07:21 PM

If you're using php, you probably want acceptance for php files too. The line you're looking for is "DirectoryIndex index.html... " just add index.htm and index.php and you're set. (well, with that problem anyway.)

KevB 08-14-2003 01:06 PM

Thanks for the posts guys, but none of them help me. I'm using a users directory, which is correctly setup, if anyone didn't know you create a directoy called public_html in the users home dir and then access it by:

http://localhost/~username

I've tried my php files in that folder and also in the default document root and both won't allow posting of forms.

Has anyone managed to get this working from a fresh install of Slackware 9???

Shah 08-17-2003 03:17 AM

KevB

Yes I have managed to get it working.
Thanks for your post because I just started using the public_html folder.

I don't think I can help you about posting forms, but if you are saying you can't view the page, try sorting out the permissions.

For directories I usually just give execution rights (chmod 771) so that no one can see the folder through their browsers. And for files I give read rights (chmod 774) just to allow the files to be viewed in the browsers.

To view it I use the url: http://myhostname.com/~shah/phpfile.php

If you don't specifiy the file then the default index.html will load that is if you have one. If you don't then obviously either your dir is shown or forbidden to access.

Hopefully my newbie knowledge of php,apache helps.

jaeger2345 08-17-2003 03:16 PM

Quote:

3. Set permissions on MySQL files:

# cd /var/lib
# chown -R mysql mysql mysql
# chgrp -R root mysql mysql
# su mysql
$ mysql_install_db
$ safe_mysqld --user=mysql & [hit enter once the db loads]
$ exit
# mysqladmin -u root status [verify the database is running]
Using slack-9.0. Only trying to get mysql going; don't care about php or apache, but this bit should work even so, right?

I did all that, and it goes fine through (as user mysql) safe_mysqld --user=/mysql &

Then:
root@brightstar:/var/lib# mysqladmin -u root status
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

I've tried giving it a password (using -p), I've tried using mysqladmin as mysql, I still get "Access denied".

As mysql, run 'mysqlshow mysql' --> Access denied.

From the VERY little I understand, mysqladmin is what should allow me to allow other users to connect and create databases. But, if I can't run mysqladmin ... ??!

This is after having installed mysql when I first upgraded to 9.0; I tried upgrading to 4.0 with a package from LinuxPackages.net, but got the same basic problem. Removed that package, made sure /var/lib/mysql was deleted, re-installed 3.23.56 from slack-current.

Shah 08-17-2003 07:29 PM

Well I can actually run 'mysqladmin -u root status' without a problem but when I try to do anything else I get the error you get. I havn't been looking at it much yet.
But is there enyone that has had this problem and sorted it out?

pbhj 09-03-2003 06:53 AM

<newb alert - apply pinchOfSalt>

It may help to know that mysql opens a port (quite a high number that I can't remember). This means you can check if it's running (and nothing else) by "nmap localhost".

MySQL is not automatically started on reboot ... I haven't looked into how to do this yet but you need to run the "./bin/safe_mysqld" script from your mysql directory to do this manually. For some reason this doesn't work from other directory locations (on my system at least).

figadiablo 09-03-2003 12:22 PM

I see that you are trying Slackware, so for this distro edit the /etc/rc.d/rc.local script and add the line "safe_mysqld". This should start it automatically after each reboot.

Luck
Figa

dark-dude 09-06-2003 10:26 PM

does mysql apache and php all install with slack 9.0? I did the full install... and what i was wonderin was how do you use phpmyadmin? i can't seem to figure this out

linuxJaver 09-07-2003 09:15 AM

Quote:

Astor wrote:
Personally I never liked how slack installed apache/php/sql from 8.0, so I install them myself from source. :-)
Me too, I do understand the reason for distributing them among /etc, /var, /lib .. for linux core packages (no question).

But for such additional, big software packages n those frequently released software packages, I'd prefer to have them on their own directory like kde on /opt/kde, {apply also to netscape, mozilla, ..} for easier for maintaining, upgrading. Maybe later drop them into another CD in later realese .. :D

rivang 12-08-2003 04:49 PM

Just wondering does these setup tips still apply to Slackware 9.1 or is it all setup when you install it?

Thanks...

deanglass 12-09-2003 03:03 AM

Its all sorted now. It relates to RH9 and was available on installation. Thanx anyway

Veeb0rg 12-20-2003 06:48 AM

Quote:

Originally posted by rivang
Just wondering does these setup tips still apply to Slackware 9.1 or is it all setup when you install it?

Thanks...

everythings worked for me upto the safe_mysqld part.. i don' seem to have it on my system *fresh install, only kernel upgraded*

*edit*

9.1 users have to use mysqld_safe instead of safe_mysqld


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