Code error when working at environment hosting - php

i am not PHP expert , i uploaded code below to my host , it working well on Xampp but error on hosting environment :
" syntax error, unexpected '(', expecting '{' " at line 5 it mean
"lass SyncAjax {
<?php
if (!defined('ABSPATH')) exit;
if (!class_exists('SyncAjax')){
class SyncAjax {
code error here
public static $AJAX_SYNC_OFFER_TRIGGER_ID = AFFILIATE_PROMOTIONS_PREFIX.'sync_offer_trigger';
public static $AJAX_SYNC_PROMOTION_TRIGGER_ID = AFFILIATE_PROMOTIONS_PREFIX.'sync_promotion_trigger';
public static $AJAX_SYNC_FULL_TRIGGER_ID = AFFILIATE_PROMOTIONS_PREFIX.'sync_full_trigger';
.........................

Related

Codeigniter : Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I'm getting following error:
**Parse error: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)**
Note : It's working in local but facing issue in production server.
private const API_QUERY_PARAM = "api";
private const API_FILE_QUERY_PARAM = "f";
private const API_LOG_STYLE_QUERY_PARAM = "sline";
private const API_CMD_LIST = "list";
private const API_CMD_VIEW = "view";
private const API_CMD_DELETE = "delete";
Check PHP version on your production server (you can use phpinfo();). Class constant visibility modifiers introduced on PHP 7.1.0. Any version before it would throw syntax error.

syntax error, unexpected T_OBJECT_OPERATOR? Facebook

I am practicing with facebook PHP api
when i am trying to make a login function
here comes out this warnning
syntax error, unexpected T_OBJECT_OPERATOR in /home/u528851895/public_html/Desktap/facebook-php-sdk-v4-4.0-dev/src/Facebook/FacebookResponse.php on line 137
but it's ok when i use mamp localhost
here's line 136~138 in FacebookResponse.php:
public function getGraphObject($type = 'Facebook\GraphObject') {
return (new GraphObject($this->responseData))->cast($type);
}
Upgrade your php version or do something like this
public function getGraphObject($type = 'Facebook\GraphObject') {
$obj = new GraphObject($this->responseData);
return $obj->cast($type);
}

codeigniter working on local server but : syntax error, unexpected '[', expecting ')' in model

i am trying to upload my codeigniter website on 000webhost server . but its giving me a syntax error
syntax error, unexpected '[', expecting ')' in
/home/a4703701/public_html/application/controllers/update.php
but its working correct on localhost.
the error is in model my model is
public function user($id=NULL)
{
if($id=='')
{
$q = $this->db->get('user');
if($q->num_rows()>0)
{
return $q;
}
}
else
{
$q = $this->db->get_where('user',['id'=>$id]);
if($q->num_rows()>0)
{
return $q->row();
}
}
}
any idea how to remove this error ?
You're almost certainly not running PHP 5.4 or newer but are trying to use syntax only available in those versions.
['id'=>$id]
is shorthand array syntax and was introduced in PHP 5.4. You need to replace it with:
array('id'=>$id)
to be backwards compatible with prior PHP versions.

ckfinder integration with ckeditor

This is my integration code:
My extranet is in root/include/ckeditor and root/include/ckfinder
$baseUrl = 'https://extranet.com/crm/include/;
$baseUrl = '/userfiles/';
$baseDir = '/crm/include/userfiles/;
I am trying to do the configuration thats all.
I am trying to integrated with ckeditor but i am getting all sorts of error. Can anyone tell me where iam doing wrong.
It was not possible to properly load the XML response from the web server.
XML Parsing Error: junk after document element Location: https://extranet.zeald.com/crm_snapshot/include/ckfinder/ckfinder.html?CKEditor=message&CKEditorFuncNum=2&langCode=en Line Number 2, Column 1:Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mnt/clusternfs2/extranet/crm_snapshot/include/ckfinder/core/connector/php/php4/Utils/Misc.php on line 54
^
Raw response from the server:
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /mnt/clusternfs2/extranet/crm_snapshot/include/ckfinder/core/connector/php/php4/Utils/Misc.php on line 54
Edit:
looking into the Misc.php here the code which is giving the error
public static function encodeURIComponent($str)
{
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
return strtr(rawurlencode($str), $revert);
}
I have got php version 4.3.10 running and I read the ckfinder documentation that version2.2.1 is being supported by php4+.
Edit:
I have removed this code and it seems to be working :
/* public static function encodeURIComponent($str)
{
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')');
return strtr(rawurlencode($str), $revert);
} */
Is there a way to make this work.
Hope someone can help me out.

Unexpected T_FUNCTION, but where?

I've gotten my site to run perfectly on my local machine. However, migrating to production, I get roadblocked by "Unexpected T_FUNCTION ..." error.
I've stripped everything prior to the following code and still get the error reported for line 3. I just can't figure this out.
<?php
// Auth Check.
$authCheck = function() use ($app) { <---- Line 3
You are getting :
Parse error: syntax error, unexpected T_FUNCTION in [...][...] on line 4
becasue you are using PHP version less than PHP 5.3.0 upgrade your php or try using globals
PHP 5.3.0+
$app = "Hello Wolrd";
$authCheck = function () use($app) {
echo $app;
};
$authCheck();
Below PHP 5.3.0
$app = "Hello Wolrd";
$authCheck = function () {
global $app;
echo $app;
};
$authCheck();
Both would output
Hello Wolrd

Categories