i'd like to install wkhtmltopdf on my xampp system and use it under php.
any ideas how to do it - is there any tutorial? :/
i've run the wkhtmltox-0.10.0_rc2-installer.exe but it seems like it didn't change anything on my local xampp system.
thanks
The installer extracts the executable under C:\Program Files\wkhtmltopdf\ per default - or whatever you specified.
To use it from within PHP just supply the absolute path:
exec("c:/programs/wkhtmltopdf/wkhtmltopdf.exe www.site.com pdf.pdf");
Or move the .exe where it's easier accessible. (Should you care about making things simpler.)
Related
i'm trying to set the certain path for the php extension in my vscode (using linux)
i started installing the XAMPP
and after it..i tried to use the extension writing some php scripts(php extension INTELLISENSE and DEBUG), but the extension is not working properly and it's showing that error:
Cannot validate since /usr/bin/php is not a valid php executable. Use the setting 'php.validate.executablePath' to configure the PHP executable.
i tried to set it using que path which is provided by vscode documentation, but it's still no working.
Can anyone help me !! please!!!
I found a solution, typing in terminal
'whereis php'
that returns the absolute path for set it in the vscode extension
/opt/lampp/bin/php
Then, setting the path in the follow line
php.validate.executablePath: "/opt/lampp/bin/php",
So, I hope this solution is helping someone behind the screen.
Php path in windows
Typing in terminal
where php
And it'll gives the path as (in my case)
C:\xampp\php\php.exe
Just extending the answer by #Reinaldo Duguet with a ton of thanks to him !
If you are using Xampp, the PHP path can be found by running the local server and then typing localhost in the browser. This will open the Xampp dashboard. Click on phpinfo() and there you will get the exact path shown as
Configuration File (php.ini) Path = /opt/lampp/etc
Please note that the path may very as per the PHP installation in your system. So you may have to use the respective path shown with above ways.
Then, to let VSCode know this path, open settings in VSCode and search for "PHP debug" and click on the PHP > Debug:Executable Path setting
Add the following line at the first place after "{" telling VSCode where PHP is installed in the system.
"php.validate.executablePath": "/opt/lampp/etc",
If you are using Xampp, the PHP path can be found by running the local server and then typing
the correct version C:/xampp/php/php.exe
XAMPP isn't the best option for linux and i wouldn't recommend it.
Assuming this is not the problem, here is how to do :
find php executable
whereis php
Check your vscode installation. You want to make sure it's not using flatpak (it runs in a container and it would mess up everything)
go in vscode settings, search for php and set "php.debug.executablePath": "/your path/php"
If it still doesn't work, this might be a permission problem. Then :
copy the php executable in your user folder
sudo cp original_path/php /your_user_folder/php
add permissions
sudo chmod 777 /your_user_folder/php
If none of above worked, at this point, you may want to use a VM.
I just wanted to add a possibility here that ended up being my issue in case it helps someone else in the future. My issue was that I was using a Debian based distro and installed VSCode through the software app which relies on Snap apparently. Snap runs the programs in a sandbox and prevents them from seeing other locations on the computer. My solution was that I uninstalled the shop version and installed VScode manually via downloading directly from the website. After that, everything works as expected.
I'm trying to get my Laravel project to work. But when I use composer update it says the following:
This package requires php >=5.6.4 but your PHP version (5.5.12) does not satisfy that requirement.
I'm using WAMP which runs php version 7.0.4 this is also confirmed in the browser if I echo the php version. But when I use php -v in the console it shows that I'm using PHP version 5.5.12 (cli).
I've searched a bit around on google and I found out that it uses my windows PHP version instead of my webserver's version. But I couldn't find out how to update my PHP version on Windows.
My PATH contents are as shown in the following image
You can uninstall composer, and while re-installing it will ask you to point at your PHP directory which is going to be C:\wamp64\bin\php (usually) at that point you can choose which PHP version you would want to use. good luck.
This means you have yet another installation of PHP in your system. Check your Programs in Control Panel and remove such installation.
However, you can modify your PATH environment variable as well. Procedure
Just remove the path that points to any PHP installation directory.
Else, otherwise, if you are unsure about changing the PATH variable (which can lead to serious problems if not set well), you can just delete the directory that the PATH variable points to.... (I mean the PHP directory)
The totally better solution is to add the path of your PHP7 bin directory at the beginning of the PATH variable. You should also make available composer in this PHP7 bin directory.
Such as, replace the C:\php in your path with C:\wamp\bin\php7 or whatever the location of the PHP7 path is..
To update PHP on Windows 10.
You must put the folder of the new PHP version in the same folder as the old.
You rename the old folder or you delete it, prefer rename the old folder,
now you write in a terminal console
php - v
PHP automatically check for a new version
if you had installed before xampp/wampp and composer globally you might had added php to you environment path to call it where ever you want, and now you want that composer use the new xampp with php the you recently installed, so go to system>advance tab> environment variable> maybe in PATH then search if you have something like C:\xampp\php and edit to your new php location.
I had multiple versions off xampp for testing and composer globaly instaled for php 7.2
I am installing composer for laravel installation.but when it want php.exe file i coudn't find it in c:/xampp/php folder.I set up my path variable c:/xampp/php but it is still not working.help me guys.
If xampp has correctly installed, but you are failing to run PHP it is more than possible that you don't have PHP set in your environment paths.
To set this go to;
Start > right click computer > properties > Advanced system settings > Environment Variables.
Under System variables find a variable named PATH, highlight then click Edit... Append the absolute path to your root PHP folder, this could either be xampps located in.
c:/xampp/php/
Press Ok, once you've finished; close down any command prompt windows you may have open. Re-open command prompt and run php -v. Hopefully at this point PHP has responded with it's version and license information.
Make sure you have xampp properly installed.
If you add c:/xampp/php to your PATH while you have a console open, you need to open another console, in order for the PATH to be updated.
i think I have that problem one day, i solved uninstalling xampp server and reinstalling it, but when xampp ask you wich folder to install you need to create a new folder:
C://new folder/xampp/.......
If you install/uninstall multiples xampp or wampp versions for some reasons create storage info in the xampp folder, so creating a new folder solve the problem.
You can use this path:
c:/xampp/php/php.exe
PATH should be a directory, not a file, so you should set it to "c:\xampp\php\", other than"c:\xampp\php\php.exe"
I am running on a Windows machine. I installed WT-NMP and I am trying to install composer.phar. No matter from what folder I run this
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
it always installs in the /bin/php-5.5.8/ instead of the /www/project folder where I want it. Because of this, whenever I try to run
composer update
I receive an error that it can't find the composer.json file (because the json file is in www/project but it is searching for it in /bin/php-5.5.8 instead). I tried everything that I could think of but I can't get it to work.
Any help is appreciated. Thanks!
You could try to find out the reason why it does what you don't like, but the installer script essentially only checks some settings of the PHP used before downloading the .phar file because debugging things inside the .phar is problematic, i.e. it would be a support nightmare if you'd simply download the pure .phar and try to run it if your PHP is unable to do so.
Long story short: You can simply copy or move the downloaded composer.phar to any location you like, and it will work.
you only need to specify where you want to install composer by changing PHP`s current working directory with chdir:
C:\WT-NMP\bin\php.bat -r "chdir('C:/WT-NMP/WWW'); eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
an odd solution to an odd installation method ;)
I have a web accessible PHP script that is using a shell command to drop PDFs to text. I installed Poppler, and am using pdftotext, via MacPorts. I am able to run the command successfully from the CL, and when supplying the full path within the PHP script to '/opt/local/bin/pdftotext'. So, I know that my $PATH is correct and the permissions are sufficient, yet I am still getting an exit status of 127: Command Not Found, when attempting to do simply 'pdftotext' in the exec().
I have tried the answers from How do I add paths to the Apache PATH variable? and http://lists.apple.com/archives/macos-x-server/2008/Sep/msg00433.html. I modified both the /etc/paths and /etc/profile, and added /etc/paths.d/macports all pointing to '/opt/local/bin'. setenv, apache_setenv, etc all had no effect also.
I am using a MAMP (1.9 I think) install for my local development, OSX 10.6, PHP 5.3.5, all a little behind I know :-) ... my $PATH is modified to point to the MAMP bin/php
/etc/paths.d/macports will influence on PATH variable for macports, not for the Apache. You probably need to add /etc/parhs.d/apache (or else) to do what you need.
Edit: also check this and this threads for solutions. It is somewhat outdated but still can help.