Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: 18.04LTS Apache2 PHP7.2 includes

  1. #1
    Join Date
    Aug 2012
    Beans
    144

    18.04LTS Apache2 PHP7.2 includes

    New "clean" installation as subject; set up same as my 16.04LTS server except PHP7.0
    Running app I get this error msg
    Code:
    Fatal error: require_once(): Failed opening required 'error_handler_2020.includes.php' (include_path='.:/usr/share/php') in /var/www/html/applications/DocumentLocations/display_object_location.php on line 5
    the include path shown in the error msg is different from the one in the /etc/php/7.2/apache2/php.ini
    Code:
    include_path='.:usr/share/php:/var/www/html/applications/include_files'
    which shows the correct location of the include files
    Any suggestions on where to start looking
    Thanks

  2. #2
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,129
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: 18.04LTS Apache2 PHP7.2 includes

    What do you get when you run "ls /usr/share/php*"? Where is the file error_handler_2020.includes.php actually located?

    The presence or absence of that leading slash is very important.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  3. #3
    Join Date
    Aug 2012
    Beans
    144

    Re: 18.04LTS Apache2 PHP7.2 includes

    ls /usr/share/php*
    Code:
     ls /usr/share/php*
    /usr/share/php7.2-common:
    common
    
    
    /usr/share/php7.2-json:
    json
    
    
    /usr/share/php7.2-opcache:
    opcache
    
    
    /usr/share/php7.2-readline:
    readline
    the file file error_handler_2020.includes.php is in
    /var/www/html/applications/include_files

    here is the line in php.ini
    Code:
    include_path = ".:/usr/share/php:/var/www/html/applications/include_files"
    I ran a test page
    Code:
    <?php
     $x =  set_include_path ("/var/www/html/applications/php_includes"  );
    echo "<p>old path: $x</p>";
    $y = set_include_path ("/usr/share/php");
    echo "<p>new path: $y</p>";
    die;
    ?>
    result
    old path: .:/usr/share/php
    new path: /var/www/html/applications/php_includes
    So it seems the line in php.ini is being ignored

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,129
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: 18.04LTS Apache2 PHP7.2 includes

    I long ago gave up using these structures for includes. Each site I build has its own separate directory with the included files in subdirectories (common, handlers, content). For instance,

    Code:
    <?php
    $includes="/path/to/main/includes/directory/";
    $common=$includes."common/";
    $handlers=$includes."handlers/";
    $content=$includes."content/";
    
    [...]
    include($common."init.php");
    include($handlers."myhander.php");
    [etc.]
    As long as the Apache user, "apache2", has read privileges on those directories, everything works fine.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  5. #5
    Join Date
    Aug 2012
    Beans
    144

    Re: 18.04LTS Apache2 PHP7.2 includes

    I use that structure so can have 1 set of includes for all the different apps on the site and I can move the app from one server to a another without changing anything.
    It worked fine with 16.04lts but as noted it fails under 18.04LTS. Seems like something must have changed.
    Guess I'll give up on 18.04 until I can change all the PHP code like you suggest

    Thanks for the help
    Frank

  6. #6
    Join Date
    Aug 2017
    Beans
    117

    Re: 18.04LTS Apache2 PHP7.2 includes

    Are you sure that is the correct php.ini? (phinfo() will tell you so.)

    Not sure why it's acting up, but you can add the directory to your include path or copy the files to where it's looking for them. That's not the greatest solution as a future update make break it, but it will get you through.

  7. #7
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,129
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: 18.04LTS Apache2 PHP7.2 includes

    Quote Originally Posted by sdsurfer View Post
    Are you sure that is the correct php.ini? (phinfo() will tell you so.)
    There are two php.ini files in Ubuntu. One resides in /etc/php/[version]/cli and the other in /etc/php/[version]/apache2. It's the latter php.ini file that controls the behavior of the module in Apache. The cli files apply to cases where php is run from the command prompt, e.g.,
    Code:
    php /path/to/some/script.php
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  8. #8
    Join Date
    Aug 2012
    Beans
    144

    Re: 18.04LTS Apache2 PHP7.2 includes

    I changed /etc/php/7.2/apache2/php.ini to save_php.ini
    I inadvertently deleted /etc/php/7.2/cli/php.ini

    I ran sudo find / -iname php.ini 2>/dev/nullno results
    reran with a change to make sure i had it right sudo find / -iname save_php.ini 2>/dev/null
    found

    rebooted.

    Apache2 still runs and running below in a php file
    $x = set_include_path ("/var/www/html/applications/include_files" );
    returns the original include_path ".:/usr/share/php"

    where else can it be getting its settings?

  9. #9
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    15,129
    Distro
    Kubuntu 20.04 Focal Fossa

    Re: 18.04LTS Apache2 PHP7.2 includes

    If there is no .../apache2/php.ini, then the installation will use its defaults. They are specified in php.ini.
    If you ask for help, do not abandon your request. Please have the courtesy to check for responses and thank the people who helped you.

    Blog · Linode System Administration Guides · Android Apps for Ubuntu Users

  10. #10
    Join Date
    Aug 2012
    Beans
    144

    Re: 18.04LTS Apache2 PHP7.2 includes

    okay, I'm confused -
    If there are no physical php.ini files (as in my case) then there are core php settings that are not visible to the user (me) that the system uses. The physical ini's are to override the core settings
    Is that correct?
    Thanks for your time

    P.S.
    I've ticked the box to be notified by email but since the first reply its no longer happening. Should I report it somewhere

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •