Apache Server Config

47 views
Skip to first unread message

Anderson Florencio

unread,
Jan 14, 2016, 8:19:56 PM1/14/16
to ZnetDK
Hello Pascal, I'm having trouble putting the system into production. Working at localhost XAMPP works fine, but already I uploaded for two different hosts and we both found problems.
In the first application it was slowly but charged full, however, the slowness, some pages fail to load the data from the DataTable.
In the second host the application or can render CSS and JS, it takes a while and loads the entire page without style.
My question is: You must perform some configuration on the Apache server for the framework to work correctly?

Pascal Martinez

unread,
Jan 16, 2016, 3:02:25 AM1/16/16
to ZnetDK
Hello Anderson,

The only apache configuration required to install ZnetDK on a internet hosting server consists in customizing the ".htaccess" file located into the ZnetDK root directory (this is the same directory than the one containing the ZnetDK "index.php" script, the "applications" directory, the "engine" directory...).

This configuration only concerns the ErrorDocument statement in order to redirect properly the 403 & 404 HTTP errors.

On your hosting server, if the publishing directory is for example /home/myhosting/www and your matching internet URL is www.mydomain.com/, here is two scenarios:
  • You can install ZnetDK into a subdirectory named for example /home/myhosting/www/mydir in order to access to your applications entering the www.mydomain.com/mydir URL. In this case, you need to configure your ZnetDK root ".htaccess" file like shown below:
ErrorDocument 403 /mydir/index.php?control=httperror&action=403
ErrorDocument 404 /mydir/index.php?control=httperror&action=404
  •  Or if you prefer to access to your ZnetDK applications by entering the www.mydomain.com/ address, then you need to directly install ZnetDK into the /home/myhosting/www/ directory (so it would directly contain the ZnetDK "index.php" script, the "applications" directory, and so on...) and configure the ZnetDK root ".htaccess" file as shown below:
