Run Krpano From PHP in Linux - php

I am creating a PHP web app to run on Linux where user can upload their spherical image and my script will turn it into VR image . I have created one but it runs on Windows and have no clue on how to port it to Linux.
I have downloaded Krpano for Linux from its official site and successfully create a VR image by dragging my image to the droplet.
Now I want to create the VR using PHP, is there any executable file to do this ? In Windows, I would do such " /path/to/krpano.exe /path/to/config /path/to/image.jpg", but when I extract the downloaded file from krpano.com there is no executable file (Or I don't know which one).
Anyone know how to execute krpano using PHP in Linux ? I found this tutorial here
http://krpano.com/forum/wbb/index.php?page=Thread&threadID=1306
but I dont understand how to implement it in my case.
Please help, thank you.

Linux and .exe
On Linux, everything is a file. Extensions, both as a concept, and a tip-off to the OS, don't exist.
On Linux, an extension, like '.exe', doesn't inform the operating system to do anything unique with the file, it only makes the name of the file longer and gives a hint to the user. To really know what a file is, run 'file' on it.
Any file with executable permissions and that passes the kernels checks, can be executed.
Your question
Make sure you follow the installation steps pointed out in the video they provide. Sounds like you have if you're successfully using the droplet.
Windows
/PATH/TO/krpano.exe /path/to/config /path/to/image.jpg
Linux
/PATH/TO/krpanotools makepano -config=templates/vtour-multires.config /path/to/image.jpg
I've not actually tried this, just pieced it together from looking at the exec parameter in the relevent droplet file. If this wasn't the droplet you wanted, open the droplet.desktop file in a text editor, extract the command from exec='...' and replace the above with that, followed by your file.
Hope that helps!

Related

Can't view re-uploaded php web files in my Linux server

I used to have a Windows OS server where i uploaded some old php web files to it. I could then access them, edit them, and view them online via my host name.
After much debating and reasoning, we had to change the OS of the server from Windows to Linux. After the change had been completed, a backup of the server was uploaded to the new Linux installation where all my old files were kept.
I could view these files online as I used to do when the server had windows OS.
The only thing I did encounter was the following:
a) I downloaded my files from the server using putty,
b) I deleted the old copy in my Linux server,
c) I then re-uploaded the same file that used to be in the server without making absolutely no change whatsoever to it, to the exact place where it was,
d) When I try to access it via its web address like I did earlier, it throws an error message saying..."The page isn't working".
I don't know much about Linux and there fore I am stuck. I don't know what the problem is. I can't understand why I can view all the files via their web address if they were placed there from the backup, but when I download them, delete their file from the server and then re-upload the exact same downloaded file to the exact place where it used to work, I get an error message.
Extra info: I connect to this Linux server from a windows OS machine using putty.
I found the problem. Since I migrated from a Windows OS server to a Linux Cent OS server, I didn't know that you had to configure the privileges of each folder in order to be accessed from the web. By default, my uploaded files where tagged by ownership of "user". The server was configured to only display files that were tagged by ownership of "root". The way I solved this was by typing the following command in the terminal.
NOTE: "You have to be in the folder where the file you are going to change ownership is."
sudo chown root:root filename.php
sudo -> Execute in admin mode
chown -> Change ownership of file to...
root:root -> ... root instead of user
filename.php -> the name of my file
Executing this corrected the error. Hope it helps someone else since I coudn't find anything related.

how to run an exe file on windows server from a website thats all?

Hello all please help me with this i have a windows server which i can access with RDP and i can see the whole windows xp i have a exe file in "c" drive there under the folder name exe and i want to run it when i click on a button of a website.
The site is on php and it is on different server i have all the rights of both the server .
I have no idea how to do it.
Like i can run that exe from the server by RDP with command prompt with this parameter like file.exe='test' but i have no idea how to do this from the website please give me anything which can help me out with this .
You can use that:
exec('md c:\temp\\'.$_GET['home_dir']);
take care to command injections

exec() explorer folder not operating

I wrote a PHP script, which is creating some files.
After it finished i want it to open a folder, where the created files stored.
exec("explorer C:\\test");
Unfortunately it isn't open the folder at all.
I check it in cmd as well where it is working.
I also tried this:
shell_exec("explorer C:\\test");
Any hint or advise is greatly appriciated.
This can be done if your localhost is on your computer with windows operating system (I use xampp). Any cmd command will work with exec();
So for your question:
$path = "C:\your path";
exec('start "" "'.$path.'"');
Will open your folder in windows.
Why not use PHP's directory functions?
http://php.net/manual/en/function.dir.php
http://php.net/manual/en/function.readdir.php
I'm guessing that PHP can't open a GUI program, such as explorer, as it may not be able to access the user's display. Just my theory anyway. You could build a folder GUI using PHP and the aforementioned functions.

