Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm new in server-side programming. I need lampp and mysql running on my computer. I have installed mysql using tasksel lamp-server, and then install php with apt-get install libapache2-mod-php5 phpmyadmin. And now I have now ideas how to use them. In xampp on Windows I needed only to copy my php files in htdocs directory. How to run php files in Linux and connect them to my MySQL?

share|improve this question
add comment

3 Answers

I'm not sure if I understood your question, but if you just installed the lamp-server, you should have implicit installed apache web server.

AFAK the default directory where you have to put your files into is /var/www/. Just go to http://localhost (or which host you're running on) and check if you see something.

Per default the apache server, and the mysql database should be started automatically after boot. So you don't have to start them as with xampp.

If you're seeing any output on http://localhost it should contain a description, how to change the content. But it should be placed under /var/www/.

The mysql connection is the same as on windows, as you write it in PHP. The mysql database should run on the port 3306.

Also you can check this site where getting PHP running with tasksel is described.

share|improve this answer
add comment

What I have understand is, you want to install xampp server just like you did using Windows.

If this is what you want, download and install xampp from here

This xampp suite contain apache server, mysql server, php, perl, and phpmyadmin.

Installation and configuration instructions of xampp can be found here

This way, you don't need to install mysql or php separately.

If you follow instructions correctly, you will find your htdocs directory at /opt/lampp/htdocs

share|improve this answer
add comment

Maybe you should install the following software first.

sudo apt-get install apache2
sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install php5
sudo apt-get install php5-gd
sudo apt-get install php5-mysql
sudo apt-get install phpmyadmin

and then, you should configure you server. 1, Test apache, open you browser, and enter 127.0.0.1, if "It Works!" appears, okay. 2, Test php, create a file under /var/www, and name is "index.php", the content is:

<!--?php phpinfo(); ?-->

save and open the url "127.0.0.1/index.php", the php info should appear, if not, make sure you have proper permission.

3, Configure and test you phpmyadmin. first, run as root,

sudo -i               #run as root
cd /etc/apache2/conf.d

and then create a file named "phpmyadmin-web.conf" or other you like, and the content of the file is:

Alias /phpmyadmin /usr/share/phpmyadmin
<directory usr="" share="" phpmyadmin="">
   AllowOverride All
</directory>

finally, you also should make a symbol link:

sudo ln -s /var/www/phpmyadmin /usr/share/phpmyadmin

then restart you apache server

sudo /etc/init.d/apache2 restart

Now, you can use your ubuntu as a lamp server.

share|improve this answer
    
I tried what was said and get –  Nick Sargsyan Jun 21 '12 at 6:34
    
Forbidden You don't have permission to access /1.php on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. –  Nick Sargsyan Jun 21 '12 at 6:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.