LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-29-2008, 03:26 PM   #1
Penthux
Member
 
Registered: Dec 2008
Location: Middlesbrough, UK
Distribution: Slackware
Posts: 264

Rep: Reputation: 74
How-To run Apache, php, MySQL on startup and install phpMyAdmin - Slackware 12.2


After a new install of Slackware 12.2, I carried out the following procedures to get everything working successfully right out of the box.
The server is a standalone system, used for testing and educational purposes, so please bear that in mind.

NB: Throughout this post when you see a single # at the start of a line it means you are typing the commands as root user. You should not include the #, only the text after it.

### setup Apache with php enabled
Login as root user on your Slackware box and type:
# pico -w /etc/httpd/httpd.conf

Press CTRL+w to search and type mod_php.conf to find this line:
#Include /etc/http/mod_php.conf
Uncomment it, just remove the # from the begining of the line.

Also find the following line:
DirectoryIndex index.html
Change it to this:
DirectoryIndex index.html index.htm index.php default.htm

Save the file and exit ( press CTRL+x ). Now type this:
# chmod 755 /etc/rc.d/rc.httpd
# /etc/rc.d/rc.httpd start

If the httpd server is not already running, you should have Apache and php running. Your web file root directory is: /var/www/htdocs
If you receive the message "httpd (pid 12345) already running" (NB: pid is just here for example and can be any value), type this:
# /etc/rc.d/rc.httpd restart

Open your browser and go to http://localhost/ and you should see this big bold message on a blank white page: It Works!

### Extra - test php is working ###
To test php is working, back on the command line type this:
# pico -w /var/www/htdocs/info.php

Copy and paste the following text into the pico text editor, or type it:
<?php
phpinfo();
?>

Press CRTL+x and save the file as info.php, or any filename you like with the .php extension.

In your browser go to http://localhost/info.php (or the filename you chose, obviously!)
You should be presented with a nice page full of information which means php is working perfectly.


### setup MySQL (secure installation)
Still logged in as root user, to setup MySQL type this:
# chmod 755 /etc/rc.d/rc.mysqld
# mysql_install_db
# chown -R mysql:mysql /var/lib/mysql
# cp /usr/share/mysql/mysql.server /etc/rc.d/rc.mysql
# chmod 755 /etc/rc.d/rc.mysql
# /etc/rc.d/rc.mysql start
# /usr/bin/mysqladmin -u root password 'password'
** ( NB: the password for MySQL root user will now be: password )
# mysql_secure_installation

Enter your password when requested ( password is: password ), follow the prompts, answering ALL questions. Then type:
# /etc/rc.d/rc.httpd restart

Now the MySQL database should be running too.

#### install phpMyAdmin 3.1.1
Again, as root user type:
# cd /var/www/html
# wget http://ovh.dl.sourceforge.net/source...english.tar.gz
# tar zxvf phpMyAdmin-3.1.1-english.tar.gz
# mv phpMyAdmin-3.1.1-english phpmyadmin
# cd phpmyadmin
# cp config.sample.inc.php config.inc.php
# pico -w config.inc.php

Now edit this line by putting anything between the quotes:
( The example here is 'your_text', you can use any letter or number combination but NO special chars! )
$cfg['blowfish_secret'] = 'your_text'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Also change 'cookie' to 'http' on this line:
$cfg['Servers'][$i]['auth_type'] = 'http';
exit and save ( press CRTL+x )
# /etc/rc.d/rc.httpd restart

Open your browser and go to http://localhost/phpmyadmin/ and you should be presented with either a login prompt or the phpMyAdmin interface, depending on your selections during the MySQL secure install process.

user: root
password: password

NB: if you changed the mysql root password, during the secure installation, use the new password.

### eof

I thought this might be a good idea for new(ish) Slackware users as there seems to be a little confusion about setting up Apache/php/MySQL.
Any corrections, additions, advice, suggestions or otherwise are, of course, gladly welcome. :>
 
Old 12-31-2008, 05:39 AM   #2
ErV
Senior Member
 
Registered: Mar 2007
Location: Russia
Distribution: Slackware 12.2
Posts: 1,202
Blog Entries: 3

Rep: Reputation: 62
I think the better place for this would be in your blog. But it is up to you.
 
Old 01-14-2009, 02:04 PM   #3
440Music
LQ Newbie
 
