LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-20-2012, 02:13 AM   #1
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 269
Blog Entries: 2

Rep: Reputation: 48
Install php web site project on apache2


I am using operating system ubuntu 10.10.
I want to install a website (in php) on apache2 on my localhost.
I do not want it to install in /opt/lampp/htdocs. I can run the website by apache using http://localhost/website-directory-name
I want to install it in /var/www and want to run it through apache2.Please tell me the process to install and run website using apache2.
 
Old 03-20-2012, 04:24 AM   #2
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
The default location for the web documents for Apache under Ubuntu is /var/wwww, not /opt/lampp/htdocs. In any case, it is a simple matter of defining this with the document root directive in your configuration file.

The process to install Apache in Ubuntu is:
Code:
sudo apt-get install Apache2
The Ubuntu Server Guide provides a lot more detailed instructions.
 
Old 03-21-2012, 01:01 AM   #3
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 269
Blog Entries: 2

Original Poster
Rep: Reputation: 48
Quote:
Originally Posted by Noway2 View Post
The default location for the web documents for Apache under Ubuntu is /var/wwww, not /opt/lampp/htdocs. In any case, it is a simple matter of defining this with the document root directive in your configuration file.
The process to install Apache in Ubuntu is:
Code:
sudo apt-get install Apache2
The Ubuntu Server Guide provides a lot more detailed instructions.
That what's I am saying, that I have installed apache2 already. I want to install project in /var/www. I have done it too but I am not able to run this project using http://localhost/project-name
The apache2 is working fine but when I try to run my project, it gives me the download link of the project instead of running it.
 
Old 03-21-2012, 08:11 AM   #4
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
Quote:
The apache2 is working fine but when I try to run my project, it gives me the download link of the project instead of running it.
This generally indicates that Apache is lacking the proper plugin to parse and interpret a scripting language. What type of file is it? For example, if it is PHP, you need to both install PHP and tell Apache to parse index.php. Also, to use http://localhost/projectname, you need to have a directory named projectname with the proper permissions and (indexed) files, such as index.html or index.php in it.
 
Old 03-22-2012, 02:52 AM   #5
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 269
Blog Entries: 2

Original Poster
Rep: Reputation: 48
Quote:
Originally Posted by Noway2 View Post
This generally indicates that Apache is lacking the proper plugin to parse and interpret a scripting language. What type of file is it? For example, if it is PHP, you need to both install PHP and tell Apache to parse index.php. Also, to use http://localhost/projectname, you need to have a directory named projectname with the proper permissions and (indexed) files, such as index.html or index.php in it.
My project name is mywebapp that is in /var/www. when I try to access this from browser using
Code:
http://localhost/mywebapp
I get the save as box, see the attachment.
i have installed php, apache2, mysql, perl all necessary things because I run bugzilla from /var/www successfully using http://localhost/bugzilla but I am not able to run this project.
The same project is running successfully using /opt/lampp/htdocs when I run through apache but I want to run it through apache2 thats why i am trying to run it through /var/www
If you want any other necessary info regarding this issue, please comment.
Attached Images
File Type: png Screenshot.png (133.5 KB, 8 views)

Last edited by fortran; 03-22-2012 at 03:03 AM.
 
Old 03-30-2012, 12:44 AM   #6
fortran
Member
 
Registered: Nov 2011
Location: Cairo, Egypt
Distribution: CentOS, RHEL, Fedora
Posts: 269
Blog Entries: 2

Original Poster
Rep: Reputation: 48
I have found the solution of this problem. May be this can help for future users.
The html project was running fine. The problem was with php files. so I had to enable the php module using-
Code:
$ sudo a2enmod php5
but it was giving error
Code:
ERROR: Module php5 does not exist!
I tried to find php5.conf file in /etc/apache2/mods-available but it was not there. I made it myself and put the following code in it.
Code:
   <IfModule mod_php5.c>
     AddType application/x-httpd-php .php .phtml .php3
     AddType application/x-httpd-php-source .phps
   </IfModule>
Now there should be php5.load file in /etc/apache2/mods-available but it was not there too.I made it too myself and put the following code in it.
Code:
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so
Note:- i just checked that libphp5.so was available or not at its given path and my good luck, it was there.

Now I made links of php.conf & php.load and put links into /etc/apache2/mods-enabled
Code:
ln -s /etc/apache2/mods-available/php5.conf /etc/apache2/mods-enabled/php5.conf
ln -s /etc/apache2/mods-available/php5.load /etc/apache2/mods-enabled/php5.load
Now I ran-
Code:
$ sudo a2enmod php5
This time it gave me message-
Code:
Enabling module php.
   Run '/etc/init.d/apache2 restart' to activate new configuration!
The problem is solved ,Now I could run my php-web-project through apache2. The path of php-web-project is /var/www/php-web-project

Note:- If the command $ sudo a2enmod php5 gives error. Change file name php5.conf to php.conf, php5.load to php.load and change the name of links respectively php.conf & php.load and run the command $ sudo a2enmod php

Now project should be run fine.
If you are not able to log-in. It means data base is not connected properly. Restart mysql server. If you are still not able to do this.
Open your config file of php-project and change host name 'localhost' to '127.0.0.1'.
Now it should work fine.

Last edited by fortran; 03-30-2012 at 12:46 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: Announcement: RapidDisk Project: New release, web site, and more... LXer Syndicated Linux News 0 02-08-2012 08:40 AM
LXer: Announcement: RapidDisk Project: New release, web site, and more... LXer Syndicated Linux News 0 02-08-2012 01:30 AM
LXer: Apache2: How To Redirect Users To Mobile Or Normal Web Site Based On Device Using mod_rewrite LXer Syndicated Linux News 0 09-09-2011 01:30 PM
LXer: FSF/GNU Project Web Site Overhauls Make Navigation Easier LXer Syndicated Linux News 0 10-16-2007 05:40 AM
Web site to organize a project? General General 0 09-10-2005 03:41 AM


All times are GMT -5. The time now is 01:45 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration