LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-13-2010, 11:04 PM   #1
dhelyar
LQ Newbie
 
Registered: Nov 2009
Posts: 5

Rep: Reputation: 0
Trying to access website over SSH, apache is sending unparsed PHP


Ok, the server is:

Ubuntu 9.10
Apache2
Php5

All is working if I view the server web pages using VNC, however if I try and access the web page over SSH using the following .ssh/config forwarding:

LocalForward 8000 localhost:80

and the web address http://localhost:8000

HTML files show up fine in browser, however PHP files are not parsed and are interpretted as downloadable files rather than view in browser.

Thanks for any advice

EDIT:

Ok I just tried using port 80 instead of 8000, and this parses the PHP fine, however this required me to run ssh client as root, as well as turn off my local web server.

Two things I'd just prefer not do, and also I imagine there must be a way of fixing this on the server apache config?

Last edited by dhelyar; 11-13-2010 at 11:57 PM.
 
Old 11-14-2010, 01:27 AM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi -

You're exactly correct:
1. Apache is basically working, and PHP is working

2. The only problem is that port 80 is configured to "understand" php, and port 8000 isn't.

3. All you have to do is to modify your Apache configuration on the server.

For example, in my Ubuntu 9.10 server, I have the following:
Code:
/etc/apache2/mods-enabled/php5.conf =>
<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
  ...

/etc/apache2/mods-enabled/php5.load =>
LoadModule php5_module /usr/lib/apache2/modules/libphp5.s

... and, in my apache2.conf ...

/etc/apache2/apache2.conf =>
...
# Include module configuration:
Include /etc/apache2/mods-enabled/*.load
Include /etc/apache2/mods-enabled/*.conf

# Include all the user configurations:
Include /etc/apache2/httpd.conf

# Include ports listing
Include /etc/apache2/ports.conf
...

Last edited by paulsm4; 11-14-2010 at 04:12 PM. Reason: Change example port "8080" to "8000"
 
Old 11-14-2010, 04:17 AM   #3
j-ray
Senior Member
 
Registered: Jan 2002
Location: germany
Distribution: ubuntu, mint, suse
Posts: 1,591

Rep: Reputation: 145Reputation: 145
You could create a virtual host that listens n port 8000 or whatever. In /etc/apache2/sites-available you find a default configuration you can copy and symlink to sites-enabled directory. Put a
Listen 8000
above and give the virtual host a name and restart the server...

http://httpd.apache.org/docs/2.2/vhosts/
 
Old 11-14-2010, 04:15 PM   #4
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, dhelyar -

You *may* use vhosts. But you don't *have* to.

The issue of whether or not .php files are interpreted or should be more or les *independent* of whether you're using a vhost or not.

The point I was trying to make in my response was to give you an example solution that would work in *all* situations, *regardless* of whether you used vhosts or not.
 
  


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
php website hosting problem on apache arafat khaliq Linux - Server 3 11-01-2010 02:50 PM
CMS for simple website on apache php ufmale Linux - Newbie 1 03-27-2009 04:09 PM
PHP mail() sending as apache@ipaddress DukeLeto Linux - Software 1 04-13-2007 10:24 PM
Develope website in PHP with Mambo: Apache? Lead Expression Linux - Networking 2 09-19-2005 10:32 AM
can only access apache website from within network kubrickfan799 Linux - Networking 3 08-10-2004 06:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 07:24 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