Wondering if it's possible to execute composer
from the browser with a little PHP wrapper as I don't have access to shell access to the server.
Not sure if you can do this with cURL?
Wondering if it's possible to execute composer
from the browser with a little PHP wrapper as I don't have access to shell access to the server.
Not sure if you can do this with cURL?
You can try like this:
<input type="button" onclick="go();" value= "Update" />
function go()
{
$.ajax(
{
type: "POST",
url: "script x1.php",
data: data, // data to send to above script page if any
cache: false,
success: function(response)
{
// update code for your page
}
});
}
This will run your script in the background and then you can also update the contents of the page. You might want to modify the code as per your needs.
which has no echo's or or other output, successes or failed
There should be some response sent back for the above script to be able to know that it has finished running otherwise i am afraid you can't find out when and how script ended.
Note: Using JQuery here.
Heres the full code to download and install:
That code does download the Composer INSTALLER, but NOT Composer itself! If you run that download, you execute the installer, which tries to download Composer. You cannot use the installer to download the Composer dependencies.
The namespace for guzzle 4 is GuzzleHttp
in guzzle 3 the namespace was simply Guzzle
.
A composer.json
of:
{
"require": {
"guzzlehttp/guzzle": "~4"
}
}
Should allow you to run a php script of:
require 'vendor/autoload.php';
use GuzzleHttpClient;
$client = new Client();
$requests = Array(
$client->createRequest('GET', 'ams1.myapp.com:8080/api/ffmpeg_make_snapshots.php'),
$client->createRequest('GET', 'ams2.myapp.com:8080/api/ffmpeg_make_snapshots.php'),
$client->createRequest('GET', 'ams3.myapp.com:8080/api/ffmpeg_make_snapshots.php'),
);
$client->sendAll($requests);
If the autoloader still fails after changing the namespace it could be that your version of composer is out of date and does not recognize PSR4
autoloading. If there is no file in vendor/composer/autoload_psr4.php
try doing a composer self-update
followed by a composer dump-autoload
to see if the problem is resolved.
OK. I got it. It is an issue with permissions. The .svn directory must have the right permissions because the svn update command is using those directories to write stuff.
So! ---Make sure you run all chmod commands as sudo or root----
If nothing. You must run chmod 777 recursively for all .svn directories then run another svn update
Still nothing?
Make sure you don't have two svn clients In my case, the svn client used by the UI is different from the svn (command line) If you have two clients, make sure they are running the same version Or update your script to call the client directly.
Still nothing?
Run a chmod 777 -R * svn update and try again
If you can make it work with another set of permissions, please let me know. I know that 777 is not ideal, but I can't make it work with something lower.
Thanks again guys.
Yes you can run Composer with a little PHP wrapper. All of the Composer source code is available in the Phar file, so it can be extracted and then you can run it after setting up an InputInterface to replace Composer expecting the commands to be passed in via the command line.
If you setup your directory structure like this:
Put the code below into composerExtractor.php and then run it from a web-browser, Composer should download all the libraries into:
As well as generating the class-loader files in that directory as well.
composerExtractor.php
Although this is possible, it's not a fantastic idea but may be necessary if you can't use a host that gives you ssh access.
I'd strongly recommend at least getting a static IP address for yourself or your office and then restricting access to just your own IP, as well as probably deleting this script after it's run on the server to prevent it being accidentally run again.