• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
to use / or to use \ ?

#1
I have this code
PHP Code:
require 'vendor/autoload.php';
use 
Aws/DynamoDb/Exception/DynamoDbException;
use 
Aws/DynamoDb/Marshaler;
require 
'vendor/aws.phar';
//use AwsDynamoDbDynamoDbClient;
use GuzzleHttp/Stream/Stream  //for the s3 interface 
 But I want to use this same code on both my Windows test server and my Linux server. Originally I had \ but read a post that said never to  use \. How do I create a module that works on both Windows and Linux?


[Thu Sep 20 20:48:57.361710 2018] [proxy_fcgi:error] [pid 1879:tid 140116345394944] [client 69.124.178.164:52098] AH01071: Got error 'PHP message: PHP Warning:  The use statement with non-compound name 'Aws' has no effect in /opt/bitnami/apache2/htdocs/sub_crud/application/controllers/Subit_backend.php on line 5\nPHP message: PHP Stack trace:\nPHP message: PHP   1. {main}() /opt/bitnami/apache2/htdocs/sub_crud/index.php:0\nPHP message: PHP   2. require_once() /opt/bitnami/apache2/htdocs/sub_crud/index.php:318\nPHP message: PHP Parse error:  syntax error, unexpected '/', expecting ',' or ';' in /opt/bitnami/apache2/htdocs/sub_crud/application/controllers/Subit_backend.php on line 5\nPHP message: PHP Stack trace:\nPHP message: PHP   1. {main}() /opt/bitnami/apache2/htdocs/sub_crud/index.php:0\nPHP message: PHP   2. require_once() /opt/bitnami/apache2/htdocs/sub_crud/index.php:318\n'
proof that an old dog can learn new tricks
Reply

#2
First, namespaces have little to do with file paths, unless they're used with PSR-4 type autoloading. Even still, your namespaces are used with backslashes. See: http://php.net/manual/en/language.namesp...orting.php

For file system paths that are required or included, just use forward slashes.
Reply

#3
Thanks Brian. I changed it back to the / I was originally using. I have an error during the CORS sequence and I am trying everything to solved it.
proof that an old dog can learn new tricks
Reply

#4
Cross-Origin Resource Sharing (CORS)
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#5
Yeah Insite, I got that one. I have been fiddling with the headers but I just can't get it right. This is a Post and does not need pre-flight from my understanding. That is because

 "permissions": [
   "activeTab",
   "identity",
   "identity.email",
       "http://localhost/*.*",
"https://www.substantiator.com/*.*",    <<<<<<<here
"https://substantiator.com/*",
"geolocation",
"storage",
"tabs"
 ],

So my plan right now is to use Wireshark (initially on the browser PC) to make sure than the headers are AOK. If that doesn't work, i will stick it up on the linux server through ssh. Something is strange, but I can't really see it since the payload is encrypted. I am getting the same strange error in  Apache error.log

[client 69.124.178.164:49166] malformed header from script 'index.php': Bad header: {"0":["{choose}","IOS","Mac","

What does index.php have to do with this? That is my return buffer back to the extension, but why would it be in the header?

        $this->output
             ->set_content_type('application/json')
             ->set_header("Access-Control-Allow-Origin", "*")
             ->set_output(json_encode($table));
proof that an old dog can learn new tricks
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.