HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Tips/Tricks/Mods (http://www.howtoforge.com/forums/forumdisplay.php?f=19)
-   -   PHP source code was shown on the webpage - security issue ? (http://www.howtoforge.com/forums/showthread.php?t=32637)

newbie2008 20th March 2009 05:17

PHP source code was shown on the webpage - security issue ?
 
Hi Till,

I am not sure this is my setting problem, I am using ISPConfig version 2.2.24

1) I have enable php globally and uncheck the PHP Scripts and PHP Safe Mode options in one of my virtual site, say www.example.com
2) There is a test.php program in the /var/www/example.com/web/

When I visit the virtual site www.example.copm/test.php, the source code of test.php shows up. I feel very unsafe that the php source code reveal to any visitors?

:eek:

till 20th March 2009 09:52

This is a problem with your settings.

1) If you uncheck the php option in the site settings then PHP is disabled and you see the sourcecode. hats the intended behaviour of disabling PHP ;) Enable it and it in the site settings and it should work properly. You can not enable php globally, take a look at the perfect setup guide and configure your server properly as described there.

newbie2008 21st March 2009 04:47

Quote:

Originally Posted by till (Post 176239)
This is a problem with your settings.

1) If you uncheck the php option in the site settings then PHP is disabled and you see the sourcecode. hats the intended behaviour of disabling PHP ;) Enable it and it in the site settings and it should work properly. You can not enable php globally, take a look at the perfect setup guide and configure your server properly as described there.

Sorry that I have typo, actually I have disabled PHP Globally before. Here is my /etc/httpd/conf.d/php.conf as

# AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps

so, is it inevitable to show the php source code or I must remove any .php programs under /web ? This might be inconvenience for temporary disable php function per virtual website!

newbie2008 21st March 2009 14:41

Quote:

Originally Posted by newbie2008 (Post 176415)
Sorry that I have typo, actually I have disabled PHP Globally before. Here is my /etc/httpd/conf.d/php.conf as

# AddType application/x-httpd-php .php
# AddType application/x-httpd-php-source .phps

so, is it inevitable to show the php source code or I must remove any .php programs under /web ? This might be inconvenience for temporary disable php function per virtual website!


Again, by experiment I found that if "AddType application/x-httpd-php .php" was remarked in /etc/httpd/conf.d/php.conf, and disable (uncheck) the php script of one virtual site (www.example.com) in ispconfig UI, the .php program source will be displayed on that website; like www.example.com/test.php.
I have tried php4 and php5 in different server, will there be any gentlemen/ladies give me an advice?

falko 21st March 2009 22:30

Which distribution are you using?

newbie2008 22nd March 2009 07:02

Quote:

Originally Posted by falko (Post 176533)
Which distribution are you using?

Hi falko, I have two severs; ServerA using CentOS4.6 + Apache2.0 + PHP4 and ServerB using CentOS4.7 + Apache2.0 + PHP5. Both using ISPConfig 2.2.24, some php version captured here:

for ServerA
php-xmlrpc-4.3.9-3.22.12
php-mysql-4.3.9-3.22.12
php-ldap-4.3.9-3.22.12
php-odbc-4.3.9-3.22.12
php-gd-4.3.9-3.22.12
php-devel-4.3.9-3.22.12
php-imap-4.3.9-3.22.12
php-pear-4.3.9-3.22.12
php-4.3.9-3.22.12

and for ServerB
php-ldap-5.1.6-3.el4s1.9
php-pear-1.4.11-1.el4s1.1
php-odbc-5.1.6-3.el4s1.9
php-pdo-5.1.6-3.el4s1.9
php-xml-5.1.6-3.el4s1.9
php-imap-5.1.6-3.el4s1.9
php-cli-5.1.6-3.el4s1.9
php-mysql-5.1.6-3.el4s1.9
php-devel-5.1.6-3.el4s1.9
php-5.1.6-3.el4s1.9
php-gd-5.1.6-3.el4s1.9
php-common-5.1.6-3.el4s1.9
php-xmlrpc-5.1.6-3.el4s1.9

I have followed the installation guide
http://www.howtoforge.com/centos-4.6...-ftp-ispconfig
for /etc/httpd/conf.d/php.conf which only with this

In ServerA
LoadModule php4_module modules/libphp4.so
DirectoryIndex index.php

and in Server B
LoadModule php5_module modules/libphp5.so
DirectoryIndex index.php

Does this information help?

falko 22nd March 2009 15:52

Looks ok. What's in your Vhosts_ispconfig.conf? Can you go to the directory where Vhosts_ispconfig.conf is located and post the output of
Code:

ls -la
?

id10t 22nd March 2009 16:32

You could use a .htaccesss file to disable all access to *php

till 22nd March 2009 19:05

It is the intention that php source code is shown if you disable php, as php is DISABLED theb. So if you want to upload PHP files to a website you should enable php as it is absolutely useseless to upload php files to a website were you disabled php in the site settings.

newbie2008 23rd March 2009 05:30

Quote:

Originally Posted by till (Post 176665)
It is the intention that php source code is shown if you disable php, as php is DISABLED theb. So if you want to upload PHP files to a website you should enable php as it is absolutely useseless to upload php files to a website were you disabled php in the site settings.

Dear all, Thanks all of your reply. What I want to disable PHP script under ISPConfig UI control panel is to let the PHP function temporary inaccessible (for internal php script development and testing). Okay, I will try other method or rename all those php programs for my temporary purpose.;)


All times are GMT +2. The time now is 16:01.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.