Parallels PLESK 12.0.18 - PHP exec() disabled - php

I've been trying to exec() an exe which calls wkhtmltopdf to produce a PDF and then push it to the browser.
However, exec() and system() and shell_exec() seem to be not working under Plesk 12.0.18 on a windows machine, presumably for some crappy security reason.
Does someone know how I can go about enabling this? I know safe mode no longer exists in PHP 5.6 so I am not sure why this isn't working.
Very annoyed. I have root access as this is a dedicated server with 1 and 1.

I just uninstalled PLESK and installed Wamp Server.
Problem solved.

Related

I had XAMPP on my device but I have to uninstall it now my project does not run on localhost

XAMPP has some error about ports I uninstall it but did not back up any information and now my project does not run on local host is there any way for me to restore my old project or I have to do it again on new XAMPP? another problem is after reinstalling XAMPP windows do not know PHP what should I do?
by the way I am a very beginner in this :)))
So, I will try to explain this:
Websites (i.e. with PHP) need a webserver. For example when you go to stackoverflow.com, you automatically call a webserver who then compiles the PHP scripts on the server to HTML code.
This principe does also apply to your local installation.
When you call localhost, you basically call yourself as the webserver. XAMPP is a tool that can "simulate" a webserver on your PC, thats why PHP sites do not work without it, because your browser doesn't know what to do with PHP code, it only understands HTML.
If you install XAMPP again you should be able to get it running.
If you have any questions/problems with the XAMPP installation, feel free to ask again.

How to serve a PHP file in Windows without XAMPP?

The situation is simple: I have a PHP file and I want to serve it on my localhost. I already have MySQL set up and don't want to install XAMPP or other bulky packages which come with their own MySQL or any other thing such as that.
I tried many Node.js ways to serve a PHP file but none worked for me.
Please, I just have a file and want to "run" it. How can I do that?
Unfortunately, if you want to run a "server-side" code (in your case PHP) in your Windows computer, you have to use a web server that simulate for you it.
XAMPP (or WAMP) enables localhost port to receive connections from yourself and it is a smart way to try in "local" your code.
If you want to run PHP but you don't want to install XAMPP, then you can install a linux distribution and run "apache HTTP server" that is already installed in most distributions. But in every case you need a tool to simulate the "server-side" part.
First of all nodeJS means nodeJavaScript. So it will not support php with mystery magical things.
You could only install Apache server and mySQL. Then you don´t need any XAMPP and the tools it brings with it.
Try to install Apache standalone.
Not sure if this works but should be no problem.
But all in all i would recommend you to use XAMPP

Installation failed in Ghostscript on Windows XP

I want to convert PDF to images in PHP. For that I installed Ghostscript and also imagick but it's a failure. I am using a WAMP server.
If I run my code means it will not work so I didn't install the software successfully...
Can anyone please guide, how to install the Ghostscript on my WAMP server on Windows XP.
The past two days I was struggling for this installation. DLL file also failed.
The fact that your code doesn't work doesn't necessarily mean the software failed to install. In fact you haven't presented any evidence that it did fail. Did you get any error messages during installation ?
Can you run Ghostscript and ImageMagick from the XP command shell ? If not, what errors do you get ?
If the applications work from the command shell, then you have 2 obvious possibilities:
1) The environment is different when running your PHP server, you should check the PATH environment variable at the very least, but compare the entire environment you are using vs the command shell environment.
2) Your code has a bug which prevents it working. Again, do you get any error codes ?
The question as you've presented it can't be answered because there isn't enough iniformation. The only answer I can give to your question is 'use the Installer Luke'

PHP -> CLI has stopped working

