Problem with PHP on virtual server

14 posts / 0 new
Last post
#1 Tue, 12/09/2008 - 06:35
Daniele Ricciardi

Problem with PHP on virtual server

Hi all and thank you for the grat Job.

I'm evaluating Virtual server on a test server and it work very well. To make it work i disabled mod_suexec and now everithing works fine except PHP in virtual servers. It's enabled but when i start php scripts (such as Joomla setup, the php code is displyed instead of interpreted.

Ubuntu 8.10 with PHP 5, Apache2, and all the latest patches

Anyone can help me about it?

thank you

Daniele Ricciardi

Tue, 12/09/2008 - 06:54
andreychek

Howdy,

When you go into Server Configuration -> Website Options, what does the PHP script Execution mode show?

PHP should definitely work out of the box though, so it's a little odd that it isn't... when you did the install. did you by chance use the install.sh script? That's the best way to do things, as it handles all the setup for you, as well as making sure all the correct software versions are installed.
-Eric

Tue, 12/09/2008 - 07:03 (Reply to #2)
Daniele Ricciardi

Hi,

in Virtualmin, under "Server Configuration", i have 4 options:Change Domain Name, Change IP Address, Edit Proxy Website,Move Virtual Server. I cannot find "Website options" (I'm still using GPL edition of webmin).

I did the installation following these instructions:

http://ubuntuforums.org/showthread.php?p=6307527

just because the install script ended with a FATAL error on that disribution and i didn't find why around the web...

Tue, 12/09/2008 - 07:43 (Reply to #3)
andreychek

Ahh, right, that option isn't available for the GPL version.

So you're saying you did install with the install.sh script?

Ubuntu keeps all your Virtual Hosts in separate files in /etc/apache2/sites-available.

Could you attach one of them that isn't working properly?

Also, what output do you get when you run this:

dpkg -l 'php*'

Thanks,
-Eric

Tue, 12/09/2008 - 07:45 (Reply to #4)
andreychek

Oh, I didn't catch the last line of your post initially -- that FATAL error you got with the install script may be the key here!

What was the error? And do you still have the /root/virtualmin-install.log around that you could attach that? Thanks,
-Eric

Sun, 06/07/2009 - 07:33 (Reply to #5)
Daniele Ricciardi

i tryed to install with the scritp but it didn't worked.

so i tryed the procedure i posted in the link and it worked wall and now, after a little post-config all seems to work fine, except this thing...

this is the file you asked me:

<VirtualHost *:80>
ServerName intranet.iit.local
ServerAlias www.intranet.iit.local
ServerAlias webmail.intranet.iit.local
ServerAlias admin.intranet.iit.local
DocumentRoot /home/intranet/public_html
ErrorLog /home/intranet/logs/error_log
CustomLog /home/intranet/logs/access_log combined
ScriptAlias /cgi-bin/ /home/intranet/cgi-bin/
DirectoryIndex index.html index.htm index.php index.php4 index.php5
<Directory /home/intranet/public_html>
Options -Indexes IncludesNOEXEC FollowSymLinks
allow from all
AllowOverride All
</Directory>
<Directory /home/intranet/cgi-bin>
allow from all
</Directory>
RewriteEngine on
RewriteCond %{HTTP_HOST} =webmail.intranet.iit.local
RewriteRule ^(.*) https://intranet.iit.local:20000/ [R]
RewriteCond %{HTTP_HOST} =admin.intranet.iit.local
RewriteRule ^(.*) https://intranet.iit.local:10000/ [R]
</VirtualHost>

thank you a lot for your help

Tue, 12/09/2008 - 07:51 (Reply to #6)
Daniele Ricciardi

the output of the command you asked:

Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Cfg-files/Unpacked/Failed-cfg/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-===================================-===================================-======================================================================================
ii php-pear 5.2.6-2ubuntu4 PEAR - PHP Extension and Application Repository
un php3 <none> (no description available)
un php4 <none> (no description available)
un php4-cgi <none> (no description available)
un php4-cli <none> (no description available)
un php4-dev <none> (no description available)
un php4-gd <none> (no description available)
un php4-mcrypt <none> (no description available)
un php4-mysql <none> (no description available)
un php4-pear <none> (no description available)
ii php5 5.2.6-2ubuntu4 server-side, HTML-embedded scripting language (metapackage)
un php5-cgi <none> (no description available)
ii php5-cli 5.2.6-2ubuntu4 command-line interpreter for the php5 scripting language
ii php5-common 5.2.6-2ubuntu4 Common files for packages built from the php5 source
ii php5-curl 5.2.6-2ubuntu4 CURL module for php5
ii php5-dev 5.2.6-2ubuntu4 Files for PHP5 module development
ii php5-gd 5.2.6-2ubuntu4 GD module for php5
ii php5-idn 1.2b-5.2 PHP API for the IDNA library
ii php5-imagick 2.1.1RC1-1 ImageMagick module for php5
ii php5-imap 5.2.6-0ubuntu3 IMAP module for php5
un php5-json <none> (no description available)
ii php5-mcrypt 5.2.6-0ubuntu2 MCrypt module for php5
ii php5-memcache 3.0.1-1 memcache extension module for PHP5
ii php5-mhash 5.2.6-2ubuntu4 MHASH module for php5
ii php5-ming 1:0.3.0-14 Ming module for php5
ii php5-mysql 5.2.6-2ubuntu4 MySQL module for php5
un php5-mysqli <none> (no description available)
ii php5-pspell 5.2.6-2ubuntu4 pspell module for php5
ii php5-recode 5.2.6-2ubuntu4 recode module for php5
ii php5-snmp 5.2.6-2ubuntu4 SNMP module for php5
ii php5-sqlite 5.2.6-2ubuntu4 SQLite module for php5
ii php5-tidy 5.2.6-2ubuntu4 tidy module for php5
un php5-timezonedb <none> (no description available)
ii php5-xmlrpc 5.2.6-2ubuntu4 XML-RPC module for php5
ii php5-xsl 5.2.6-2ubuntu4 XSL module for php5
un phpapi-20060613 <none> (no description available)
ii phpmyadmin 4:2.11.8.1-1 MySQL web administration tool

Tue, 12/09/2008 - 07:52 (Reply to #7)
Daniele Ricciardi

sorry, when i got the error i restored a backup of the VM to restart from a clean point of installation so i haven't it

Daniele

Tue, 12/09/2008 - 08:12 (Reply to #8)
andreychek

Well, if the installer isn't able to complete, that means something is wrong with your setup that will likely adversely effect Virtualmin in the future... Apache, PHP, and suexec should all work perfectly out of the box.

However, to at least get what you have there ATM working, I may try enabling mod_php then restart Apache. To do that, log in as root over SSH, and run:

a2enmod php5
/etc/init.d/apache2 restart

That will setup your system to use mod_php. The preferred setup is with PHP using suexec, but mod_php does work, though it's less secure as everything runs as Apache, rather than the invidivual users who own the sites.
-Eric

Tue, 12/09/2008 - 08:16 (Reply to #9)
Daniele Ricciardi

when i do a2enmod it says that php5 is already enabled and restarting apache gives no effect, i still see the php code...

tnx

Daniele

Tue, 12/09/2008 - 08:23 (Reply to #10)
andreychek

Howdy,

Hmm... whenever you restart Apache, it generates a log message listing the various modules that loaded for it in Apache's error log.

If you look in /var/log/apache2/error_log, there should be a line like this:

[Tue Dec 09 11:23:05 2008] [notice] Apache/2.2.8 (Ubuntu) DAV/2 SVN/1.4.6 PHP/5.2.4-2ubuntu5.4 with Suhosin-Patch mod_ruby/1.2.6 Ruby/1.8.6(2007-09-24) mod_ssl/2.2.8 OpenSSL/0.9.8g configured -- resuming normal operations

Can you paste in the line that looks like that from your logs?
-Eric

Tue, 12/09/2008 - 08:28 (Reply to #11)
Daniele Ricciardi

[Tue Dec 09 14:21:48 2008] [notice] Graceful restart requested, doing restart
[Tue Dec 09 14:21:49 2008] [notice] mod_python: Creating 8 session mutexes based on 150 max processes and 0 max threads.
[Tue Dec 09 14:21:49 2008] [notice] mod_python: using mutex_directory /tmp
[Tue Dec 09 14:21:49 2008] [notice] Apache/2.2.9 (Ubuntu) PHP/5.2.6-2ubuntu4 with Suhosin-Patch mod_python/3.3.1 Python/2.5.2 mod_ruby/1.2.6 Ruby/1.8.7(2008-08-11) mod_ssl/2.2.9 OpenSSL/0.9.8g configured -- resuming normal operations

Tue, 12/09/2008 - 08:30 (Reply to #12)
andreychek

Alright, that looks fairly normal. How about this then:

cat /etc/apache2/mods-enabled/php5.conf

Tue, 12/09/2008 - 08:33 (Reply to #13)
Daniele Ricciardi

got it!

thank you a lot. In the last file you told me to check the instances were commented.

now it works fine!!!!

Thank you a lot!!!

Topic locked