const spawn = require('child_process').spawn;
(async () => {
const promise = new Promise((resolve, reject) => {
const output = {
data: '',
errors: '',
};
options = [
'code.php',
];
const process = spawn('/opt/homebrew/bin/php', options);
process.stdout.on('data', (data) => {
output.data += data.toString();
});
process.stderr.on('data', (data) => {
output.errors += data.toString();
});
process.on('exit', (code) => {
resolve(output);
});
});
const data = await promise;
console.info(data);
})();
function get_first_post_image(string $post_content): string
function get_first_post_image(string $post_content)
return $img->item(0)->getAttribute('src') ?: $defaultImage;
return $img->item(0)->getAttribute('src') ? $img->item(0)->getAttribute('src') : $defaultImage;
version: '3.1'
services:
app-db:
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password --sql_mode=""
restart: "no"
ports:
- "127.0.0.1:3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "root"
MYSQL_DATABASE: "root"
volumes:
- "/home/user/app/mysql:/var/lib/mysql"
container_name: "app-db"
app:
image: cyberduck/php-fpm-laravel:7.4
ports:
- "127.0.0.1:9001:9000"
volumes:
- "/home/user/app/laravel:/var/www/"
container_name: "app"
server {
server_name site.ru;
listen 80;
root /home/user/app/laravel/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9001;
fastcgi_index index.php;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /var/www;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REQUEST_SCHEME $scheme;
fastcgi_param HTTPS $https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param REDIRECT_STATUS 200;
fastcgi_param SCRIPT_FILENAME /var/www/public$fastcgi_script_name;
}
}