ErrorDocument 403 /index.php?control=httperror&action=403
ErrorDocument 404 /index.php?control=httperror&action=404
    According to me, even if the ZnetDK root ".htaccess" is not properly configured, it can't be the cause of your performance issues.

    To diagnoze your performance issues, use your browser facilities ('Network', 'Timeline' and 'Audits' tabs on Chrome browser) and your web provider performance tools.

    Try to post more details if you want me to help you further more.

    Good luck in your investigations.

    Pascal MARTINEZ

    Anderson Florencio

    unread,
    Jan 18, 2016, 8:50:18 AM1/18/16
    to ZnetDK
    Thanks for answering Pascal. Put the application into a folder in the domain, then the case would be in www.mydomain.com/myapp. Within the domain there is a website in WordPress (Just for your knowledge) and myapp folder is in the same directory. I thought it might be something in the .htaccess, but he was set straight as you suggested, but the error persisted and I delete all .htaccess just to test, but the error still persisted. In error_log file is giving the following Warnings:

    [18-Jan-2016 11:09:40 America / Sao_Paulo] PHP Warning: PHP Startup: Unable to load dynamic library '/ usr / local / lib / php / extensions / no-debug-non-zts-20100525 / ssh2. so '- /usr/local/lib/php/extensions/no-debug-non-zts-20100525/ssh2.so: can not open shared object file: No such file or directory in Unknown on line 0

    [18-Jan-2016 11:09:40 America / Sao_Paulo] PHP Warning: PHP Startup: Unable to load dynamic library '/ usr / local / lib / php / extensions / no-debug-non-zts-20100525 / pdo_pgsql. so '- /usr/local/lib/php/extensions/no-debug-non-zts-20100525/pdo_pgsql.so: can not open shared object file: No such file or directory in Unknown on line 0

    In the index.php file ZnetDK there is a spl_autoload_register line (); that records all classes, commenting that line for the error, but nothing works for not mapped classes. But I think it's something related to that.

    Another thing is that when I tried to access www.mydomain.com/myapp it can not load the CSSs and application of JSs. I realized it was because of the path of configuration variables. Then created a subdomain myapp.mydomain.com posing as the root folder myapp folder, and it can load CSSs and JSs but gets into an infinite loop and inserting these warnings up in the log.

    The strangest thing about this is that since I uploaded this same application to another domain and worked without any problems!

    Pascal Martinez

    unread,
    Jan 19, 2016, 4:27:15 PM1/19/16
    to ZnetDK
    Hello Anderson,

    Should I consider that your problem is now resolved if your application works perfectly on another domain?

    Pascal MARTINEZ

    Anderson Florencio

    unread,
    Jan 25, 2016, 11:29:10 AM1/25/16
    to ZnetDK
    Actually does not solve because the domain that the application will get is that it's not working, rs. The application is an infinite loop. But usually it works on another host. So I wonder if there is some kind of specific configuration that the server needs to have or not have in order to function correctly.
    For you see the real-time behavior simply access the link zadmin.unidosdacachorra.com.br (subdomain) or unidosdacachorra.com.br/zAdmin.
    But the other host cachorra.pe.hu functions normally.
    Some configuration in the .htaccess file of the root domain might have some effect on my application that is in a folder at the root?

    Pascal Martinez

    unread,
    Jan 25, 2016, 5:15:17 PM1/25/16
    to ZnetDK
    Hello Anderson,

    Could you tell me if you get an error in the ZnetDK ../engine/log/errors.log of your application?

    This is the second time that someone reports me this issue when deploying on an internet hosting (for example in France on a "1&1" hosting).

    The problem is due to the AJAX call to the 'home' view made in JavaScript once the main application "index.php" is loaded.
    The AJAX request sent to the server returns the main page of the application instead of the expected 'home' view.

    The main page is normally returned only when an HTTP GET request is sent to the server. I don't know why but ZnetDK processes the AJAX request sent with POST parameters, as it was a GET Request.

    Could you please modify the 'maincontroller.php' at line 139 as shown below;

    if ($action !== 'show' && $_SERVER['REQUEST_METHOD'] !== 'POST') {
        $layoutStatus
    = \Layout::render();
       
    if (!$layoutStatus) {
            $errorMessage
    = "CTL-002: a severe error occurred while loading the layout of the application!";
           
    \General::writeErrorLog("ZNETDK ERROR", $errorMessage, TRUE);
            echo $errorMessage
    ;
       
    }
    }

    Tell me if this modification corrects this issue?

    Pascal MARTINEZ

    Anderson Florencio

    unread,
    Jan 26, 2016, 12:43:05 PM1/26/16
    to ZnetDK
    I made the changes you asked me and stopped loading the application loop, but bears no page. Neither the Home and not through the menu.
    I did a brief study and saw that the variable \ Request :: getMethod () returns nothing and \ Request :: getController () and \ Request :: getAction ()

    Pascal Martinez

    unread,
    Jan 26, 2016, 3:20:56 PM1/26/16
    to ZnetDK
    Hello Anderson,

    This modification of the source code was only made for testing purpose.
    Please, restore to the original code the maincontroller.php script.
      
    I think that your problem is due to the PHP version installed or activated on your hosting server, which would be lower than 5.2.

    The ZnetDK \Request class calls the PHP filter_input statement that is only available in PHP from the version 5.2.

    Could you please check the PHP version installed on your hosting machine ?

    I will add in the next version of ZnetDK a checking on the PHP version in order to redirect the user to the HTTP error page if the PHP version is too low and so, avoid this infinite loop.  

    Regards,

    Pascal MARTINEZ
     

    Anderson Florencio

    unread,
    Jan 27, 2016, 3:52:44 PM1/27/16
    to ZnetDK
    The php version of the server is 5.4 native. I changed in the cpanel to 5.5, 5.6, and not solved the problem

    Pascal Martinez

    unread,
    Jan 28, 2016, 3:51:09 PM1/28/16
    to ZnetDK
    Saisissez le code ici...

    Hello Anderson,

    I don't know why, the $_SERVER variable seems to return an empty value for the key 'REQUEST_METHOD' on your hosting server.

    ZnetDK reads the $_SERVER variable multiple times.

    Could you insert at the beginning of your ZnetDK index.php script, the two lines below:

    echo var_dump($_SERVER);
    die;

    Then, tell me what are the values displayed for the following keys: HTTPS, SCRIPT_NAME, SERVER_NAME, REDIRECT_URL, REQUEST_METHOD, HTTP_ACCEPT_LANGUAGE, REMOTE_ADDR ?

    Regards,

    Pascal MARTINEZ

    Anderson Florencio

    unread,
    Jan 29, 2016, 8:58:55 AM1/29/16
    to ZnetDK
    HTTPS and REDIRECT_URL AREN'T SET

    ["SCRIPT_NAME"]=>
     
    string(10) "/index.php"

    ["SERVER_NAME"]=>
     
    string(30) "zadmin.unidosdacachorra.com.br"

    ["REQUEST_METHOD"]=>
     
    string(3) "GET"

    ["HTTP_ACCEPT_LANGUAGE"]=>
     
    string(35) "pt-BR,pt;q=0.8,en-US;q=0.5,en;q=0.3"

    ["REMOTE_ADDR"]=>
     
    string(14) "200.19.190.147"


    Anderson Florencio

    unread,
    Jan 29, 2016, 9:24:11 AM1/29/16
    to ZnetDK
    In the request.php file I altered the getMethod() function:

    public static function getMethod() {
           
    //return filter_input(INPUT_SERVER, 'REQUEST_METHOD', self::$filter, self::getFilterOptions());
           
    return $_SERVER["REQUEST_METHOD"];
       
    }

    and it works perfectly.

    I believe it has something to do with PHP running on FCGI mode. I read on some forums that FastCGI seems to cause strange side-effects with unexpected null values When using INPUT _SERVER and INPUT_DEV with the filter_input function

    Pascal Martinez

    unread,
    Jan 29, 2016, 11:15:21 AM1/29/16
    to ZnetDK
    Hello Anderson,

    Thank you for your feedback.

    I will publish very soon the patch version 1.21 of ZnetDK to fix this issue.
    You'll be able to download it from the "Téléchargements" page.

    I'll reply to this post when this patch will be available for download.

    See you,

    Pascal MARTINEZ

    Pascal Martinez

    unread,
    Feb 1, 2016, 5:14:16 PM2/1/16
    to ZnetDK
    Hello Anderson,

    The patch of ZnetDK in version 1.21 is now available for download from the 'Téléchargements' page.

    Tell me if it fixes your issue.

    Regards,

    Pascal MARTINEZ
    Reply all
    Reply to author
    Forward
    0 new messages