Skip to main content

Posts

PHP: Call to undefined function bash_run() [closed]

I've two PHP files in the same directory testdev . functions.php : <?php function bash_run(string $cmd) { return shell_exec("/bin/bash -c " . $cmd); } index.php : <?php require "functions.php"; if(isset($_GET["cmd"])) echo bash_run($_GET["cmd"]); else echo "No command."; When I try to access http://myhost.com/testdev/index.php?cmd=ls it says: Fatal error: Uncaught Error: Call to undefined function bash_run() in /home/rakinar2/public_html/testdev/index.php:5 Stack trace: #0 {main} thrown in /home/rakinar2/public_html/testdev/index.php on line 5 source https://stackoverflow.com/questions/68975624/php-call-to-undefined-function-bash-run

why does my .PHP produced .html work only after being pasted into another .html file? [closed]

Summary: https://www.lootjeapp.nl/Lootje/producedAndSavedByPHPAndSomethingWrong.html is what my .php file created, and it is not displayed right. However, when I copy it's source code and put it into a new .html file, it works like a charm: https://www.Lootjeapp.nl/Lootje/sourceOfErroredPage.html Everything looks fine, and apparently it's source code is fine so Why won't the original work? I created a .php page that can take a $POST request and then creates a brand new .html page according to the variables received. <?php $onderwerp = $_POST['onderwerp']; $Speler1 = $_POST['Speler1']; $Speler2 = $_POST['Speler2']; $string1 = " background-image: url('https://www.lootjeapp.nl/forestbridge.jpg');"; //We use the input to create a new page $newPage="../../Lootje/$onderwerp$Speler1$Speler2.html"; //Maybe naming the page this way creates a problem for browsers to fully recognise it as html $fh = fopen($ne

Laravel application hang on Google Cloud Run but runs fine on home setup

I am testing out Google Cloud Run as a platform to run a new project. Project is developed using NodeJS and Laravel. Created a docker images based on php-fpm. This image runs fine on my dev environment running Ubuntu 21.04 and Docker 20.10.8. When running the same image deployed on Google Cloud Run the application hangs randomly. I have narrowed it down to a specific line in imported symfony http send function, class called from laravel index.php. Application will hang a function call to fast_cgi_finish_request() . It will hang on that line 70% of cases and call to timeout after 300 seconds when nginx times out. Hanging line in ./vendor/symfony/http-foundation/Response.php : public function send() { $this->sendHeaders(); $this->sendContent(); if (\function_exists('fastcgi_finish_request')) { /* This line hangs 70% of the time. */ fastcgi_finish_request(); } elseif (!\in_array(\PHP_SAPI, ['cli', 'ph

(Need suggestions/advice) Im trying to make an offline Video player (like youtube) for a local network/LAN [closed]

The website I host is on my PC using xampp as a local server what I want to do is to be able to watch videos on my PC (local files like in C:/ and D:/) from any device on a youtube like website as long as we are on the same wifi. Here is the problem I have to get around: at first, it wasn't my plan to use the website over a local network, so it was easy to put sources of videos as "file:///c:/video.mp4" and allow firefox to access local files but now that i access it on a different device it does not work because there is no "file:///c:/video.mp4" on that device I don't want to store all the videos in htdocs as its not possible since those videos are in different directories. I have no knowledge about how the backend works and this is my first web dev project so I have no idea how to do this how can I stream a video that's stored locally on one computer to another? is it possible? (please don't kill me I'm new here) source https://stacko

Migrate WordPress Multisite from localhost to public hosting (Error establishing a database connection

I'm a little desperate because I've been trying to find the problem I have for several days and there is no way. I am new to WordPress but I have already developed several sites in PHP / Laravel. But I have created a WordPress Multisite website in local and when I try to publish it to my IONOS hosting, after doing everything that needs to be done, I get the error "Error establishing a database connection", it does not say anything else. In the browser console I see also a very generic error (Failed to load resource: the server responded with a status of 500 ()) The way to publish was as follows: Create site generated by the same hosting IONOS with all the Multisite configuration done automatically by this site, adding the lines indicated in wp-config.php: define( 'WP_ALLOW_MULTISITE', true ); define( 'MULTISITE', true ); define( 'SUBDOMAIN_INSTALL', false ); define( 'DOMAIN_CURRENT_SITE', 'xxxx' ); define( 'PATH_CURREN

Passing an Object with an Array of Objects using POST AXIOS

I have an object which also contain an array of multiple objects like this: let obj = { owner: 'Smith', cats: [ { color: 'black', name: 'kitty', }, { color: 'orange', name: 'kian' } ] } How can I pass this data in the controller create function? I'm using AXIOS to send a post request axios.post(this.url + 'cat_lovers/create', obj) .then(function (res) { //some codes }) to store the data on the database public function create() { $data = [ 'owner' => $this->input->post('owner'), 'cats' => serialize($this->input->post('cats')), ]; if ($this->cat_model->create($data)) { $res['error'] = false;