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.
Hi everybody, I have just installed Mandrake 9.1, and this is the first time I've ever dealt with linux. I got a project involving PHP & mySQL. When I installed Mandrake, there the option for installing Apache and mySQL (I chose those options), however, there's nothing about PHP.
I just need some guidance regarding these following questions:
1. Do we have to install something like a PHP editor/compiler?
2. How to access mySQL? i.e. create tables, query
3. As a windows user, usually we have a virtual directory (under inetpub\wwwroot). Does that concept also apply to linux? If yes, where is the location of the virtual directory?
Apache is installed, so you can now install PHP. You will uncompress the PHP package, giving you a directory named "php-4.3.2". You must change into this directory. Use the standard UNIX/Linux way of building and installing software from source; configure, make, and then make install.
To add PHP to Apache:
You must also edit the httpd.conf file which is usually located in /where/ever/apache/conf. You must add the following lines:
#
# This will load the PHP module into Apache. Put this line
# with other LoadModule lines.
#
LoadModule php4_module
libexec/libphp4.so
#
# This next section will add a handler for .php files, put it with other
# IfModule lines.
#
<IfModule mod_php4.c>
AddType application/x-httpd-php .php
</IfModule>
Oooops. If you are totally new then I guess you don't know how to untar a file yet either?
tar zxvf filename.gz
Here's the steps I followed for an oracle database.
# tar zxvf php-4.3.3.tar.gz
# cd php-4.3.3
# ./configure --with-oci8=$ORACLE_HOME \
--with-apxs=/usr/local/apache1.3.28/sbin/apxs \
--enable-sigchild
# make
# make install
# cp php.ini-dist /usr/local/lib/php.ini
Hopefully you will find the proper config method for MySQL
on PHP-MySQL
Thanks alar for your information. However, I'm still struggling with the basic stuffs.
Here are some of them:
1. I can't access my cdrom and floppy disk. I go to /mnt, and there are /cdrom & /floppy, however, when I access it, it's empty (I have CDrom/floppy in their respective drive). Even the LED doesn't light when I access the cdrom/floppy, i.e. it deosn't seem that the system is accessing it.
2. How to check that the apache has already running properly?
3. How to access mySQL? Does it have a GUI like Microsoft SQL Server 2000?
apache
navigate to apache directory
/usr/local/apache
or
/your/path/to/apache
cd to the bin directory (or sbin sometimes)
run
./apachectl start
./apachectl stop
Don't know SQL Server. You can use apache to access the database.
Accessing mySQL via the command prompt is also an option. After you have mySQL set up with a password for root and everything you can look to here some basics.
Thanks hypexr! I got the Apache running already. I got mySQL installed from the Mandrake 9.1 Installation package. However, when I tried the following command:
# mysql
It says: "ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
# mysqladmin -uroot create testDB
It says: "mysqladmin: connect to server at 'localhost' failed
error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
Actually, the file '/var/lib/mysql/mysql.sock' doesn't exist in my machine.
Fixed that. I haven't start MySQL on the service (Stupid!)
Anyway, I installed MySQL, PHP and Apache all from Mandrake 9.1 packages. Now I need to set some configuration which involves the knowledge of the directories in which they are installed. Can anyone help me with the default directory which MYSQL, PHP and Apache are usually installed?
One more thing, http://localhost actually points to which directory?
If a Mandrake user does not respond with the directories that these are installed in, you can use find to see where they might be:
Code:
find / -name 'apache*' -type d -print 2>/dev/null
Hope this helps.
Edit: The directory where your html documents are usually at is www or html. You can search for one of these or search for index.html and find the correct result.
If a Mandrake user does not respond with the directories that these are installed in, you can use find to see where they might be:
If you are totally new to Linux you may not know the which command
It will find a program in your path. Especially to find something like apache
which is typically in an /sbin (only visible to root)
you should probably execute as root.
su - root
which httpd
I think it's called apache on windows, but on (Li)nux it is httpd
The su with a '-' is to inherit the variables (.profile) of the user u wish to become
Have Fun,
alar
BTW- http://localhost points to the directory defined in your httpd.conf as DocumentRoot
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/alar/Gonna_be_Web_Stuff/htdocs"
Thanks guys! Now I can display a PHP page. However, there's 1 problem:
If I used the default localhost as defined in httpd.conf which is "/var/www/html/", my test page (which is test.php) will be displayed correctly in the browser (http://localhost/test.php)
But when I changed the DocumentRoot into any other path (let's say "/var/www/HR/", test.php won't be displayed. Instead, it gives me error 403 Forbidden. I figured that in the default localhost there's a directory called "addon-modules" which contains ".htaccess". My guess is that ".htaccess" is the one that is controlling the permission. Well, I have tried duplicating that file into the "/var/www/HR/addon-modules", restarting apache, but I still got the same error (Forbidden).
Ugh, I didn't change the directory path for permission in the commonhttpd.conf... Now I got it working!
I tried phpMyAdmin for mySQL and it also works fine!
Thanks a lot for your help guys! I really appreciate it!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.