Slim3 Twig2 Blank Page - OVH server - php

I have a blank page when using Slim3 + Twig2 + PHP 7.2 when I run the application on production (OVH server).
I'have been looking for any answer to my problem, but none of what I have found corrected it...
Thanks for your answer.
Here is my code in one of my controller :
function getAccueil($request, $response, $args = array(NULL))
{
if (empty($args))
{
$args['lang'] = 'fr';
}
$lang = $args['lang'];
$fr_url = '/fr.html';
$en_url = '/en.html';
return $this->view->render($response, 'accueil.twig', array(
'lang' => $args['lang'],
'fr_url' => $fr_url,
'en_url' => $en_url,
));
}
I'm using php 7.2 (and already tried with previous versions)
and get a 200 return http code (using Chrome/Devlopment tools/Network)

Try doing killing the script with die(); before returning the twig renderer. If it still gives a blank page maybe check if something is wrong in the php file where you define your $app and $container. Hope that you can do something with this answer.

Related

can't login into my codeigniter app after long time of usage

it's been a while since i've purchased freelancer office on codecanyon. i'm using it since 2015. I've never had an issue till last week. If I type in a wrong password it gives me an error (which is normal :D) however when i type the correct one it just reloads the page :/ i've set the ENVIRONMENT to production but no error messages.. except for deprecated each() call in mx/modules.php file.
Codeigniter version: v3.1.0
php version : 7.1
app url:
http://app.wolftech.eu
i've the same error with another 'app' that ive bought on codecanyon for a friend of mine. after 1 year of succesfull usage it just reloads the page when attempting to login.
Based on the error output that you've provided, I assume that the error comes from codeigniter modular extension hmvc, that show up because it uses each() function that is deprecated.
If you look at one of the official repository pull request, and from this codeigniter forum thread, you could change the third_party/MX/Modules.php files line 83 :
(is_array($module)) ? list($module, $params) = each($module) : $params = NULL;
and replace it to :
if(!is_array($module))
{
$params = NULL;
}
else
{
$keys = array_keys($module);
$params = $module[$keys[0]];
$module = $keys[0];
}

osCommerce 2.3 - Unable to determine the page link