How to run php files on my computer

Could anyone please tell me how to run a php file locally on my system.
Currently I am using a server to run files.
I know both php & Apache to be installed.
I need to see out put of this program, for example:
<?php
$a=5;
$b=10;
$c=$a+$b;
print $c;
?>
Can you please tell how I can run these files of if I need anything more.
php have a easy way to run a light server:
first cd into php file directory, then
php -S 127.0.0.1:8000
then you can run php
You have to run a web server (e.g. Apache) and browse to your localhost, mostly likely on port 80.
What you really ought to do is install an all-in-one package like XAMPP, it bundles Apache, MySQL PHP, and Perl (if you were so inclined) as well as a few other tools that work with Apache and MySQL - plus it's cross platform (that's what the 'X' in 'XAMPP' stands for).
Once you install XAMPP (and there is an installer, so it shouldn't be hard) open up the control panel for XAMPP and then click the "Start" button next to Apache - note that on applications that require a database, you'll also need to start MySQL (and you'll be able to interface with it through phpMyAdmin). Once you've started Apache, you can browse to http://localhost.
Again, regardless of whether or not you choose XAMPP (which I would recommend), you should just have to start Apache.
In short:
Install WAMP
Put this file to C:\wamp\www\ProjectName\filename.php
Go to browser: http://localhost/ProjectName/filename.php
I just put the content in the question in a file called test.php and ran php test.php.
(In the folder where the test.php is.)
$ php foo.php
15
If you have apache running, put your file in server folder for html files and then call it from web-browser (Like http://localhost/myfile.php ).
Running PHP script directly in browser:
Here are all steps (in short) to run PHP program in XAMPP
Step 1: First of all, open the Apache Friends website, The download and install XAMPP for Windows.
Step 2: Open the XAMPP Program Control Panel and start “Apache Web Server”.
(NB: If your PHP scripts need MySQL database to work, Start “MySQL” service as well)
Step 3: Create a new folder inside “htdocs” folder. For example: “php-project”
Path looks like: C:/xampp/htdocs/php-project/
Step 4: Open any text editor and create a new file and write a simple PHP program then Save it with .php extension as “example.php”.
Path looks like: C:/xampp/htdocs/php-project/example.php
<?php
echo “Hello Level 5 Developers”;
?>
Step 5: Go to the browser and type “localhost/php-project/example.php” in the address bar and press enter then it gets executed.
Step 6: After that, you can see the output of your first PHP program like this:
Hello Level 5 Developers
3 easy steps to run your PHP program is:
The easiest way is to install MAMP!
Do a 2-minute setup of MAMP.
Open the localhost server in your browser at the created port to see your program up and runing!

php move_uploaded_file not working on Windows 7 only

I've got a project that I am setting up file uploads for. The project is in Zend, but I am using PHP's $_FILES array and move_uploaded_file to save the files. This was working perfectly on my Windows Vista computer but won't save the file on Windows 7.
It creates a new folder for every upload no problem, but won't save the file and gives no error message. It is the same exact code as the other computer (grabbed from source control) and both are using PHP 5 with WAMP server. Any ideas why the Windows 7 computer won't save? I even added Full Control to 'Everyone' for the uploads folders.
In Windows 7:
Go to this location -> C:\Windows\Temp
Windows will ask permission- > press go or confirm or yes
then try again to upload files
finish
if your saving the files in the system drive, you might have a problem due to its security.. try to transfer your WAMP and PHP in other local drives. but if you insist to have it in your system file. just try to work around with its security.. Good Luck!
When you create the folder you want to move it to, are you setting the permissions in php? When I switched to windows 7 I had the same problem and setting the permissions solved it for me.
mkdir("/path/to/your/dir", 0777);
I read that chmod is ignore by windows on the php.net > mode reference. I was not able to mkdir on windows 7 by using mkdir /path/to/directory or path\to\directory\. I also tried editing the permissions for the parent (root?) directory I was using for the new folder. No solutions found here, yet. The folder reverts to read-only after unchecking the box on the folder settings though so maybe that is part of it

Categories