I took a copy of my live Laravel 4 app and set it up on an AWS Ubuntu instance.
Here's the same route that works on live site, http://pixcel.com/archivecloud/786531 ,
and the same route with same code (I think) on the EC2 instance
54.186.47.148/archivecloud/786531
Error returned is: Controller method not found
Live site:
PHP 5.3.27 (cli) (built: Feb 21 2014 07:53:29)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies
Apache: not sure, it's shared hosting with site5
EC2:
PHP 5.4.25-1+sury.org~precise+2 (cli) (built: Feb 12 2014 10:45:30)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2014 Zend Technologies
Server version: Apache/2.2.22 (Ubuntu)
Relevant code:
Route LIVE:
Route::get('archivecloud/{id}', 'CloudHomeController#embed');
Route EC2: Route::get('archivecloud/{id}', 'CloudHomeController#embed');
Controller LIVE:
class CloudHomeController extends CloudBaseController {
public function embed($id){
$result = CloudFilm::getInstance()->getFilmByEmbedId($id);
$cliptype = "film";
}}
Controller EC2:
class CloudHomeController extends CloudBaseController {
public function embed($id){
$result = CloudFilm::getInstance()->getFilmByEmbedId($id);
$cliptype = "film";
}}
Looks like the Environment variables are empty. Will look this up.
Related
I can hash in PHP with a salt and SHA-256:
echo crypt('testpassword','$5$rounds=5000$testsalt$');
With this, the stored hash is:
=5rf7xsfKjXFA
But if I try to do the same in linux/bash, I get a different result:
mkpasswd -m sha-256 -S testsalt testpassword
With this, the hash is:
$5$testsalt$8NbtxBXDUq60UB.kmvqYOHepmEdmXS39tViByKR.UU2
Can anyone help with this? - Solved, see comment.
I used
php --version
PHP 7.0.33-0+deb9u12 (cli) (built: Oct 26 2021 17:51:39) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.33-0+deb9u12, Copyright (c) 1999-2017, by Zend Technologies
and
mkpasswd 5.2.17
Copyright (C) 2001-2008 Marco d'Itri
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Currently i am working with Laravel and the maxcdn API.
This is my very little test code
Route::get('cdn', function() {
$api = new MaxCDN("myurl","mykey","mysecret");
$data = $api->get('/account.json');
return response()->json($data);
});
The header is set to json as you see
application/json
Now if i visit my /cdn url the Chrome JSON Formatter should be of course formate the output. But it does not work, i only get this output
"{\"code\":200,\"data\":{\"account\":{\"id\":\"12312\",\"name\":\"My Name \",\"alias\":\"myurl\",\"date_created\":\"2015-05-17 07:51:50\",\"date_updated\":\"0000-00-00 ........
I am working on my homestead machine
php -v
PHP 5.6.6-1+deb.sury.org~utopic+1 (cli) (built: Feb 20 2015 11:25:37)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
The $api->get('/account.json'); call returns a string that contains the json data. You are then passing this string to the response()->json(); method, and that is the output you are seeing.
You need to run the string through json_decode() in order to convert the json string into a PHP object. Once you do that, you can pass that result to the response()->json(); method, and you will get the result you're looking for.
Route::get('cdn', function() {
$api = new MaxCDN("myurl","mykey","mysecret");
$stringData = $api->get('/account.json');
// convert the json string into an actual PHP object
$data = json_decode($stringData);
// respond with the object
return response()->json($data);
});
i have a function wich makes a check if a folder is writable. but when i try to use the php touch variable in it like this
public function isFileServerMounted()
{
$config = $this->getServiceLocator()->get('config');
$storageDir = $config['xxx']['xxx']['xxx'];
$mountCheckFile = $config['xxx']['xxx']['xxxx'];
// we are using a simple file check as indication if we are mounted
return touch($storageDir . DIRECTORY_SEPARATOR . $mountCheckFile);
}
The function always returns true, regardles if the file i am checking is there or not. i checked the paths and they are correct and i can acess the file via nano over schiell.
The touch comand always returns true, regardles if i delete or make the mount check file.
Anyone has any idea why?
I am using:
PHP 5.3.3-7+squeeze19 with Suhosin-Patch (cli) (built: Feb 17 2014 10:10:23)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
OS:
Distributor ID: Debian
Description: Debian GNU/Linux 6.0.3 (squeeze)
Release: 6.0.3
Codename: squeeze
touch() is to sets access and modification time of file.
If the file does not exist, it will be created.
Maybe you can use file_exists like this:
$filename = $storageDir . DIRECTORY_SEPARATOR . $mountCheckFile;
if (!file_exists($filename))
return false;
return touch($filename);
I have the strangest bug. I was like wtf^12.
I have a script wchich calls following function:
function checkNewFilename($newFilename)
{
if (file_exists($newFilename)) {
if (!unlink($newFilename)) {
debugDeploy($newFilename . ' already exists and could not be deleted.');
throw new Exception($newFilename . ' already exists and could not be deleted.');
}
}
}
It gets used like this:
$newFilename = $defaultConfig . DIRECTORY_SEPARATOR . 'client.xml';
checkNewFilename($newFilename);
echo 'wtf is happening here';
copy($configFilename, $newFilename);
Now when i run this code with normall browser/xdebug i get a cachable fatal error as it should be. BUT when i run the script via shell on
php script.php param param param
Somthing nuts happens. IT ignores the exceptions and gous as nothing happend. I get the error before the exception AND the echo after the function call... wth.
I am runing on
PHP 5.3.3-7+squeeze14 with Suhosin-Patch (cli) (built: Aug 6 2012
14:18:06) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0,
Copyright (c) 1998-2010 Zend Technologies
with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
Anyone has any idea what causes this strange behavior?
$myapp = new COM("word.application");
// returns a fatal error: "Class 'COM' not found in c:/www/comConnector.php"
shell_exec("whoami");
//returns "NT authority/system"
My system setup
Win7 Pro
Apache Server version: Apache/2.2.23 (Win32)
PHP
PHP 5.3.16 (cli) (built: Aug 15 2012 20:06:57)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
Add COM support in php.ini:
[COM_DOT_NET]
extension=php_com_dotnet.dll
Since you are using PHP 5.3.16, make sure that you are pointing to the global namespace:
$myapp = new \COM("word.application");
Even though your PHP file might be in global namespace already, but it's a good practice.