I have a problem in osCommerce 2.3
PHP/5.6.31
I have tried to setup on my localhost but it will return an error message.
So how can I fix this problem
Is there any problem in the configuration?
Error!
Unable to determine the page link!
Function used:
tep_href_link('', '', 'NONSSL')
If you look in catalog/includes/functions/html_output.php, you'll see the function definition for tep_href_link. It's
function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {
You have provided a blank first parameter. If you look at some examples in the catalog directory, you'll see they provide a first parameter, generally drawn from a define in includes/filenames.php.
i have faced same issue and on debug found this issue comes due to tep_href_link(basename($PHP_SELF) $PHP_SELF is not working properly return blank and got fixed just placing
$PHP_SELF=$_SERVER['PHP_SELF'];
define('CONFIGURE_STATUS_COMPLETED', 1);
at the bottom of includes/configure.php and it worked.

local wordpress using remote database, ubuntu, apache2

im trying to connect my local wordpress install to a db on a domain i own using the code provided here:
https://coderwall.com/p/ck8v4a/remote-database-with-local-wordpress-instance
define('WP_CACHE', true); $currenthost = $_SERVER['HTTP_HOST'];
$mypos = strpos($currenthost, 'localhost/wpdir');
if ($mypos === false) {
define('WP_HOME','http://example.org/wpDir/');
define('WP_SITEURL','http://example.org/wpDir/');
} else {
define('WP_HOME','http://localhost');
define('WP_SITEURL','http://localhost/wpDir/');
}
with the above config i can open the site locally, it loads the navigation and recent post names correctly, so the db-connection seems to work.
i cannot use links and pages are not found though.
if i add my /wpDir/ to the define('WP_HOME'... and/or strpos($currenthost,... it gets redirected to http://localhost/wpDir/home/ (as it should) but i get an URL not found error.
my localhost dir is standard /var/www/html this is where my local wordpress installations are.
any ideas how to fix this?
update: i am back to working on this and it would really help a lot if i could manage to use the remote database for my local testing
i think it may be some kind of url rewriting problem but all my efforts to find a solution did not work...
not sure why it was so hard to find but i managed to do it (another way) basically by following the wp-codex here:
https://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
using the drop-in method:
the code in my db.php file looks like this:
<?php
// paste this in a (new) file, wp-content/db.php
add_filter ( 'pre_option_home', 'test_localhosts' );
add_filter ( 'pre_option_siteurl', 'test_localhosts' );
function test_localhosts( ) {
if (strcasecmp($_SERVER['REQUEST_URI'], '/localCopyOfSite') == 0
|| strcasecmp(substr($_SERVER['REQUEST_URI'], 0, 17), '/localCopyOfSite/') == 0) {
return "http://localhost/localCopyOfSite/";
}
else return false; // act as normal; will pull main site info from db
}

PHRets using POST

I'm using PHRets and trying to return some search results. Below is the code, which is very basic and should work:
include('../include/common.php');
include('../classes/phrets.php');
$rets = new phRETS();
$connect = $rets->connect(RETS_LOGIN_URL, RETS_USERNAME, RETS_PASSWORD);
if($connect){
$search = $rets->SearchQuery('PROPERTY', 'RES', '((COUNTY=Dallas))', array('LIMIT'=>20));
print_r($rets->Error());
echo $rets->TotalRecordsFound($search);
$rets->Disconnect();
}else{
$error = $rets->Error();
print_r($error);
}
When I run the page, I receive the following error:
Array ( [type] => rets [code] => 20203 [text] => The request limit is too large for a GET. Please use the POST method to submit your search. ) 0
I don't see a parameter to force PHRets to send the request as a POST. Will this require a hack of the class, or am I missing something?
Thanks
EDIT: I just heard back from the developer. It's not supported at this time. Perhaps a less-busier person should clone it and work on that.. :) Anyway, if anyone has already has modified the code to make this work, let me know, please.
Get the latest phRETS version which supports POST method from here and replace with your old phrets.php.
then you need to add an extra line to the script
$rets->SetParam('use_post_method', true);
Note: By default it will be GET method.
I've published an updated version supporting POST searches available at https://github.com/nathanklick/PHRETS or via composer by adding "nathanklick/phrets": "1.0.2" to your composer.json file.

Session variable loses index after refresh in Yii

I'm having a problem with the session variables in my web app.
The thing is that I set it with the following code and check if it exists and only if not then I update it.
The idea is to know if the user is enterprise or not for his session.
I use the following code:
$logo_class = "logo";
if(!Yii::app()->user->isGuest) {
define("ENT_LIM_PROD_COUNT", 10000);
$user_id = Stores::model()->findByPk(Products::model()->getStoreID())->user_id;
if(array_key_exists('is_enterprise', Yii::app()->session)) {
if(Yii::app()->session['is_enterprise'] === true)
$logo_class = "logo_ent";
} else {
$total_prod = LicenseMngr::getFeatureAllocTotal($user_id, LicenseMngr::FEATURE_PRODUCTS);
Yii::app()->session['is_enterprise'] = ($total_prod > ENT_LIM_PROD_COUNT ? true : false);
if(Yii::app()->session['is_enterprise'] === true)
$logo_class = "logo_ent";
}
}
I have tried using different types of sessions in my config file and now it's:
'session'=>array(
'autoStart' => true,
'sessionName' => 'session',
'timeout' => 30758400
),
Now, the problem is that every time I refresh the page the index "is_enterprise" is not in the session array as if it was never set.
I have tried changing the session save directory to /var/tmp.
I'm running:
Darwin niflheim 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
PHP Version 5.4.15 (web)
The following line does a rest call to a server to get information we need (It's probably the only thing that isn't related to YII here):
$total_prod = LicenseMngr::getFeatureAllocTotal($user_id, LicenseMngr::FEATURE_PRODUCTS);
P.S: This is not the only custom variable that it happens with, I hope that helps.
OK So after a while we were able to solve the problem... Apparently the session variable in YII is not an array but an object and you can access it as an array so array_key_exists didn't work.
Changing it to isset solved the problem.

Categories