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.
Related
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 last month.
The community reviewed whether to reopen this question last month and left it closed:
Original close reason(s) were not resolved
Improve this question
I have a program that is written in PHP. The current version is 7.4 and everything works great.
Today I have upgraded the PHP version in composer.json to 8.2, and everything still worked. Now the question. Is my software now really on the latest version of PHP, or do I still need to do something?
Is it necessary to update the code too? Enums are new for example.
Earlier the enum looked like this in my code:
use Elao\Enum\SimpleChoiceEnum;
final class LogReason extends SimpleChoiceEnum
{
public const NEW_REGISTRATION = 'NEW_REGISTRATION';
}
So is it necessary to update that? Or is that OK as long as it works?
Updating the PHP version number in composer.json only tells composer which version of PHP your project should use. It uses it to decide which packages are compatible with your application.
E.g. if you have "php": "8.2" then it will only install versions of packages that are compatible with PHP 8.2.
It'll also prevent you from running composer install etc in an environment with the wrong version of PHP installed.
To actually upgrade your PHP version you are using, you'll need to install it in the environment your application is running in (on your server, VM, Docker container, XAMPP, MAMP, local OS, WSL or whatever).
To be sure that your software is now running with php8.2, you can check it by calling the phpinfo() function.
BUT you need to be sure that all of your code is still working. To do this, you can run the testsuite of your application if provided.
I suggest you to read the backward incompatible changes and check that the code isn't using it. And you have to do it three times, one time per version (8.0, 8.1, 8.2) You should do it for the deprecated features, so migrations for PHP9 will be easier.
A you have upgraded composer.json, a lot of libraries have upgraded too. So, some manual tests could be a good idea in dev then qualification environment.
About the enum type, it isn't necessary to upgrade your code (but a good idea for maintainability).
When we talk about "versions of PHP", what we generally mean is "versions of the software that executes your PHP scripts". (Theoretically, we could mean "the version of the language specification that that software implements", but PHP has no external language standard, so the software essentially is the specification.)
As an analogy, imagine you buy a new computer, and plug in your existing keyboard. There are three things you might want to check:
Have you definitely plugged it into the right computer? You can look at the wires, or you can open Notepad and start typing something.
Does it work fully with the new computer? Maybe it has special macro keys that open your favourite software, or perform a special move in your favourite game. You can test that those still do what you expect; or you can look at the instruction manual for what needs setting up on the new system.
Are there new features you can use that you couldn't before? Maybe the macro keys can do extra things now; but if you don't make use of that, it doesn't mean you're not using your new computer.
For a PHP upgrade, you can ask the same three questions:
Are you definitely running with that version of the software? You can look at the system settings, or you can ask PHP directly using functions like phpinfo, phpversion.
Is your program working correctly on the new version? Ideally, you'd have a nice suite of automated tests; more realistically, you can manually test functionality, keeping an eye on your error logs; you can also look up the migration guides in the PHP manual to see what you might need to change. Pay particular attention to the 7.4 to 8.0 migration since that is where the majority of "breaking" changes happened.
Are there new features you can use that you couldn't before? This is where enums come in - you can now use them if you want, but not using them doesn't mean you're not using PHP 8.2. Having a new way to do something doesn't mean the old way will immediately, or ever, stop working.
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.
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.
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
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