How to self host and run a Php file [closed] - php

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I found a tutorial on-line that describes how to build an image uploader.
The author has his script available here:
http://simplifiedcoding.16mb.com/PhotoUpload/upload.php
I don't have a web site.
I would like to try the tutorial. How do I try/test the Php files on my own computer?

The tutorial you link to seems to require MySQL and PHP 5. You can easily run both of those on you local machine and I recommend that you do so by downloading and runnning the XAMPP installer for PHP 5 (not PHP 7):
https://www.apachefriends.org/download.html
When you run the setup make sure that the following are included:
Apache - the web server
PHP - the (main) scripting language of the tutorial
MySQL - the database
phpMyAdmin - an administration tool for the database (nice to have and if you can get it to work you have everything you need up and running)
If you need more visual help than that, I recommend that you search for instruction videos using the words xampp, phpmyadmin and [your operating system]. Here is an example for Windos 10:
How to Install XAMPP to your PC(OS: Windows 10)

You start by understanding the setup.
From the question I assume you use Windows and you installed WAMP or XAMPP (don't ask how I know).
go the folder where WAMP/XAMPP was installed. Usually under program files folder
Look for a www or htdocs or html folder.
In that folder create a file called 1.php
in it put <?php phpinfo();
Turn on the WAMP/XAMPP server (when u installed it u also installed a short cut to it's controll panel)
surf to localhost/1.php or 172.0.0.1/1.php and make sure u see the info about your php installation.

Related

Using PHP Printer functions in PHP Desktop application [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
In XAMPP environment
I develop and test my PHP code in XAMPP environment (local) and it success.
In PHP Desktop environment
I already copied the php_printer.dll into the ext folder and include this line extension=php_printer.dll in the php.ini file.
I also moved my folder from htdocs (XAMPP environment) to the www folder (PHP Desktop environment) but when I run the phpdesktop-chrome.exe it shows ...undefined function printer_list()... so I knew that it cannot recognize the library.
My question
How do I configure PHP Desktop to recognize the php_printer.dll as similar to my XAMPP behavior?
Update 1
php_printer.dll failed to load. By the way how do I identify my php_printer.dll version whether it match PHP Desktop or not? Thank you.
Update 2
Okay I have the version as below:
PHP Desktop: phpdesktop-chrome-57.0-rc-php-7.1.3
php_printer.dll: php_printer-php5.6.30
PHP extensions are often intended for specific PHP versions (eg. 5.12.xx and Thread-safe or non-thread-safe). If your extension doesn't match specific php version it won't work. In such case you should see a startup error if you enable it in php.ini.
For detecting problems during PHP startup see:
https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base#problem-running-php-script
https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base#error-500-internal-server-error-cgi-program-sent-malformed-or-too-big-16384-bytes-http-headers
Update
Your extension is for php 5.6.30, so you should download that specific php version, see: https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base#php-interpreter--extensions
Try non-thread-safe version first and then thread-safe version.

Questions about installing php [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'd like to be able to run PHP application on my own windows desktop.
What are my options?
accodring to this reference, I have to install visual studio 2015 to able to do it. Is it the really necessary?
Why do they mention compiling php? it's a scripting language so am I still supposed to pre-compile it before running it?
Is Visual Studio the only editor or there are other suggested IDEs?
Do I have to run it on IIS, can't I install apache server on my desktop and run the php application on it?
The instructions you find on the wiki are for building PHP from source, but you don't have to do that to use PHP on Windows.
You can use one of the WAMP/XAMPP packages mentioned in the comments. That's definitely a quick and convenient way to get it working on your system. But if you really just want to put PHP on your Windows machine without using one of those, it really isn't too hard.
Based on your questions, including:
Why do they mention compiling php?
I think I can safely assume that you don't want to compile PHP. Fortunately, you don't have to.
Just go to the PHP for Windows download page and find the version that will work on your system. The "Which version do I choose?" in the left panel will help you figure out which one you need. These are pretty much ready to use, just extract it where you want it (I usually just do C:\PHP).
You will need to have the appropriate C++ redistributable installed before it will work. There are also links to those on the PHP for Windows page that I linked above. If you chose PHP 7 (why not?) it will be the VC14 version.
After you have installed the C++ redistributable and extracted the PHP zip file you downloaded, add the new PHP directory to your Windows path, and you'll be able to use PHP on the command line. You can test that it's working properly with php -v (displays the installed version) in a cmd window.
To configure your PHP installation, start with one of the provided ini files, either php.ini-development or php.ini-production. Make a copy of the one you want to use and rename it to php.ini.
Of course, this is only PHP. If you want to use it to with Apache or some other web server, you'll need to install that separately and configure it to use your PHP installation. It's not difficult after you have some experience with it, but I remember it being pretty frustrating to get it working the first time. The advantage to using XAMPP or similar is that includes Apache and MySQL with one installer. If you're just starting out, that's definitely the easiest way to get going.
As far as IDEs, there are various ones that support PHP. There are some free ones that are fine, if that matters to you, but all you really need is a good text editor.

How do I convert a php web application into a desktop application and retain database [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
We have a web-application developed in PHP. But most of clients don't have internet connection all the time. So, is there way to convert the app into a desktop application so that it works stand alone and it syncs to web application whenever there is an internet connection? Currently I am testing it locally via xampp and it works but I dont want to have to install xampp or wamp on a clients pc. I am an amateur at coding FYI. I would appreciate any precise answer with example.
A nice and simple way to do that without having to go through XAMPP or LAMP installation making it really simple to your users is to use PHP built-in server as of PHP 5.4.0.
$ cd ~/public_html
$ php -S localhost:8000
You can test this by adding an index.php in the public_html directory and then just run the command $ php -S localhost:8000 inside public_html. Open up your browser and type localhost:8000 so you can see your index.php file.
Another important thing is that your users must have Mysql installed (or whatever DBMS you are currently using).
Source PHP documentation
To avoid installing server on every client pc you can use Virtual Machine, so you would have same environment and just copy to every pc you need.
To keep the source code up to date (when connected) use GIT or other version control system (SVN may be easier to get into).
You have to install mysql or whatever DBMS you are using at backend as well as install XAMPP or any other server to run PHP script. If you dont want to install full XAMPP you can use portable XAMPP which is just copy and paste.
You can right a script which can keep checking after specific intervals, if internet is available then synch database with live server.

How to edit php files locally? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
With HTML files, I can work locally and preview the files in my browser after I've saved and made changes (and use LiveReload), but with PHP the browser just loads the code. Do I need to run a local server to work on it locally, or is there an easier way?
The extent of my PHP is using include statements for headers and footers.
Yes you will need a local server to run PHP scripts locally. Check out MAMP for Mac or XAMPP for PC.
Yes, you'll need to install something such as WAMP
No - since php is a serverside interpreted language you have to run a server. The easiest way is to install xampp whick brings everything you need - apache, mysql, php.
On windows you could also install IIS server which is part of windows
You can very easily download and set up a server - and on that note, yes do do need to have PHP and Apache set up to have PHP working.
I would probably suggest something like WAMP - it is basically pre-setup and requires very little config to get up and running. This will come with Apache Server, MySQL and PHP set up nicely to work together and comes with a very easy to use point and click interface. Oh, and it even installs PHPMyAdmin so that you can easily work with your databases if you are not familiar with console controls.
You need to set up a server that can serve php requests appropriately. However, this is incredibly easy to do. Just google how to install a LAMP server (on Linux), or look into WAMP (on windows). If this is still too much for you, look into purchasing a shared hosting account or something. I have a small one for like $15 a year. They will have the servers set up with everything you need already; you'll just have to upload the files.
Yes, you need to run a local server to 'work with it'. I would suggest XAMPP. To actually edit the files, you of course need a text editor. Any editor will do as far as I'm aware, but I use Notepad++ myself, or even the NetBeans IDE.

A Windows Based PHP Compiler? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have a command line php app that I need to distribute to a client. I just want to give them an executable, not instructions for installing php ;)
What is a good php compiler for windows that includes support for php 5, curl, TLS, and a few other libs I use?
I need to control memory and time limit usage, so I must be able to use a custom php.ini. (this should be packaged in the exe as well, not a separate file)
Additionally, I don't want the code to be easily extracted. This isn't a huge requirement, but I'd rather not have the source viewable in a hex editor.
I've got a few hits on Google, but if anyone has actually used one, your feedback would be invaluable.
edit
If I knew I was going to distribute this to the client when i started, I'd have used C#. But I didn't. Now they want to buy it. It needs to be DEAD SIMPLE. one executable containing the php interpreter and my script plus an entry point to start my script when the exe is run.
It would also be great if I didn't have to redistribute dll's either.
edit2
I am look for somthing along the lines of phc, or roadsend. phc doesn't support windows, and roadsend doesn't support php5 in windows.
Okay I figured it out. there is a open source program called phc-win. It supports php 5.3.1, compiles scripts to byte code (obfuscation!) and is simple to use (It even has a gui).
It needs a php-embed.ini and whatever DLL's you use, but it just works.
Thanks for all the answers everyone!
phc-win 0.3.1 (c) 2009 Andrew
Fitzgerald -
contact#swiftlytilting.com PHP
Version: 5.3.1
To compile a single file:
Choose 'Compile single file' from the File menu.
Then select the file to compile.
To build an EXE containing all files in a directory and all sub
directories:
Choose 'Compile directory' from the File menu.
Select the project folder.
Select the main program file.
phc-win will then recursively scan the specificed directory.
All files with 'php' anywhere in the extension will be compiled into
.phb files.
These .phb files, along with all files in the directory tree will be
added to the project EXE.
Once the EXE has been created, you will be asked about the EXE type:
CONSOLE (displays DOS box)
WINDOWS (no DOS box).
Place the EXE in the same directory with the required DLL file(s) and
php-embed.ini file if needed.
You want this: Bamcompile
http://www.bambalam.se/bamcompile/
You can use the WApache, too:
http://wapache.sourceforge.net/
And, if none of these options satisfy you:
http://www.zzee.com/phpexe/
If you want to run php scripts as Windows executable, the best is Wapache http://sourceforge.net/projects/wapache/ and if you want to protect your code try ZZEE

Categories