Registered: Jan 2009
Location: Chicago, IL USA
Distribution: CentOS 6.4
Posts: 11

Rep: Reputation: 0
Thumbs up

Penthux,

Thanks for the info, I'd been trying to start MySQL for a couple of days and when I located this entry I found the correct answer. This wasn't a priority as I also had an error with my ATI Radon 9800. Now I can get back to testing my development on a local server.

TBones
440MUSIC.COM Internet Radio
Beyond The Reach Of Satellite
 
Old 01-14-2009, 03:36 PM   #4
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
why do you do

Quote:
# cp /usr/share/mysql/mysql.server /etc/rc.d/rc.mysql
# chmod 755 /etc/rc.d/rc.mysql
# /etc/rc.d/rc.mysql start
?

Brian
 
Old 01-14-2009, 06:09 PM   #5
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
If I remember correctly that's what the mysql documentation says to do. Certainly not required with recent versions of Slackware though.

Another optional step would be to copy (or create) an /etc/my.cnf file first. There are already sample /etc/my-{small,medium,large,huge}.cnf files that can be copied into place.

Probably something worth mentioning that is often mis-understood is that the root mysql user (and all mysql users) are totally separate from the system accounts. The passwords for all mysql accounts are stored in the mysql database itself.

Last edited by mRgOBLIN; 01-14-2009 at 06:12 PM.
 
Old 01-14-2009, 06:20 PM   #6
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
Quote:
Originally Posted by mRgOBLIN View Post
If I remember correctly that's what the mysql documentation says to do.
Ah, yes, you are quite right.

Penthux: on slackware you should be able to shorten the mysql part to:

Code:
# chmod 755 /etc/rc.d/rc.mysqld
# mysql_install_db --user=mysql
# /etc/rc.d/rc.mysqld start
# mysql_secure_installation  (this will prompt to set the root password)
Also, I don't think you need to restart apache after installing phpMyAdmin.

Brian

Last edited by BCarey; 01-14-2009 at 06:22 PM.
 
Old 01-15-2009, 01:18 PM   #7
440Music
LQ Newbie
 
Registered: Jan 2009
Location: Chicago, IL USA
Distribution: CentOS 6.4
Posts: 11

Rep: Reputation: 0
I was able to get MySQL running because of this info but I'm still having trouble with PHP. I've scanned 20 to 30 post about PHP but still no luck. When I try to look at info.php I get a blank page, no error just a blank page.

<?php
phpinfo();
?>

That is what is in my test page. I only have PHP5 loaded on the Slackware 12.1 server

TBones

Last edited by 440Music; 01-15-2009 at 01:28 PM.
 
Old 01-15-2009, 05:00 PM   #8
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Usually a blank page is indicative of a syntax error.

If that is the only code in your page then I would take a look at your error logs (/var/log/httpd/error_log by default) see if something shows up there.
 
Old 01-15-2009, 05:49 PM   #9
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,268
Blog Entries: 24

Rep: Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195Reputation: 4195
Hi 440Music,

Quote:
Originally Posted by 440Music View Post
I was able to get MySQL running because of this info but I'm still having trouble with PHP.... When I try to look at info.php I get a blank page, no error just a blank page.
From that and the previous posts in this thread it is not at all clear to me how you have things set up and how you are trying to look at the page. You really only state that you have mysql going, presumably from the command line (ie, not from an http process).

So, to be very clear you need to know:
1. That you have the http server running
2. That it is configured to handle php code
3. That you are accessing the page via an http request (ie, not a simple file request).

So, for the first two parts, be sure to edit /etc/httpd/httpd.conf as indicated in the first post, uncomment #Include /etc/http/mod_php.conf and restart the httpd server with /etc/rc.d/rc.httpd restart (as root). To see if it is working you should be able to open a browser, enter the address http://localhost/index.html and get a recognizable response page (/var/www/htdocs/index.html by default as I recall).

Next, unless you have set up another server root path or some virtual hosts, copy your info.php file to /var/www/htdocs/ and in your browser enter the address http://localhost/info.php - that should show the php info you are looking for.

I suspect from your post that you might be trying to open your info.php file as a file from your browser, but not as an http request, in which case you will get the blank page you describe.

You should also copy one of the /etc/httpd/php.ini-recommended or other files to /etc/httpd/php.ini, edit it and set the lines...
Code:
error_reporting = E_ALL
display_errors = on
That will allow PHP errors to be passed through to your pages.

