PDA

View Full Version : PHP not working in ISPConfig website


FadeOUT
25th April 2007, 23:45
Hi,

Sorry, I know this has come up before, but I've been searching for hours and I've yet to come up with a solution.

I have installed ISPConfig on a openSuse 10.2 server using Falko's Perfect Setup (Thanks, Falko) and all is well - apart from PHP; If I check the PHP Scripts box on the control panel it makes no difference. Trying to open a PHP page in Firebox just gives me:

You have chosen to open
Which is a: application/x-httpd-php

...In other words it looks like PHP pages aren't being parsed.

Any ideas :confused:

till
26th April 2007, 11:25
Is the PHP file located in the website directory that ISPConfig created for the website?

FadeOUT
26th April 2007, 12:02
Is the PHP file located in the website directory that ISPConfig created for the website?

Hi, thanks for replying...

I believe so; for instance /srv/www/web1/web/myfile.php

falko
26th April 2007, 21:16
Is PHP enabled in the vhost configuration of that web site in the file Vhosts_ispconfig.conf?

FadeOUT
26th April 2007, 22:19
I think so..!

######################################
# Vhost: www.mydomain.com:80
######################################
#
#
<VirtualHost ***.my.ip.***:80>
ServerName www.mydomain.com:80
ServerAdmin webmaster@mydomain.com
DocumentRoot /srv/www/web3/web
ServerAlias mydomain.com www.mydomain.co.uk mydomain.co.uk
DirectoryIndex index.html index.htm index.php index.php5 index.php4 index.php3 index.shtml index.cgi index.pl index.jsp Default.htm default.htm
ErrorLog /srv/www/web3/log/error.log
AddType application/x-httpd-php .php .php3 .php4 .php5
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php3>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php4>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
<Files *.php5>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
php_admin_flag safe_mode Off
Alias /error/ "/srv/www/web3/web/error/"
ErrorDocument 400 /error/invalidSyntax.html
ErrorDocument 401 /error/authorizationRequired.html
ErrorDocument 403 /error/forbidden.html
ErrorDocument 404 /error/fileNotFound.html
ErrorDocument 405 /error/methodNotAllowed.html
ErrorDocument 500 /error/internalServerError.html
ErrorDocument 503 /error/overloaded.html
AliasMatch ^/~([^/]+)(/(.*))? /srv/www/web3/user/$1/web/$3
AliasMatch ^/users/([^/]+)(/(.*))? /srv/www/web3/user/$1/web/$3
</VirtualHost>

falko
27th April 2007, 15:24
Are there any error messages in Apache's error log?

FadeOUT
27th April 2007, 15:51
Mmm... It's packed with:

[error] an unknown filter was not added: PHP


