How to use official php docker image without interactive mode - php

I'm trying to create a docker image that will spin up a container to run a Minecraft PE server. PocketMine-MP a Minecraft PE server.
The server requires PHP binary, and I want to use the official PHP docker image. However, it seems like the php docker image is configured to run in interactive mode.
I just want to use that PHP image since it has the binary in it, and copy over the necessary file to start the server, is there anyway to get rid of the interactive prompt?
I can run the php image in detached mode, but I wasn't sure if there is a better way to approach it.
I hope my intention is clear. Thank you for your time.

Found my answer. Seems like running the container in detached and interactive mode with flag -d and -t is the recommended way.

Related

Using PHP to copy files from a ScreenOS device

I am making a script to backup configs for firewalls. One thing I want to do is scp files from ScreenOS devices, but I get a blank line from the CLI.
What I need to do in build this functionality into an already existing web interface, so I need to be able to run this command from within PHP.
I have looked at shell_exec, system, etc, but im haivng issues at the CLI level running the commands.
Any help is appreciated.
I have been in the field for years. This is actually a bug with ScreenOS devices that are version 6.5 or less.
There is an article, Gotcha - SCP Returns To Prompt, which documents this bug and walks you through configuring a separate install of OpenSSH which includes the SCP fix to support older ScreenOS devices.
As for your web interface, once you get this bug fixed, map your shell_exec command to this new scp binary, and you will be all set.

PHP Copy function slower than linux cp command when copying from remote NFS share

I have been trying to copy an audio file from nfs share on another server. When I use PHP to copy the it takes 5.5 seconds to copy an 8 MB audio file. However when I use the cp command in the shell it takes 0.845 seconds.
Does anyone have any idea what the problem is and how to fix it?
<?php
$result = copy('/remote/dir/remoteFile.wav’,’12345.wav');
var_dump($returnVar);
?>
Also, you can be certain the the PHP copy will be slower than linux cp because one uses native OS level calls, and the other is application layer which invokes the same through the web server et al. Too many layers to go through, notifications to process, protocols to adhere to etc etc.. I do not think this is exactly fixable..
Maybe instead of a copy() you could try an exec('cp ..') command which will directly try to run the linux cp command from php. Might not give you as much speed as cp from shell, but might make it a bit more faster than copy() from php. Give it a try..

Running continuous PHP (script) background processes on a WAMP server

I got the 140dev Twitter framework (which uses the Twitter phirehose) manually
running (via the webbrowser on my local wamp server), but I can't
figure out how to run both get_tweets.php and parse_tweets.php as a
background process like with SSH commands:
nohup php script.php > /dev/null &
Some of you started using (the Windows equivalent of) cronjobs, but
this isn't the right way to go. I think this is because of creating
multiple connection (or re-connections) to the Twitter streaming phirehose isn't allowed?
How can I run both PHP scripts (get_tweets.php and parse_tweets.php)
as a background process on my local WAMP server (and later on a VPS)?
Just to clearify:
I am using a WAMP server (first to test a little bit and later to
run it on a VPS)
Using LAMP or any *nix server/system isn't an option (due to time,
experience and lack of skills)
I have searched for solutions (on google and stackoverflow), but they are either not working or not clear enough for me (I am new to this)
Thank you in advance.
Find the php/bin folder where the php.exe is located. Copy the folder path and add it to your PATH environment variable (Follow this for instance to edit your PATH variable.
Once this is done, you'll be able to execute php in the command line from anywhere. Just start php script.php with a command line in the right folder and it should work. There might be some configuration to make so that the php in command line uses WAMP's php.ini.

Connect GIMP with PHP or Python

is there any way to connect GIMP with python or PHP and use its libraries? It seems that all i can find on the web is pygimp which is not supported anymore.
ps. i do my development on mac and i use linux as a production server
You can write GIMP plugins in Python (see, for example James Hestenridge's clothify, then call the plug-in from the command-line with a command of the form
gimp -i -b '(python-fu-bw-film RUN-NONINTERACTIVE "/path/to/filename.jpg" 0 1 FALSE FALSE FALSE FALSE FALSE FALSE)' -b '(gimp-quit 0)'
It's not exactly pretty, but it's possible. Here is another example.
Probably not directly, but I'll bet you can access some functions via 'exec()' on the command line. What are you trying to do? Can the GD or ImageMagic tools help?
One important thing regarding running gimp python plugin in batch mode.
Option -i means no interface. But in gimp documentation there is another option with same explanation --no-interface. User could though that they have same effect.
But when you try to run batch script on remote linux machine, with option -i you will get 'no display'. With option --no-interface, batch script will run without error. My colleague discovered that this is undocumented gimp 2.6.11 feature.
Regards, Karlo.

How to compile an iPhone application source code on server using command line in Windows?

I have an application in which I change the data on web and then download the files then I compile my iPhone app with data. I just want to create ad-hoc distribution so I have already added devices. So is there a way that anytime I change data on web then I compile my iPhone app over the server using PHP and some command-line script so that I create a ready-made ipa and user can install the application using iTunes? Also is it possible to compile on Windows?
Also how do we change ad hoc provision profile? I mean where we can set code sign?
How do we invoke terminal and run command xcodebuild using PHP? Suppose we have mac server then how we invoke terminal and then navigate to project directory and run xcodebuild command?
Check out the OS X commandline program xcodebuild. When your current directory is the project directory (the one with the .xcodeproj file), xcodebuild will compile the primary target. See man xcodebuild for more options.
have you thought about setting up a build server with different scripts that can perform the requirements that you are asking for and of course a Web Interface to interact with it ?
This link describes how to do it, and in the comments of the blog readers mention several other Build Server alternatives with Xcode Project support.
Sorry if this is not the exact answer that you are looking for, but may be a valid angle to solve your problem ?

Categories