I tend to use one of a programms that i installed on my vps server ,
the script which i made is work perfectly on my localhost , but it doesn't work on vps.
Here what i tried
$r = shell_exec('wkhtmltopdf http://monsite.ma/generate/15 /var/www/vhosts/monsite.ma/qr-u15.pdf');
// $r contain a null variable
Full path command also not working .
i have centos6.5 with php5.5 installed on my vps too .
and Windows7 with php5.5 on my localhost
Related
I'm running Windows 10, with a WSL2 Ubuntu instance. I do my development within the WSL2 instance with the "Remote - WSL" extension of Visual Studio Code. So my VSC is running as a WSL2 application, not as a Windows application. I have an additional remote server (I'll refer to this as "Server X" which actually hosts/runs the PHP code. This remote server does not support the use of the "Remote - WSL" extension, so I use an "SFTP" extension to push my changes to this server. And I cannot run the code locally (in either Windows or WSL2) due to the database connection being unsupported.
I'm trying to configure remote debugging of the code on Server X from within VSC running as a WSL2 application (IE: using the "Remote - WSL" extension). The intent is to listen for a browser request to initiate the debug session.
What's happening is when I turn on "Listen for Remote Connection" in VSC when running as a WSL2 application, it doesn't detect the browser when I refresh it. I've determined the reason is because while running as a WSL2 application, my IP is different than when I'm outside WSL (which is where I'm refreshing the browser). So in short, I'm initiating a browser session outside of WSL (IP: 192.168.1.2), the remote server attempts to connect to a debugger at 192.168.1.2:9003, but doesn't find one because my VSC is listening on 192.168.1.3:9003 while it's running as a WSL2 application.
I've confirmed if I instead run VSC as a Windows application (IE: not using Remote - WSL extension on WSL2 instance) everything works fine after adjusting some setting paths to point to Windows PHP rather than WSL2 PHP.
I've been trying to play around with using SSH tunnels to re-route my port 443 traffic from Windows through WSL, but have been unsuccessful so far.
Has anyone run into this issue and have any idea how to get around it? Or is what I'm trying to do unsupported/discouraged?
So WSL runs under the 172.16. 0.0/12 private address range and is not directly accessible by anything external to the host Windows machine. As such, populating xdebug.client_host with this IP, will not work.
My initial idea of using port forwarding was correct, but not in the direction I thought. Instead of redirecting the outgoing web traffic (443 since my site is using SSL) from Windows through WSL, then redirect from WSL to Server X. I instead just needed to redirect the incoming xdebug traffic (9003) from Windows to WSL. (Probably what #Derick was alluding to)
To do this, I left xdebug configured as it normally would have been if WSL wasn't in the picture.
So:
zend_extension=xdebug
xdebug.mode=profile,debug
xdebug.idekey=<ide key value here>
xdebug.client_host=<ip of windows host, as backup>
xdebug.start_with_request=trigger
xdebug.trigger_value=<my trigger value>
xdebug.discover_client_host = 1
Then, using the following PowerShell script on the Windows host to redirect port 9003 from the Windows host to the WSL guest:
If (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
$arguments = "& '" + $myinvocation.mycommand.definition + "'"
Start-Process powershell -Verb runAs -ArgumentList $arguments
Break
}
$remoteport = bash.exe -c "ifconfig eth0 | grep 'inet '"
$found = $remoteport -match '\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}';
if ($found) {
$remoteport = $matches[0];
}
else {
Write-Output "IP address could not be found";
exit;
}
$ports = #(9003);
for ($i = 0; $i -lt $ports.length; $i++) {
$port = $ports[$i];
Invoke-Expression "netsh interface portproxy delete v4tov4 listenport=$port";
Invoke-Expression "netsh advfirewall firewall delete rule name=$port";
Invoke-Expression "netsh interface portproxy add v4tov4 listenport=$port connectport=$port connectaddress=$remoteport";
Invoke-Expression "netsh advfirewall firewall add rule name=$port dir=in action=allow protocol=TCP localport=$port";
}
Invoke-Expression "netsh interface portproxy show v4tov4";
Above script is modified from the script found here:(https://dev.to/vishnumohanrk/wsl-port-forwarding-2e22)
Which itself is modified from here: (https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723)
Note*: You have to install net-tools in the WSL guest in order for the above script to work, so: sudo apt install net-tools.
i have got a local installation of xampp with wordpress.
xampp -> htdocs -> mywordpress -> composerproject
content of composerproject
I am using a wordpressplugin to include php in articles of wordpress like this
include('../composerproject/recanalyst/test.php');
Everything works fine on a local maschine with xampp an the same wordpress both are working with php 7.1.
But when i deploy the same on my webspace with following settings:
paths of webspace
define('ROOTPATH', __DIR__);
echo ROOTPATH;
require ROOTPATH . '/vendor/autoload.php';
use RecAnalyst\RecordedGame;
$filename = ROOTPATH . '/test.mgz';
$rec = new RecordedGame($filename);// This line 12 doesnt work
Error line 12
Uncaught Error: Class 'RecAnalyst\RecordedGame' not found in /var/www/vhosts/myhoster.net/httpdocs/recanalyst/test.php:12 Stack trace: #0
Composerproject on github:
enter link description here
Can be closed. My webhoster is running with php 7.1 but their cli was running with 5.3.3. So i had installed with putty an old version of composer without recognizing it. Changing the CLI to 7.1 was the solution.
I am running scandir($path) where $path is a network location and it is behaving in a very strange manor. In my script, I have path as
$path = "\\\\server-name\\shared folder"
$folders = scandir($path)
When I do a var_dump($folders) I get array(0) {}
When this happens, I restart the Apache 2.4 service and if I run the script again after restarting the service, I get the anticipated result. When the command scandir() fails, I can't get any records in the error.log file of apache folder in XAMPP.
Could somebody explain why it works when the Apache service is restarted and why it stops working again after a while please?
Additional Info:
Server - Windows Server 2008 R2 / PHP Version - 5.5.11
I've got the following code and the semaphore wouldn't lock it as expected.
(I'm aware of apc_inc. This is not what I'm looking for.)
$semkey = sem_get(123);
sem_acquire($semkey);
$count = apc_fetch('count111');
if(!$count) $count = 0;
$count++;
apc_store('count111', $count);
sem_release($semkey);
followed by
ab -n 4000 -c 200 http://localhost/test.php
0 requests failed.
but after that an apc_fetch('count111') shows only ~ 1200 hits
nginx on ubuntu 12.04 (64bit), php 5.3.16~dotdeb, php-fpm
update 1: works perfectly on Linux mint, 5.4.6~dotdeb, built in web server. I'm going to try the same machine with the same version with nginx.
The problem was, apparently, with the APC itself, not with the semaphore.
Updating to PHP 5.4.8-1~dotdeb.0 has solved the problem for both nginx and built-in server test runs.
On one computer with Windows 7 connecting to memcache runs OK, but on another I get:
Warning: memcache_connect() [function.memcache-connect]: Can't connect to localhost:11211
Code which I'm trying to run is:
$memcache_obj = memcache_connect('localhost', 11211);
I also can't connect via telnet, a failed connection.
start>run type CMD , in the console window type netstat -a -n , do you see something like 0.0.0.0:11211 ... LISTENING ? , if no , probably memcached is not running , or is configured to another port .
In the console , try c:\memcached\memcached.exe -d start 'supposing you have memcached installed in c:\memcached .
to run memcached as windows service , try memcached.exe –d install .
YOU SHOULD START THE CONSOLE AS AN ADMINISTRATOR . try start>all programs > Accessories , then right click on command prompt and run as administrator , then apply all of the above
Memcached is either not running on the machine that you can't connect on or the instance of memcached running on that machine is configured to use a different port.
If you don't have (or want) an instance of memcached one each machine you will need to change "localhost" to the IP of the machine that is running memcached (assuming they are networked).
If it is set up try starting memcached again, and ensure you're using port 11211.