Hope this helps!
 
Old 01-16-2009, 12:03 AM   #10
duryodhan
Senior Member
 
Registered: Oct 2006
Distribution: Slackware 12 Kernel 2.6.24 - probably upgraded by now
Posts: 1,054

Rep: Reputation: 46
I just find it ridiculously more simple to use xampp , it comes with all this and many other tools, is fast easy to configure , secure and makes my life easy .. just untar and you are ready to go (so if I want to reinstall etc. I don't loose the mysql tables )

and security updates are also installed easily

(not that slackware's security updates are any harder)
 
Old 01-16-2009, 12:57 AM   #11
mRgOBLIN
Slackware Contributor
 
Registered: Jun 2002
Location: New Zealand
Distribution: Slackware
Posts: 999

Rep: Reputation: 231Reputation: 231Reputation: 231
Unless you run the mysql_install_db again you won't lose any tables with an upgrade using the standard packages. That is intended to only set up the initial DB structure.

If you are really concerned you can backup with mysqldump (or even a copy of /var/lib/mysql if the server isn't running) before the upgrade. (should be doing this anyway)

Staying up-to-date is also much easier if you stick with the stock packages.. it really isn't difficult and it's explained in many places.

One thing to be aware of is there are some X lib dependencies for some of the modules such as gd. I've listed them before in another thread.
 
Old 01-16-2009, 09:27 AM   #12
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
440Music,

Check the apache logs (/var/log/httpd/error_log). It must be some kind of syntax error.

Brian
 
Old 01-16-2009, 12:37 PM   #13
440Music
LQ Newbie
 
Registered: Jan 2009
Location: Chicago, IL USA
Distribution: CentOS 6.4
Posts: 11

Rep: Reputation: 0
Thanks, I found the error and got it corrected. I ran into trouble when I installed PHP5. It was already installed and I created a conflict.

Thanks for the help,
TBones
 
Old 01-16-2009, 03:03 PM   #14
BCarey
Senior Member
 
Registered: Oct 2005
Location: New Mexico
Distribution: Slackware
Posts: 1,639

Rep: Reputation: Disabled
Quote:
Originally Posted by duryodhan View Post
I just find it ridiculously more simple to use xampp , it comes with all this and many other tools, is fast easy to configure , secure and makes my life easy .. just untar and you are ready to go (so if I want to reinstall etc. I don't loose the mysql tables )

and security updates are also installed easily

(not that slackware's security updates are any harder)
xampp may be a better tool for you, but setting this up in slackware is also pretty ridiculously easy.
To set up php you uncomment one line in one file.
Setting up mysql is a matter of issuing four commands.
And you get to keep the well-maintained standard slackware packages on your system.

I'm not criticizing or trying to convince, I just want to make clear to anyone looking to do this and reading this thread that configuring the already installed software is really easy. It happens frequently that people assume the stuff is not there, install some of the components from somewhere, and run into trouble. Indeed that happened in this case. (Knowing about and) using what's there gives you benefit from the robust, reliable, well-tested system for which Slackware is famous.

Brian

Last edited by BCarey; 01-16-2009 at 03:11 PM.
 
Old 02-11-2009, 09:41 PM   #15
bsurfin
Member
 
Registered: May 2004
Location: Kalispell Montana
Distribution: Ubuntu 18.04LTS
Posts: 143

Rep: Reputation: 16
Now the MySQL database should be running too.

#### install phpMyAdmin 3.1.1
Again, as root user type:
# cd /var/www/html

This is where I got stopped in my tracks, here is the output:
bash: cd: /var/www/html: No such file or directory

I also physically opened the folders by clicking on the home folder, var, www, no html file inside, should I just add it as root?
 
  


Reply



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
deb 4.0: how to install apache2, mysql 4.1, php 4 and phpmyadmin tonguim Debian 10 11-09-2007 10:39 AM
Problems with apache/php/mysql/phpmyadmin Using DEBIAN antinull Linux - Server 4 11-06-2007 04:02 PM
install Apache, MySQL, PHP, and phpMyAdmin for offline use? Kandiman Ubuntu 4 03-01-2007 01:35 PM
How do I know that apache, MySql, PHP, phpMyAdmin is Installed AskMe Linux - Newbie 7 02-04-2004 05:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:23 PM.

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
Open Source Consulting | Domain Registration