(And that's it)

FadeOUT
27th April 2007, 16:33
Mmm... Have I been caught with that AddHandler / AddType thing, I wonder?

I should have used something other than SUSE, shouldn't I? Trouble is, a handful of friends are already using the thing, so I hope I don't have to start from scratch...

(I was thinking for a moment I was using a 64 bit machine here, but it is just a 32 bit box, in this case).

FadeOUT
27th April 2007, 16:40
If I try turning php on and off in a website, I get the following in the apache2 error log:

[Fri Apr 27 14:10:02 2007] [warn] long lost child came home! (pid 16154)
[Fri Apr 27 14:10:49 2007] [notice] Graceful restart requested, doing restart
[Fri Apr 27 14:10:49 2007] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Fri Apr 27 14:10:51 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations

Grizzly
27th April 2007, 20:01
any ideas on what to do to resolve this issue

Hans
28th April 2007, 08:03
Do you have this line at the end within your /etc/apache2/apache2.conf:

Include /etc/apache2/vhosts/Vhosts_ispconfig.conf


Do you have these lines within /etc/apache2/mods-available/dir.conf:


<IfModule mod_dir.c>

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

</IfModule>

Make sure that you've commented out the mime-types within /etc/mime.types like this:


#application/x-httpd-php phtml pht php
#application/x-httpd-php-source phps
#application/x-httpd-php3 php3
#application/x-httpd-php3-preprocessed php3p
#application/x-httpd-php4 php4


After any modification restart Apache2:

/etc/init.d/apache2 restart

FadeOUT
28th April 2007, 13:35
Do you have this line at the end within your /etc/apache2/apache2.conf:

Include /etc/apache2/vhosts/Vhosts_ispconfig.conf


Well, it is at the end of httpd.conf


Do you have these lines within /etc/apache2/mods-available/dir.conf:


<IfModule mod_dir.c>

DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml

</IfModule>


I don't have that file, either; isn't this taken care of in /etc/sysconfig/apache2 in Suse?

I do have the line:

APACHE_MODULES="actions alias auth_basic authn_file authz_host authz_groupfile authz_default authz_user authn_dbm autoindex cgi dir env expires include log_config mime negotiation setenvif ssl suexec userdir php5 rewrite"

As, I believe, specified in The Perfect Setup.


Make sure that you've commented out the mime-types within /etc/mime.types like this:


#application/x-httpd-php phtml pht php
#application/x-httpd-php-source phps
#application/x-httpd-php3 php3
#application/x-httpd-php3-preprocessed php3p
#application/x-httpd-php4 php4


I've commented out the following in mime.types:
#application/x-perl pl pm al perl
#application/x-php php php3 php4


After any modification restart Apache2:

/etc/init.d/apache2 restart

I've not changed anything, this time, unfortunately - but thanks for your efforts. :o

FadeOUT
28th April 2007, 13:52
Mmm... I think perhaps I'm getting somewhere; PHP works if I manually change the following in the /etc/apache2/vhosts/Vhosts_ispconfig.conf file:

AddHandler application/x-httpd-php .php .php3 .php4 .php5

to

AddType application/x-httpd-php .php .php3 .php4 .php5

So, it is the AddHandler / AddType problem. I'll just try and find the right place to change this within the ISPconfig files...

FadeOUT
28th April 2007, 14:28
OK... I've changed AddType back to AddHandler and PHP is still working. It must have been down to something else. Now I'm really confused, but at least PHP is working. I have a horrible feeling that I'll be back here begging for more help... Thanks everyone who had a go..!

falko
28th April 2007, 19:53
Mmm... It's packed with:

[error] an unknown filter was not added: PHP


(And that's it)
Take a look here: http://www.howtoforge.com/forums/showpost.php?p=29054&postcount=2

lcerny
30th April 2007, 17:02
Take a look here: http://www.howtoforge.com/forums/showpost.php?p=29054&postcount=2
In my opensuse 10.2 fresh install was following in /etc/apache2/conf.d/php5.conf file


<IfModule mod_php5.c>
AddHandler ## ispconfig install ## application/x-httpd-php .php4
AddHandler ## ispconfig install ## application/x-httpd-php .php5
AddHandler ## ispconfig install ## application/x-httpd-php .php
AddHandler ## ispconfig install ## application/x-httpd-php-source .php4s
AddHandler ## ispconfig install ## application/x-httpd-php-source .php5s
AddHandler ## ispconfig install ## application/x-httpd-php-source .phps
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php
</IfModule>

When removed this strange ## ispconfig install ##, php works fine. Seems some bug during installation ?

till
30th April 2007, 17:17
Seems some bug during installation ?

No, that was ok. Please add the comments again or you will not be able to configure PHP in ISPConfig.

Have you enabled the php checkbox in ISPConfig for this website?

Grizzly
1st May 2007, 20:41
log in /var/log/apache2/error_log reads



May 02 18:02:05 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 18:02:06 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 18:02:07 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 18:02:08 2007] [error] [client ::1] client denied by server configuration: /srv/www/

falko
1st May 2007, 21:27
What does /etc/apache2/conf.d/php5.conf look like now?

Grizzly
1st May 2007, 21:51
<IfModule mod_php5.c>
AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php4
AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php5
AddHandler ##ISPConfig INSTALL## application/x-httpd-php .php
AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .php4s
AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .php5s
AddHandler ##ISPConfig INSTALL## application/x-httpd-php-source .phps
DirectoryIndex index.php4
DirectoryIndex index.php5
DirectoryIndex index.php
</IfModule>

Grizzly
1st May 2007, 21:58
[Wed May 02 20:07:25 2007] [notice] Graceful restart requested, doing restart
[Wed May 02 20:07:25 2007] [error] (9)Bad file descriptor: apr_socket_accept: (client socket)
[Wed May 02 20:07:25 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:25 2007] [error] [client ::1] client denied by server configuration: /srv/www/
[Wed May 02 20:07:26 2007] [warn] long lost child came home! (pid 11958)
[Wed May 02 20:26:22 2007] [notice] caught SIGTERM, shutting down
[Wed May 02 20:27:47 2007] [notice] suEXEC mechanism enabled (wrapper: /usr/sbin/suexec2)
[Wed May 02 20:27:53 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -- resuming normal operations


php files still not being handled and ask me to download when opening

till
2nd May 2007, 09:24
Are you sure that you access the website trough the correct domain and not trough the main domain with a path appended like:

www.yourdomain.com/www.yourotherdomain.com/web/

gamma1it
3rd May 2007, 04:59
Hi,
I am running SuSe 10.2 as well, ispconfig etc. I have the same symptoms and also with awstats, could this have anything to do with susexec?

ALSO....Your forums sites and software are truly something to appreciate.
Thanks for all the help!

till
3rd May 2007, 10:14
@gamma1it:

How do you run your php scripts? mod_php, php-cgi with suexec or suphp?

Coiled
3rd May 2007, 12:12
Hi,
had the same prob over the last days.
Finally I fixed it:

Change the line:

$go_info["server"]["apache2_php"] = 'both'; (or whatever is filled in here)

to:

$go_info["server"]["apache2_php"] = 'addhandler';

in the file /home/admispconfig/ispconfig/lib/config.inc.php

'addhandler' seems to be the only valid setting for suse 10.2 (see the comment at the end of this line in config.inc.php)

And don't forget to restart ISP/Apache
Hope it works for you too.

:) Coiled

Hans
3rd May 2007, 14:00
If you're running suPHP, you need to change the line

$go_info["server"]["apache2_php"] = 'both';

into:

$go_info["server"]["apache2_php"] = 'suphp';

Otherwise, you will have problems when you update ISPConfig.

gamma1it
3rd May 2007, 19:06
Hi Till,

Wow, thanks for the speedy reply. Here is a bit of history:

I am using a Dell Poweredge 4400 running SuSe 10.2 with ISPconfig installed as per the perfect setup. I have messed around with Awstats and with the help of these forums managed to get it to display on www.mydomain.tld/stats with security, but the data does not update. The webalizer stats are updateing but can only be seen after the cron runs for webalizer but before it runs for awstats. (I could remove the awstats cron job and just use webalizer if I have to) I need awstats to read and write to the correct logs. I have taken a brain break from awstats and started testing joomla and mambo but can't get a browser to read the index.php. Error logs, for the most part, say the same as Grizzly's. I am still a Linux newbie but not entirely, I have been at it all day everyday for about 6 months and read many threads on linux, ISPconfig and plugins.

To answer your question.....I think I am using suexec because i see it check marked in the ispconfig control panel ----> management-----> server----> settings---->web tab---->Suexec: checkmark on

What file do I need to verify this in?

Thanks again Till.

Aaron

till
4th May 2007, 11:29
If you followed the perfect setup, then you run php as mod_php and not via suexec. In your case, suexec is only used in case you run any cgi scripts.

Have you tryed what "Coiled" has suggested?

Grizzly
4th May 2007, 20:53
Please see if you can see any faults, I have now tried 'both'/'addhandler'/'addtype'/'suphp' everytime after a change I change settings in ISPconfig in order to rewrite the config.inc.php file and even rebooted the server everytime with the same result, some php files want to be downloaded to my pc some open in browser.

$go_info["server"]["postfix_config"] = 1; // 1 = SENDMAIL-STYLE, 2 = POSTFIX-STYLE
$go_info["server"]["smtp_restart"] = 1; // 1 = stop/start, 2 = restart
$go_info["server"]["network_config"] = 0; // 0 = none, 1 = automatic
$go_info["server"]["sudo_du_enabled"] = 0; // enable sudo for gathering website file usage
$go_info["server"]["apache2_php"] = 'suphp'; // 'filter' = set PHP filters, 'addtype' = Set PHP addtype or 'both' = Set Filter + Addtype, suphp = SuPHP wrapper enabled, 'AddHandler' = Set PHP AddHandler (nescessary for SuSE 10.2)
$go_info["server"]["password_hash"] = 'crypt'; // 'crypt' = crypt; 'md5' = crypt-md5
$go_info["server"]["do_automated_backups"] = 0; // 0 = no, 1 = yes; PLEASE NOTE: automated backups might fill up your HDD fast!

FadeOUT
11th May 2007, 11:55
Grr! My PHP has stopped working, again... I'm going through everything again (including all the $go_info stuff...)

I should have steered clear of openSUSE, shouldn't I? The Debian Etch CD in my bag is beckoning...

Meanwhile, if anyone found any definitive ways to get this working, I'm listening...

FadeOUT
11th May 2007, 14:26
Still no luck... I think it all went wrong when I tweaked a user's spam whitelist - presumably rewriting vhosts.

Gza
17th May 2007, 23:02
Hi all, i've got same problem, everything works OK in my Mandriva2007 system (it was built via Perfect setup, thhanks Falko), only php not works under domains. I've tried all the versions what are in /home/ispconfig/lib/config.inc.php, (both, filter, addtype, addhandler), without success :(

What can I do? (so I want control php under ispconfig)

THX
Gza

till
18th May 2007, 10:50
Do you have copies of the file Vhost_ispconfig.conf with a date appended to the name on your server? The files must be in /etc/apache2/vhost or a similar directory.

personxx
5th June 2007, 17:16
I have exactly the same issue... Also running OpenSuse 10.2

FadeOUT
11th September 2007, 14:08
Did anybody get to the bottom of this? I've just updated to the latest version of ISPConfig and it's all kicked off again...

till
11th September 2007, 14:13
Please read and try to answer my questions in this thread. If you dont provide any infos, we can not help you.

ISPConfig works perfectly on OpenSuSE, when you follow the perfect setup guide.

personxx
11th September 2007, 14:42
And installed ISPConfig on Debian Etch

Running with no major problems now...

FadeOUT
11th September 2007, 16:07
Please read and try to answer my questions in this thread. If you dont provide any infos, we can not help you.

ISPConfig works perfectly on OpenSuSE, when you follow the perfect setup guide.

My apologies, the addhandler change fixed the problem - I just needed to clear my browser cache :rolleyes: