LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   After moving PHP files to /var/www they no longer are seen as hosted php files (https://www.linuxquestions.org/questions/linux-server-73/after-moving-php-files-to-var-www-they-no-longer-are-seen-as-hosted-php-files-791563/)

scheidel21 02-25-2010 02:30 PM

After moving PHP files to /var/www they no longer are seen as hosted php files
 
1 Attachment(s)
I hope I have the right forum. I also did some googling beforehand, but I didn't find anything that helped me.

I am setting up a Demo website that I am hosting in a Debian Lenny VM, I have installed Apache, mySQL, and PHP5 I know the php server is working because if I place an info php file I can see it in the browser. However, I downloaded phpfusion, as well as phpmyadmin and they are on my desktop, I open a superuser file browser (also added write access to /var/www to everybody and copied the files over as me) and copied over the files. Once in the www folder they are no longer seen as "valid" php files, if I try to access them with iceweasel, IE, Konquerer it asks me if I want to download the file. If I look at the files on my desktop they have different icons. I have attached a screenshot. I can't tell what the difference is, but obviously there is one otherwise the icons wouldn't be different. Does anyone have any idea what's going on here or a way to rectify it? I have done things like this before without issue, I've never seen this problem.

Thanks in advance for the help.

evo2 02-25-2010 02:36 PM

Screen shots of file browsers don't provide very useful information.

Please post the output of:
Code:

ls -l /var/www
Different themes probably have different icons.... file browsers should be avoided when trying to do real work.

Also, please check your apache logs.

Evo2.

fylnq 02-25-2010 02:38 PM

What does your apache configuration look like?

scheidel21 02-25-2010 03:24 PM

Here is the ls -l /var/www output. I understand different themes and different DE will use different icons, however, notice that in the left windows all the files have the php icon, in the second with a different theme, one of the documents has the same icon but all the others have gone into like a text document preview mode. I will take a look at my apache config and post it as well in a proceeding post. I have never had an issue like this before.

Code:

MIS-002-Debian:/home/scheidel21# ls -l /var/www
total 3256
-rw-r--r-- 1 root root    1349 2010-02-24 11:11 about.html
-rw-r--r-- 1 root root    1349 2010-02-24 11:09 about.html~
-rw-r--r-- 1 root root    1139 2010-02-23 16:05 About.html
-rw-r--r-- 1 root root    767 2010-02-23 15:49 About.html~
-rwxr--r-- 1 root root  121168 2010-02-24 10:02 AboutUs.jpg
-rwxr--r-- 1 root root 1679532 2010-02-19 10:18 anim.gif
-rwxr--r-- 1 root root 1064714 2010-02-16 16:49 anim-old.gif
-rw-r--r-- 1 root root    1345 2010-02-24 13:51 asg.html
-rw-r--r-- 1 root root    1345 2010-02-24 13:52 ASG.html
-rwxr--r-- 1 root root  84314 2010-02-24 12:44 ASG.jpg
-rwxr--r-- 1 root root    800 1999-12-29 17:17 black.gif
-rwxr--r-- 1 root root    800 1999-12-29 17:17 blue.gif
-rw-r--r-- 1 root root    1686 2010-02-24 15:23 events.html
-rw-r--r-- 1 root root    1682 2010-02-24 14:07 events.html~
drwxr-xr-x 9 root root    4096 2010-01-11 04:27 files
-rw-r--r-- 1 root root    718 2010-02-19 13:37 HESCO.map~
-rw-r--r-- 1 root root    711 2010-02-19 14:00 HESCOMAP.html
-rw-r--r-- 1 root root    711 2010-02-19 13:57 HESCOMAP.html~
drwxr-xr-x 2 root root    4096 2010-01-28 22:08 htdig
-rw-r--r-- 1 root root    133 2010-02-17 16:38 image.html
-rw-r--r-- 1 root root    111 2010-02-17 16:35 image.html~
-rw-r--r-- 1 root root    1909 2010-02-24 10:43 index2.html
-rw-r--r-- 1 root root    1880 2010-02-23 16:30 index2.html~
-rw-r--r-- 1 root root      45 2010-02-15 13:20 index.html
-rw-r--r-- 1 root root      19 2010-02-25 13:50 info.php
-rw-r--r-- 1 root root      2 2010-02-25 13:49 info.php~
-rw-r--r-- 1 root root    671 2010-02-19 13:38 Portal.map
-rw-r--r-- 1 root root    1346 2010-02-24 13:46 prod.html
-rwxr--r-- 1 root root  89002 2010-02-24 12:13 Prod.jpg
-rw-r--r-- 1 root root    1351 2010-02-24 13:50 resources.html
-rw-r--r-- 1 root root    1346 2010-02-24 13:49 resources.html~
-rwxr--r-- 1 root root  78557 2010-02-24 13:02 Resources.jpg
-rw-r--r-- 1 root root    1350 2010-02-24 13:56 serv.html
-rwxr--r-- 1 root root  53326 2010-02-24 12:30 Services.jpg
-rw-r--r-- 1 root root    111 2010-02-17 16:33 Test~
-rw-r--r-- 1 root root    2976 2010-02-17 16:34 Test.html


scheidel21 02-25-2010 03:26 PM

oops also here is ls -l output for the php directory.

Code:

MIS-002-Debian:/home/scheidel21# ls -l /var/www/files
total 372
drwxr-xr-x  4 root root  4096 2010-01-12 09:01 administration
-rw-r--r--  1 root root  6474 2009-08-01 06:58 articles.php
-rw-r--r--  1 root root    0 2008-03-18 17:45 _config.php
-rw-r--r--  1 root root  4869 2009-03-26 17:28 contact.php
-rw-r--r--  1 root root  5681 2008-07-22 21:39 downloads.php
-rw-r--r--  1 root root  6488 2008-06-23 13:34 edit_profile.php
-rw-r--r--  1 root root  3303 2008-07-22 21:39 faq.php
drwxr-xr-x  3 root root  4096 2010-01-11 04:27 forum
drwxr-xr-x  9 root root  4096 2010-01-11 04:27 images
drwxr-xr-x  8 root root  4096 2010-01-11 04:27 includes
-rw-r--r--  1 root root  865 2008-04-04 17:46 index.php
drwxr-xr-x 12 root root  4096 2010-01-11 04:27 infusions
drwxr-xr-x  3 root root  4096 2010-01-11 04:27 locale
-rw-r--r--  1 root root  2952 2008-11-27 15:44 login.php
-rw-r--r--  1 root root  4323 2009-08-01 06:58 lostpassword.php
-rw-r--r--  1 root root 30879 2009-12-11 10:22 maincore.php
-rw-r--r--  1 root root  3031 2009-11-08 10:28 maintenance.php
-rw-r--r--  1 root root  3850 2008-05-23 16:24 members.php
-rw-r--r--  1 root root 30755 2008-12-29 17:34 messages.php
-rw-r--r--  1 root root  5991 2008-06-16 21:41 news_cats.php
-rw-r--r--  1 root root 11021 2008-10-13 01:50 news.php
-rw-r--r--  1 root root 13461 2008-11-27 03:07 photogallery.php
-rw-r--r--  1 root root  9571 2009-08-01 06:58 photo.php
-rw-r--r--  1 root root  7404 2008-07-01 16:03 print.php
-rw-r--r--  1 root root 10878 2009-03-26 17:43 profile.php
-rw-r--r--  1 root root  961 2008-04-21 13:02 readarticle.php
-rw-r--r--  1 root root 13860 2009-08-01 06:58 register.php
-rw-r--r--  1 root root 15131 2009-08-01 06:58 search.php
-rw-r--r--  1 root root 72108 2009-12-07 07:22 setup.php
-rw-r--r--  1 root root  3790 2008-07-22 21:39 setuser.php
-rw-r--r--  1 root root  2926 2008-04-24 16:49 showphoto.php
-rw-r--r--  1 root root 17050 2008-12-27 14:12 submit.php
drwxr-xr-x 13 root root  4096 2010-01-11 04:27 themes
-rw-r--r--  1 root root  2741 2009-01-13 07:37 viewpage.php
-rw-r--r--  1 root root  4938 2008-06-20 10:30 weblinks.php


scheidel21 02-25-2010 03:35 PM

here is the apache2.conf file (I have added nothing in the httpd.conf file)

Code:

ServerRoot "/etc/apache2"
LockFile /var/lock/apache2/accept.lock
PidFile ${APACHE_PID_FILE}
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers      5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild  0
</IfModule>

<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75
    ThreadsPerChild      25
    MaxRequestsPerChild  0
</IfModule>

User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
AccessFileName .htaccess

<Files ~ "^\.ht">
    Order allow,deny
    Deny from all
</Files>

DefaultType text/plain
HostnameLookups Off
ErrorLog /var/log/apache2/error.log
LogLevel warn

# 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

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent


CustomLog /var/log/apache2/other_vhosts_access.log vhost_combined
Include /etc/apache2/conf.d/

Include /etc/apache2/sites-enabled/

The php5.conf and .load files from the active mod directory
Code:

<IfModule mod_php5.c>
  AddType application/x-httpd-php .php .phtml .php3
  AddType application/x-httpd-php-source .phps
</IfModule>

now the .load
LoadModule php5_module /usr/lib/apache2/modules/libphp5.so

The libphp5.so file is where the path says it is in the load file

Scratching my head...

smoker 02-25-2010 04:57 PM

The icons are irrelevant, perl scripts looks like that on my system. Or bash scripts.


What's in /etc/apache2/conf.d/
and in /etc/apache2/httpd.conf

If the directory isn't set up correctly it won't serve php from it.
is this in httpd.conf too ?
Code:

AddType text/html      php
or

Code:

AddType application/x-httpd-php .php .phtml .php3
You don't seem to have a info.php file in the files directory, have you tried it ?

If you're worried about that _config file, delete it and copy a new one over.

scheidel21 02-26-2010 09:05 AM

Those configuration lines are in files in the conf.d directory. But now the plot thickens. I haven't done anything to the system but now I can't even access anything, I get a 403 forbidden trying to access anything in a browser.

oobe 02-27-2010 07:16 AM

you need to make a config for your php site and put it in /etc/apache2/sites-available/
then symlink it to /etc/apache2/sites-enabled

an example of a config would be /etc/apache2/sites-available/default

you can take that site and modify it then rename it to whatever then symlink it from /etc/apache2/sites-available/newsite to /etc/apache2/sites-enabled/newsite

scheidel21 03-01-2010 07:16 AM

It wasn't a new site it was part of the demo site I was putting together. But after I played with permissions and they all seemed to be ok, but I still got a 403 forbidden access error on every page I tried to access I just reinstalled the VM and none of these problems are occuring now. Thank you all for the help you provided though.


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