eZ Publish using eZ Components in shared hosting environment

Sunday, 16 December 2007, 22:02
Categories: eZ Components
Tags: eZ Publish 4.0, eZ Components, eZ Publish hosting, shared hosting

There's a completely non-invasive method of making eZ Components available for eZ Publish installation, which would be especially useful in shared hosting environment, where custom server changes are not allowed or possible. Simply place your eZ Components bundle wherever that eZ Publish'es PHP can reach. Then create a config.php file on the eZ installation's root, and set additional include paths for PHP:

<?php
$ezcSharedHostingPath = './ezc/';
ini_set( 'include_path', ini_get( 'include_path' ). ':'.$ezcSharedHostingPath );
?>

Just adjust the path matching your environment, and that's it. eZ 4 already knows that it should look for it.

Comments

  • Mickael ROBIN
    Thursday, 31 January 2008, 10:23

    problem with windows include path?

    Hi,

    and thanks for this useful and convenient tip :-) ... but I could not make it :-(

    I created at the root of my eZ publish 4.0 installation a "config.php" file containing :
    <?php
    $ezcSharedHostingPath = 'H:\sites_web\ezcomponents';
    ini_set( 'include_path', ini_get( 'include_path' ). ':'.$ezcSharedHostingPath );
    ?>

    Here, H:\sites_web\ezcomponents is the Windows path for my ez components folders ("archive" , "authentification",...)

    Then, I run the "ezautoloadgenerator.php" (from the admin interface, after emptying all caches) but I still receive the "fatal error: Class 'ezcFile' not found ..."
    Indeed, when I check in mysite/autoload/ezp_kernel.php , the ez components classes are not present.

    I dont think it is a matter of "autoload environment" because the "autoload.php" file use "Base/src/base.php" if "ezc/Base/base.php" does not exist. On the top of that, I commented the condition to let only "$baseEnabled = @include( 'Base/src/base.php' );" and it did not work better.

    My feeling is that the problemn comes from my Windows environment which uses "\" instead of "/" to build the include path ; but maybe it something else...

    Any solution or idea???

    Thanks a lot in advance

    MikRob :-)
  • Piotr Karaś
    Thursday, 31 January 2008, 17:36

    What about relative path?

    Have you tried a relative path, just like I suggested in my example? Since this is direct inclusion of the scripts, I don't think two unsynchronized addressing methods will be a good idea, and you used absolute path.

    And I have no certainty about it, but I used to move my scripts around different environments and can't remember any slash-related problems.
  • Mickael ROBIN
    Thursday, 14 February 2008, 13:44

    [eZ components intallation ] even with a relative path...

    Hi,

    and thanks for your support/patience.

    I followed your advice and used a relative path but I still can't have ez Components installed.

    Concretely :
    1- I unzipped the archive and copied it in a folder called "ezc". This folder is located at the root of my site (between "extension" and "kernel" folders) and contains all the ez components sub-folders ("archive" , "authentification",...)

    2 - then, I created at the root of my site a file called "config.php", with this code :
    <?php

    ini_set( 'include_path', ini_get( 'include_path' ). ':../ezc/' );
    ?>

    In eZ publish 4.0, as covered on forums at ez.no, the file "autoload.php" requires config.php to set the include_path ; and then it includes "Base/src/base.php" file. So there shouldn't be anything more to configure to have ez Components ready for eZ publish.

    But when I run "ezautoloadgenerator.php" (from the admin interface, after emptying all caches) , I still receive the "fatal error: Class 'ezcFile' not found ...on oline 283"

    => What did I miss? Is there anything more to do before ez Components classes are found and used by eZ publish?

    Please help :-)

    MikRob
  • Mickael ROBIN
    Thursday, 14 February 2008, 17:03

    local installation of ez components - solved

    Hey, just to tell that a found my solution.

    => as I was working on a local server, I had to add the include_path for the ezc folder directly in the php.ini file of my Easyphp installation. (and there, the windows path separator is different fomr the linux one...)

    And indeed, there is nothing more to do than adding an include path to have ez publish using ez components

    Now I can use extensions :-)

    Thanks again
  • Piotr Karaś
    Friday, 15 February 2008, 08:24

    Glad I could help...

    ...a bit ;)
Log in or register to add a comment