Hi all,

I have 3 websites running php (5.0.4) configured as Apache (2.0.54) virtual hosts on one Red Hat (4.0.2) linux server.

All was working fine until...... I upgraded Plesk from 8.1.1 to 9.2.2. This automatically overwrote my /etc/httpd/conf.d/zz010_psa_httpd.conf file (which unfortunately was not backed up) and made all 3 websites fail.

I did some configuration to get the main website back up and it is now running fine with all the php being parsed. This runs under /var/www/vhosts/default/htdocs. So Apache is loading the php module ok.

However, the php is not being parsed in the other 2 websites. They run under /var/www/vhosts/XXX/htdocs and /var/www/vhosts/YYY/htdocs. If you 'View Page Source' on a webpage, it just shows the raw php code.

The master open_basedir is set to /var/www/vhosts/default/htdocs in php.ini. I have safe_mode on.

Open_basedir is set to /var/www/vhosts/XXX/htdocs and /var/www/vhosts/YYY/htdocs in the 2 respective VirtualHost sections in zz010_psa_httpd.conf.

Any ideas why the php is being ignored? All input would be greatly appreciated!

Many thanks, digigirl 😕

    bradgrafelman, sorry, not sure exactly what you are asking? php runs as an apache module.

      Can you show us the "configuration" you did to get to get PHP working again? Perhaps it's something as simple as adding an AddHandler line in each vhost's config section?

        bradgrafelman;10946501 wrote:

        Can you show us the "configuration" you did to get to get PHP working again? Perhaps it's something as simple as adding an AddHandler line in each vhost's config section?

        I have used 'virtual hosts' configuration in Apache.
        I did not have to add much in each virtual host directive.
        And certainly not Add anything for PHP, addhandler or addtype.
        The main Server configuration will be what is used in Virtual Host
        unless something else is configured in any of the hosts.

        I think this is something about php.ini settings in combination with directories.

          halojoy;10946502 wrote:

          I think this is something about php.ini settings in combination with directories.

          Unless there's some php.ini file lurking around on the system somewhere that has "engine = Off" in it, I can't see how any php.ini setting (or especially a missing php.ini file) would cause the PHP interpreter to not parse PHP code. Unless..

          @: You say that PHP isn't being parsed in two of the sites, and then when you view the source you can see the raw PHP code?

          Did you verify that the files you tried had a .php file extension? Also, were you using the full '<?php' tags or the deprecated (and disabled by default) '<?' short tags?

            Thanks both for your suggestions. No luck yet.

            I have now included the following in each vhost's config section.
            AddHandler php5-script .php
            AddType text/html .php

            Yes, my php files have .php extensions and I am using full '<?php' tags.

            Unfortunately I didn't note down exactly what I did to get php back up, but I think it was mainly adding the php LoadModule line to /etc/httpd/conf/httpd.conf
            LoadModule php5_module /usr/lib64/httpd/modules/libphp5.so

            [I think the Plesk upgrade also overwrote httpd.conf]

            Note this line already existed, unchanged, in /etc/httpd/conf.d/php.conf.
            LoadModule php5_module modules/libphp5.so

            Can I then deduce that php.conf is not being read/used because it didn't load the php module --- as it needed to be added to httpd.conf??

            I just tried temporarily removing open_basedir in php.ini but no change.

            I hope I am making sense.

              The only thing Apache will parse automatically is httpd.conf. Unless you reference the php.conf file inside httpd.conf, then no, it won't be parsed.

                I just ran some tests and discovered that php.conf is actually being read, despite it not being referenced in httpd.conf.

                [But the LoadModule in php.conf is a red herring - I comment it out and everything still works ok].

                If I temporarily remove php.conf, it causes my default website to fail - the website just reads and renders a backup index.html file.

                If I comment out the AddHandler and AddType, there is a complete failure of the default website where the browser simply displays all the index.php code in the clear - both html and php.

                php.conf

                LoadModule php5_module modules/libphp5.so

                AddHandler php5-script .php
                AddType text/html .php

                DirectoryIndex index.php

                  Write a Reply...