LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   PHP files in Debian Squeeze (https://www.linuxquestions.org/questions/debian-26/php-files-in-debian-squeeze-883643/)

jrecortel 05-30-2011 11:35 PM

PHP files in Debian Squeeze
 
Hello. I installed apache2, php5, mysql-server and phpmyadmin in Debian Squeeze using Synaptic. After that, I create a link to userdir.conf and userdir.load to /etc/apache2/mods-enabled so that i can store and run my PHP files in /home/user/public_html. But when I tried to browse my files in a browser, a dialog box asking me whether to open or save the file appears. But if I try to open phpmyadmin, it correctly display the page. How can i configure it to display the PHP file which resides in public_html in my browser? Thanks in advance.

evo2 05-31-2011 01:26 AM

Are you pointing your web browser at the http server or directly at the file?

Eg
Code:

http://localhost/~user/somefile.php
Or
Code:

file:///home/user/public_html/somefile.php
If the former: Did you install libapache2-mod-php5?
If the later: You should not expect it to work since php is server side interpreted.

Evo2.

jrecortel 05-31-2011 07:22 AM

Thank evo2. Yes, libapache2-mod-php5 is installed in my system. I type in address bar this:
Code:

http://localhost/~user/info.php
The content of info.php is
Code:

<?php
phpinfo();
?>

but the browser only open a dialog box asking whether to open or save the file. Is there any configuration I need to perform so that it can display the PHP files in the public_html? Thanks in advance.

jrecortel 05-31-2011 08:14 AM

I put a # in the php_admin_value engine Off of /etc/apache2/mods-enabled/php5.conf like this:
Code:

<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
    #  php_admin_value engine Off
    </Directory>
</IfModule>

and restart the apache and now it works. Is this the correct solution? Thanks in advance.

evo2 05-31-2011 07:20 PM

Quote:

Originally Posted by jrecortel (Post 4371872)
I put a # in the php_admin_value engine Off of /etc/apache2/mods-enabled/php5.conf like this:
Code:

<IfModule mod_userdir.c>
    <Directory /home/*/public_html>
    #  php_admin_value engine Off
    </Directory>
</IfModule>

and restart the apache and now it works. Is this the correct solution?

It seems that php was explicitly disabled for users public_html directories. I think you could actually comment out that whole <IfModule> block.

Cheers,

Evo2.

jrecortel 05-31-2011 09:31 PM

Thanks evo2 for the reply. Is it the same as
Code:

php_admin_value engine On
as in commenting the entire block? What is their difference? thanks in advance.

evo2 05-31-2011 09:48 PM

Quote:

Originally Posted by jrecortel (Post 4372557)
Is it the same as
Code:

php_admin_value engine On
as in commenting the entire block? What is their difference? thanks in advance.

Presumably, by default it is on so you shouldn't need to explicitly turn it on in your config file. For a definitive
answer you will need to read the documentation and check all your apache config files.

Evo2.

jrecortel 06-01-2011 03:24 AM

Thanks for the advice evo2. Will mark it now as solved.


All times are GMT -5. The time now is 02:01 PM.