I recently installed Windows 7 on my desktop and the following problem has begun occuring:
I regularly run some PHP scripts from the commandline that are now giving this error in a popup window:
CLI has stopped working.
I cancel this and my script terminates. Not good...
I've googled around and tried most of the few ideas suggested but still i am plagued by this annoyance. Right now it appears to regularly occur when I do a file_get_contents() of a url pointing to an image file. Only happens when the url is http protocol, works fine for ftp files. It also happens spuriously doing other things as well.
This is PHP 5.3.0 as distributed in a xampp 1.7.2 .zip. All exe's and dll's have been unblocked by copying thru FAT32 and back.
hints from anyone who's cracked this would be most helpful.
Try updating your PHP version bundled with xampp. You might have to update some php_XXX.dll extension files.
More info: http://web2.0entrepreneur.com/31/cli-has-stopped-working-on-windows-vista.html
PHP-CLI stops under these circumstances: Windows 7 64bit, PHP 5.6.8 64bit, only when Zend OpCache extension is ENABLED!!!
Just edit php.ini and comment zend_extension=php_opcache.dll (with ; in front of it)
I found that this happened to me when I had the APC extension enabled. I switched to using the Wincache for PHP extension instead.
If you receive this error after installing WAMP, most likely you have another installation of PHP on your machine. This may have been installed using the Microsoft Web Platform Installer or by other means. The first thing you should do is un-install PHP.
If this doesn't work, check to make sure that IIS and Apache are not trying to use the same port. WAMP starts out with Port 80 as standard and IIS usually will be the same. The easiest way to fix this is to turn off IIS while running WAMP, but you can set either of them servers to port 81 or another port.
If this doesn't work, my last suggest is to look for multiple copies of php.ini on your machine. You may find them in places like the Windows directory. Make a backup of the file just in case, and then remove them from all of the folders except the WAMP folder.
it happened to me in laravel 5.I searched every where but no solution that fix my problem then i debug my web application at different points and found that if you comment your php code in laravel comments in blade template like
{{--print_r($date_a);--}}
Now comment like this
//print_r($date_a);
works
The solution for me was to stop using PHP 5.3.0 and go back to 5.2.11. Once I did this the "CLI has stopped working" issue disappeared.
I have the same issue with Windows 7 Professional.
My Apache Server has no problem finding and executing PHP within my web application but the command line execution gives the infamous message "CLI has stopped working."
The User Account Settings seem to allow executions.
Perl has no problem.
I always have to take my code to an XP machine and run it there to debug it.
You didn't specify that you were using xdebug, but just in case you were, I may be able to help. I had this error for a long time. It turned out I was on a slightly older version of Xdebug (php_xdebug-2.2.0-5.4-vc9.dll).
I replaced that file with "php_xdebug-2.2.2-5.4-vc9.dll" and it magically started working immediately.
I'm on wamp, and I updated both php.ini files (one is for cli, one for normal use) with the latest filename.
"zend_extension = c:\wamp\bin\php\php5.4.3\ext\php_xdebug-2.2.2-5.4-vc9.dll"
Then dropped the new file into the php ext folder and instant success.
I had the same issue on Windows 7 (Home premium). I had a hunch that it is caused by one of the extensions I installed so I started commenting them out one-by-one.
Turned out it was caused by a non-compatible mongodb extension I was using
Edit php.ini and comment zend_extension=opcache.enable_cli=1 (with ; in front of it)
Try to use another php version instead.
It works perfectly for me.
Try to run scripts with php-cgi.exe instead of php.exe. For me it works.

php shell_exec() through cygwin

I wrote a script that compiles LaTeX code through pdftex. The trouble is that pdftex only runs on linux.
I am accomplishing this task with the use of shell_exec().
I don’t really have the ability to set up a linux box as a web server. I have my client computer, but it is behind a firewall that I do not control. I do have control of my work server which is running SBS 2003 with a Windows 2000 virtual machine running apache and php. To my knowledge, you can’t install pdftex in Windows, and if you could it wouldn’t work with shell_exec().
Is there way to work around this with cygwin? I could install pdftex in cygwin, and then configure php to run shell_exec() commands inside of cygwin. If this is possible, could somebody point me in the right direction?
Also, I wonder if there is another course of action. I wouldn’t mind buying hosting, but any shared hosting plan isn’t going to support the app. It would have to be a virtual or dedicated hosting plan; something I can’t afford.
For anyone who is wondering about running shell_exec() through Cygwin, check out this link to a comment in the PHP manual:
http://us.php.net/manual/en/function.shell-exec.php#68647
$result = shell_exec("C:\cygwin\bin\bash.exe --login -c '/cygdrive/c/cygwin/bin/convert.exe --version'");
The key is the "--login" option which appends all the required common
cygwin binary and library paths to $PATH. Without this option some of
the cygwin binaries that links to other libraries ( Like ImageMagick
binaries which links to X11 ) will not work and you may see errors
like "cygX11-6.dll not found, Could not start convert.exe"
pdfTeX runs just fine on Windows, without requiring Cygwin. Try MiKTeX.

Categories