Include php

Discussion in 'Installation/Configuration' started by SeaWolf, Dec 12, 2005.

  1. SeaWolf

    SeaWolf Member

    Hi!

    I've just sending my php file to the server and I don't know why but all my <? include ?> procedure don't work? Anyone know why? :confused:

    Thanks,
    SeaWolf
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post one of the include statements here.

    Do you use absolute or relative paths or a global include dir that must be set in php.ini? Are your includes compatible with php safemode, if not you must disable safemode in the settings of the web in ispconfig.
     
  3. SeaWolf

    SeaWolf Member

    Something like:

    <table style="border:solid; border-width:1px; border-color:#000000" bgcolor="#FFFFFF" width="780" cellspacing="0" cellpadding="0" border="0" height="100%">
    <tr height="203">
    <td align="center" valign="top"><? include('top.php'); ?></td>
    </tr>
    </table>

    all I see is my table black border.

    How do I know if it's compatible? But anyway it doesn't work with safemode checked or not in ISPConfig.

    SeaWolf
     
  4. SeaWolf

    SeaWolf Member

    I just checked in php.ini and found that Safe_mode = Off so I just put it On and now it's ok. Why in the ISPConfig when I checked it or not it doesn't work?

    Thanks!
    SeaWolf
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    The file top.php is in the same directory? If yes, i guess that PHP is not enabled at all.

    The php checkbox is checked for this website and the "administrator" checkbox is checked for the user you used to upload the .php files?

    If all this is true, please create a testfile, upload it to your website and name it test.php:

    <?php
    phpinfo();
    ?>

    If you call the file in a browser, do you gat a large output which functions are enabled in php?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    Have you waited about a minute before you tested so ISPCOnfig has the time to rewrite the config files?
     
  7. SeaWolf

    SeaWolf Member

    Yes top.php is in the same directory. Yes the PHP checkbox and (safemode was) checked.

    It's only php include commands.

    If I type:
    <? print 'Hello world!' ?>
    I will see: Hello world

    If I type:
    <?php
    phpinfo();
    ?>
    I will see all that PHP and configurations stuff.

    If I type:
    <? include('top.php'); ?>

    and top.php is in the same folder and looks like:
    <? print 'Hello world' ?>
    I will see a blank page.

    That's why I'm confused. :confused:

    All of this happen when Safe_mode = Off in php.ini
    and Safe mode is checked or not in ISPConfig.

    I just tried to put Safe_Mode = On in php.ini and uncheck Safe Mode in ISPConfig and it seems to work... ?!?!

    SeaWolf
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Hmmm, really strange behavoiur :confused:
     
  9. falko

    falko Super Moderator Howtoforge Staff

    Can you try
    PHP:
    <? include('./top.php'); ?>
    instead of
    PHP:
    <? include('top.php'); ?>
    ?
     
  10. SeaWolf

    SeaWolf Member

    Woooooarg!.. you're right....:D why do I have to put ./ before?

    So I have to choice to put ./ before
    OR
    Uncheck Safemode in ISPConfig control panel


    SeaWolf
     
  11. falko

    falko Super Moderator Howtoforge Staff

    My guess is that you have set something like
    Code:
    include_path = ".:/usr/share/php"
    in your php.ini, and PHP tries to find the included files in that directory if you don't use ./.
     
  12. SeaWolf

    SeaWolf Member

    It's strange because before the Safe_Mode = On modification I never did a modification in php.ini :confused: . I'll take a look to see what is include_path.

    Thanks!
    SeaWolf
     
  13. SeaWolf

    SeaWolf Member

    Just checked the include_path.. here it is:

    ; UNIX: "/path1:/path2"
    ;include_path = ".:/php/includes"

    include_path = "/usr/share/php5"

    ;
    ; Windows: "\path1;\path2"
    ;include_path = ".;c:\php\includes"


    ?!?!.. What's wrong?

    SeaWolf
     
  14. till

    till Super Moderator Staff Member ISPConfig Developer

    OK, this is the problem. With this setting in php ini all files that are not included with an absolute path must reside in /usr/share/php.

    Set the path to:

    include_path = ".:/usr/share/php5"
     
  15. falko

    falko Super Moderator Howtoforge Staff

    ... or comment it out: :)
    Code:
    ;include_path = ".:/usr/share/php5"
     
  16. minezamac

    minezamac New Member

    This was indeed the fix to get Drupal to allow Tinymce to be installed. The PHP configuration was not looking in the same directory, and therefore could not find the modules. Change the file in /etc/php5 and life will be better.

    Thanks Falco.
     

Share This Page