What is a godd test to know if mod-php ansd suPHP are workgin properly?

Discussion in 'Installation/Configuration' started by MrCompTech, Jul 11, 2010.

  1. MrCompTech

    MrCompTech New Member

    What is a good test to know if mod-php ansd suPHP are workgin properly?
     
    Last edited: Jul 12, 2010
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Create a php file, e.g. named info.php with the following content:

    Code:
    <?php
    phpinfo();
    ?>
    If you open the url to this file in the webbrowser, you will see all settings that the current php configuration in the website where you uploaded the file is using.
     
  3. MrCompTech

    MrCompTech New Member

    This only tells me if php is working in general.

    I have used the phpinfo.php file.

    This only tells me if php is working in general.

    It doesn't tell me specifically if mod-php and/or suPHP are workig or even installed.

    Is there something in the ouput of the phpinfo() command that let's me know for sure if mod-php or suPHP are installed.

    I used the How-To "The Perfect Server Fedora 13 - ISPConfig3" and expected mod-php and suPHP to be listed in the phpinfo() output but neither is listed in the phpinfo() ooutput.

    And when I try to select either of these options for a web site all I get is a blank page. Viewing the page source show a completely blank page, no html or php tags at all, a completely blank page.
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats wrong. The phpinfo function shows you wether mod_php or cgi / fcgi is used.

    mod_php:

    cgi or fcgi php:

     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Then look at the error.log of the website to see the reason why php can not be executed.
     
  6. MrCompTech

    MrCompTech New Member

    More Details

    When I have the web site set to use mod-php I get a blank page and the error.log file for the website in /var/log/ispconfig/httpd/rtmdfanc.com shows:

    PHP Warning: Unknown: open_basedir restriction in effect. File() is not within the allowed path(s):
    (/var/www/clients/client2/web2/web:
    /var/www/clients/client2/web2/tmp:
    /var/www/rtmdfanc.com/web:
    /srv/www/rtmdfanc.com/web:
    /usr/share/php5:
    /tmp:
    /usr/share/phpmyadmin)

    How can I fix this?

    When I set the web site to use suPHP the error message is:

    SecurityException in Application.cpp:511: Unknown Interpreter: php
    Premature end of script headers: phpinfo.php

    How can I fix this? or are both issues caused by the same thing?
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Please do not double post the same questions. the suphp issue is already answered in your other thread:

    http://www.howtoforge.com/forums/showthread.php?t=47203

    Regarding the mod_php problem: Where is the php file located? According to the error message, it is not within one of the allowed paths for thsi website.
     
    Last edited: Jul 12, 2010
  8. MrCompTech

    MrCompTech New Member

    Which php file:

    Using 'locate php' returns MANY lines.

    There is -
    /etc/php.d
    /etc/php.ini
    /etc/php.d
    /usr/bin/php
    /usr/bin/php
    /usr/bin/php-cgi
    /usr/include/php
    /usr/lib64/php
    /usr/share/php

    I have two web sites and the mod-php problem is the same for both of them.

    I followed the How-To "The Perfect Server Fedora 13 ISPConfig3" and didn't make any changes that would change the location of php used for mod-php.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the exact path of the php file that you uploaded.
     
  10. MrCompTech

    MrCompTech New Member

    mod_php install

    I followed step 15 of the How-To "The Perfect Server Fedora 13 ISPConfig3":

    15 Installing mod_php, mod_fcgi/PHP5, And suPHP

    yum install php php-devel php-gd php-imap php-ldap php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator php-mbstring php-mcrypt php-mhash php-mssql php-snmp php-soap php-tidy curl curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid php-cli httpd-devel

    This is all that I did to install mod_php.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Thats not a answer to my question. If you dont answer the question that I asked you in #7 and #9, the I cant help you. You should know where you ploaded the website file to that now causes this error!
     
  12. MrCompTech

    MrCompTech New Member

    I thought you were asking were I uploaded php to.

    But what I think what you want to know is -

    I created and uploaded phpinfo.php to the root of the web site.

    I get the blank page when I try to go to :

    http://rtmdfanc.com/phpinfo.php

    This page displays properly under suPHP, cgi or fast-cgi.

    Do I understand you correctly that this is what you are asking for?
     
    Last edited: Jul 12, 2010
  13. MrCompTech

    MrCompTech New Member

    The phpinfo.php file is located in

    /var/www/rtmdfanc.com/web

    which is in the path listed in the error
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of:

    ls -la /var/www/rtmdfanc.com/web

    and

    ls -la /var/www/
     
  15. MrCompTech

    MrCompTech New Member

    ls -la /var/www/rtmdfanc.com/web
    total 32
    drwx--x--- 4 web2 client2 4096 Jul 10 18:44 .
    drwxr-x--x 6 web2 client2 4096 Jul 10 18:18 ..
    drwxr-xr-x 2 web2 client2 4096 Jul 10 18:13 error
    -rwxr-xr-- 1 web2 client2 1406 Jul 10 18:13 favicon.ico
    -rwxr-xr-- 1 web2 client2 0 Jul 10 18:13 .htaccess
    -rwxr-xr-- 1 web2 client2 1861 Jul 10 18:13 index.html
    -rwxr-xr-- 1 web2 client2 22 Jul 10 18:44 phpinfo.php
    -rwxr-xr-- 1 web2 client2 34 Jul 10 18:13 robots.txt
    drwxr-xr-x 2 root root 4096 Jul 12 00:30 stats

    ls -la /var/www/
    total 48
    drwxr-xr-x. 12 root root 4096 Jul 10 19:55 .
    drwxr-xr-x. 23 root root 4096 Jul 9 22:27 ..
    drwx------ 3 ispapps ispapps 4096 Jul 9 22:28 apps
    drwxr-xr-x. 2 root root 4096 Apr 4 13:16 cgi-bin
    drwxr-xr-x 4 root root 4096 Jul 10 18:13 clients
    drwxr-xr-x. 3 root root 4096 Jul 9 12:51 error
    drwxr-xr-x. 2 root root 4096 Jan 16 04:00 html
    drwxr-xr-x. 3 root root 4096 Jul 9 12:53 icons
    lrwxrwxrwx 1 root root 34 Jul 9 22:28 ispconfig -> /usr/local/ispconfig/interface/web
    drwxr-xr-x. 14 root root 4096 Jul 9 12:57 manual
    lrwxrwxrwx 1 root root 30 Jul 10 17:20 mrcomptech.com -> /var/www/clients/client1/web1/
    drwxr-xr-x 4 root root 4096 Jul 10 20:33 php-cgi-scripts
    drwxr-xr-x 6 root root 4096 Jul 10 18:13 php-fcgi-scripts
    lrwxrwxrwx 1 root root 30 Jul 10 18:13 rtmdfanc.com -> /var/www/clients/client2/web2/
    drwxr-xr-x. 2 webalizer root 4096 Jul 10 18:33 usage
     
  16. till

    till Super Moderator Staff Member ISPConfig Developer

    Not sure what causes the mod_php problem. The path of the file is correct and the open_basedir setting matches the patch and the file permissions are correct too.

    What is the content exact of the file phpinfo.php?
     
  17. till

    till Super Moderator Staff Member ISPConfig Developer

  18. MrCompTech

    MrCompTech New Member

    phpinfo.php

    Hi Till,

    Here's the phpinfo.php file:
    <?php
    {one tab}phpinfo();
    ?>
    {one blank line}

    The phpinfo.php was created on a Windows PC so maybe I need to run dos2unix on phpinfo.php and see what happens.

    I'll checkout that link as well, thanks.
    If I find anything I'll post it on this thread.
     
  19. MrCompTech

    MrCompTech New Member

    Fixed the problem by following the advise to reinstall eaccelerator :
    http://www.howtoforge.com/forums/showthread.php?t=44144&highlight=open_basedir

    Downloaded the latest eaccelerator from http://eaccelerator.net

    And followed the instructions http://eaccelerator.net/wiki/InstallFromSource to configure using option "--without-eaccelerator-use-inode" the and make and finally make install.

    Now can use mod-php with eaccelerator and open_basedir restrictions, tested with phpinfo.php.

    In the web site error log I still get the error "PHP Warning: Unknown: open_basedir restriction in effect. File() is not found within the allowed path."

    The phpinfo.php file comes OK.
    One thing about this error message is the file() doesn't indicate which file is trying to be opened.
    Also, for other php errors that I have seen after the "PHP Warning : " there would normally be the name of a file but all php says is it is 'unknown".

    After abour 25 minutes I got back to the server and brought up te phpinfo.php page and then checked the site error log and no error the open_basedir was found.

    I found more informatiom at http://eaccelerator.net/ticket/396
     
    Last edited: Jul 14, 2010

Share This Page