Where is pdftk file location folder? - php

I have installed pdftk on my PC that I use for local development using XAMP. I have installed pdftk to my local directory. From the code bellow where should the file test.pdf be placed? I am getting fields.txt created in my websites root directory, but if I place text.pdf there I still get a blank fields.txt file generated. If I go into CMD and CD to my websites root directory and execute the code bellow I get the correct results. Any help would be very much appreciated.
exec("pdftk test.pdf dump_data_fields > fields.txt");

Turns out I just had to restart my PC... Should have known. I thought restarting Apache was enough I was very wrong. Everything works great now.

Related

What is it missing/wrong with my new website not showing up?

Here's the steps I took:
1)
2)
3)
For some reason I'm not able to figure out, this is not working. I'm a novice and I'm currently stuck here.
Any help will be much appreciated!
Thank you in advance,
Gabriel
you should consider installing apache webserver and setup the host file in your pc
Apache :
https://knowledgebase.progress.com/articles/Article/How-to-install-Apache-HTTP-Server-on-Windows-Server
Set Hosts file in win :
https://docs.serverpress.com/article/176-windows-10-and-localhost-is-blank
Create a new folder and then go to it in cmd using cd command. And move the file into it.
Then start the php server again and acces it using this link:
localhost:4000/site.php
Or install apache server as #mshahien said.
You can use xampp.
You are running php -S in the wrong directory.
The www directory is inside a directory called php somewhere inside your One Drive directory, but you are running php -S from a directory called i346241.
The server started by php -S takes the current directory to be the root of the development server.

php functions file_exits, copy, shell_exec not working on one machine but same code working on different machine

I am a Centos 7 machine on which I have configured PHP with Apache and Slim Framework.
The simple code to check if the file exists and copy the code into a directory is working fine on one of the machine but not working on another machine. Its really weird.
Actually I am accessing the API through Apache to trigger this function.
Functions like shell_exec alaways return 0
copy function is also not workingg
file_exists also not working.
Any help or clue why this is wrong or debug this issue.
Thanks all for the help.
Problem was file permission issue.
The reason was all of the above function I was performing was on the file. Since the files has different permission for different user.
So If I hit the URL from browser it was through "Apache" user which does not have execute permission on the folder to access the file and read permission on the file.
In short
sudo chmod +rx file
sudo chmod +x "All the directory structure"

PHP code in localhost not working in server - with phantomjs

I am using a php script from github to capture screenshot of a website. Its working fine in localhost. But not working after uploading the same code to my server (linux hosting). I tried uploading to multiple servers. None of them worked. No error codes are coming.
In the documentation, it says:
Make the bin executable chmod +x /var/www/html/screen/bin/phantomjs,
Make your folder writable
I am not sure what does that mean, so i set file permissions of whole files and folder to 777. Still not working
How did i upload to my server.
I uploaded the whole code to the server. Changed file permissions of all directories and files to 777 using FileZilla. I have attached a screenshot of
it.
I think it is still permissions issue, You need to set the proper permissions using putty.
1. Login using putty
2. Open root directory
3. Set permissions file and folder using this command
===> chmod -R 777 folder name

ERROR: "/app/etc/" must exist for proper tool work magento 1.9

I am trying to install the newly release security patch for magento 1.9. I am working on window system.
and I am getting the following error.
D:\xampp\htdocs\magento>sh PATCH_SUPEE-1533_EE_1.13.x_v1-2015-02-10-08-18-32.sh
ERROR: "/app/etc/" must exist for proper tool work.
I am running command by CMD and SH is working fine too
I tried with Git too. but getting same error
Not working on Linux too
can anyone tell me what is the exact issue and how it could be fixed.
Thanks
Able to make it works on windows machine as well for PATCH_SUPEE-5344_CE_1.8.0.0_v1-2015-02-10-08-10-38.sh.
Problem was: CURRENT_DIR=$PWD_BIN/ (line 60) and the value of $PWD_BIN is defined in same file PWD_BIN=which pwd (line 35) as which doesn't wok on windows so we will need to replace this value.
Open bash
Your current directory should be the root of magento.
Run command 'pwd'
It will give the out path of your current directory: Check screenshot
Copy this path and edit file, on line 67 replace:
CURRENT_DIR=$PWD_BIN/ to CURRENT_DIR=/d/xampp/htdocs/magento/
Run patch with same commnd sh PATCH_SUPEE-5344_CE_1.8.0.0_v1-2015-02-10-08-10-38.sh
Note: Make sure you replace '/d/xampp/htdocs/magento/' with your directory root.
and it will work like a charm!!
Getting rid of the forward slash at the end of line 67 seems to work better for me.
Before: CURRENT_DIR='$PWD_BIN'/
After: CURRENT_DIR='$PWD_BIN'
In SSH, you can change the directory by entering the command, cd /path/to/magento/location/ and then you'll be able to run the bash command to install the patch. If you're not aware of the path, you can run the command, pwd which tells you your current directory. If you're not in the right location, it's looking for app/etc in the wrong location (likely your root folder). So try changing your current directory to the Magento directory and then the error should go away.
I was having the same problem and previous answers didn't work for my situation. The way I was able to fix the issue was to change the directory and then run the bash in SSH.
Run the command, pwd. This will give you your current path.
Change the directory to your Magento directory by running the command, cd /path/to/your/magento/directory/. This should be the path from your current location to the Magento destination.
Now run the bash patch update... bash PATCH_SUPEE-1533_EE_1.13.x_v1-2015-02-10-08-18-32.sh. Now that you're in the right location, the patch update should run smooth!
This error occurs if you are in your root directory for example and not in your Magento root. Go to your Magento folder and run you command again.
This error happens if the folder is not found or don't have enough permissions.
Use the git bash under windows that should work. With a normal CMD it's not working because there are some difference in the path and the normal CMD can't find that path from your patch file.
I have tried above change. But, I need to do some change in that to make it working
I changed it CURRENT_DIR=$PWD_BIN to CURRENT_DIR="/D/wamp/www/magento/"
It was not working without " (quotes)
Hope this will help you.

PHP script fails when called from a browser but not from CLI

This is driving me nuts.
I've reduced my problem to this: I have a simple file 'test.php' that invokes a php file (this is from a bigger application, so in fact we need to execute many php scripts from a main script):
<?php
exec("php /var/www/setActive.php 273 1 2>&1",$arO,$nO);
echo $nO.'|'.implode(',',$arO);
The original path for setActive.php is way longer, I shortened it for this example.
Now, if I try:
[root#stg]# sudo -u apache php test.php
I get:
0|
Great, this means the setActive.php script ran smoothly.
Now, if I try it from a browser or from curl:
[root#stg]#curl http://my.url/path/test.php
This is what I get:
1|Could not open input file: /var/www/setActive.php
I already reviewed all the permissions. Apache user has access to all directories and files.
This was working ok in another server. I reviewed the php.ini files and there is no difference between them.
Maybe is a option that I'm not seeing, or an apache config option. I'm ran out of ideas.
Please help me!
Thanks in advance.
I have Linux, Cent OS. PHP 5.3.23
If permissions etc.. are all ok, possibly the apache config. in your setup has the 'ChrootDir' set:
http://httpd.apache.org/docs/2.2/mod/mpm_common.html#chrootdir
This uses the syscall chroot() and the view for '/' dir for that process starts from this setup dir, and hence everything should be relative to it.

Categories