Use mac terminal to write PHP (save files) [closed] - php

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
I recently bought a macbook air, and I'm trying to program using the terminal instead of an ftp client + text editor.
I know how to SSH in, and from there run PHP (php -a), but I can't quite figure out an overheadless way to create, write, and save a file in PHP. Any help would be perfect

I wouldn't recommend programming using a simple text editor in a terminal. The best thing you could do is use an IDE such as Zend Studio, Eclipse PDT or NetBeans. There are many out there. IDEs give you syntax highlighting, code completion, etc and those are just some of the basic features. One feature I love about Zend Studio - even though I haven't used it much - is Remote Server connections. It allows you to connect directly to a remote server and edit the files right in Zend Studio!
Why should I use an IDE?
Don't use FTP+text editor. Just use FTP to download your files (if that's the only way you can download them) and save the entire project into a folder and use an IDE to edit and save your files.
As many other people stated, you can use vim or nano in the terminal. I prefer vim and it does come installed with OS X so you don't have to install anything.
$ vim filename.php
Then while in vim, if you want to make changes your simply press the i key on your keyboard. That changes vim to "insert" mode. After making changes in "insert" mode, press ESC and then the colon key ( : ). Now you are ready to write your changes. Press the w key to write and q to quit and lastly press enter. That's pretty much your most basic stuff for vim.

You want a terminal based text editor. Two popular ones are vim and Emacs, but they have a bit of a steep learning curve. A more basic one is nano.
On most *nix machines, these are all installed by default. Try the command
vim filename.php
This should open the filename.php with the vim editor.

OSX (and several Linuxes) come with nano (in /usr/bin/nano). It's a basic (non-arcane) text editor. If you aren't familiar with vim or emacs, I recommend nano, since it's usable by mere mortals.
$ nano file.php
It comes with instructions along the bottom saying how to use it. For example ^X Exit means hit Ctrl+X to exit (and it will ask if you want to save at that point).
It also has a variety of useful features like syntax highlighting and auto-indentation if you're into that sort of thing. These can be set in the config file (which is stored in your home directory as .nanorc).

Mac OS comes with vim under /usr/bin/vim and therefore can be used to do all of the functions you require when handling PHP files.
Here's a reference guide to get started:
Reference: http://linux.die.net/Intro-Linux/sect_06_02.html
You can get started like so:
$ vim foo.php

Related

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.

Any working php debugger, PDT? [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 9 years ago.
Improve this question
Honestly, I am tired of searching and trying various php debuggers and IDEs from netbeans to jetbrains PHP storm, Eclipse indigo, WAMP, (old zend server community edition) etc!
I need a working set of IEDs and debuggers so I can start developing my work!( I by the way want to develop php scripts in Windows)
Problems:
php storm: weird IDE]
PHP Tools for Visual Studio: it says it is free, but you can try it for free for 30 days
PDT Eclipse: too old, no updates, broken links. Working with Zend itself is creepy
Netbeans 7.3, still not easy to work with. So many settings Xdebug not working
I need something like PHP development tools for Eclipse Juno, any suggestions?
What combinations of IDE(netbeans, phpstorm, Eclipse, Visual stodio) + (Zned server, XDebug) do you guys use? I am really tired of this product not being compatible with one another.
I would really give PhpStorm another try. True, it takes a bit of time to get used to, but it offers a lot of features that are hard to find in other IDEs
Regarding debugging and testing, read these walk-throughs on debugging:
http://confluence.jetbrains.com/display/PhpStorm/Zero-configuration+Web+Application+Debugging+with+Xdebug+and+PhpStorm
And unit testing:
http://confluence.jetbrains.com/display/PhpStorm/PHPUnit+Installation+via+Composer+in+PhpStorm
Simple Texteditor
Apart from a proper IDE, I always have a 'regular' text editor 'on the side', for example to have a quick 'scratch' file to write down some notes, or to make minor changes in a file without having to open your entire project.
There are many nice editors, Sublime Text, NotePad++ and UltraEdit are some examples.
Test and development environment
Although using WAMP/XAMP is convenient to set up, it is not the best environment to test your project. Most PHP websites will be hosted on a Linux/Using environment, which is quite different from a Windows environment in many ways, some are:
Linux/Unix file systems are Case Sensitive, whereas Windows is not
Linux/Unix uses a slash / as directory separator, Windows uses backslashes \
Some parts of PHP rely on functionality provided by the operating system. Therefore PHP will produce different results on Windows than on Linux/Unix
Linux/Unix uses a different permission system
If you develop and test your websites on WAMP you will encounter unwelcome surprises when you try to deploy the website on the actual hosting environment. Some problems may not even present themselves instantly, which will even be worse (customer calling in the middle of your Holiday telling you that the 'flush cache' admin-panel flushed not only the cache, but also all uploaded content)
So, in order to properly develop and test your website, your development environment should match the targeted hosting environment as close as possible
Inform with your hosting provider what their environment looks like; What Linux distribution are they using? (CentOS? Ubuntu?) What versions of PHP, Apache, MySQL?
Set up your test environment according to this. Either by setting up a development server and installing Linux on that, or running a Virtual Machine on your workstation, for example VMWare or Parallels Desktop (a virtual machine may save you some time, because many pre-installed, ready to use LAMP disk-images exist)
Client side testing
Preferably, make sure you have some computers or virtual machines with a clean install of your targeted audience (Windows XP, Vista? etc) sometimes a clean install is missing plugins/functionality that you assumed are present, causing problems (no Adobe Reader installed? No Flash? Old version of Windows Media Player?)
If your targeted audience are business users, be sure to test your website in the actual environment. Think of pitfalls like Caching Proxy Servers, Firewalls, multiple IP-addresses, disabled JavaScript and Thin Clients (using Remote Desktop). Sometimes those environments are still using Internet Explorer 7 (even 6) because of company policy.
Dreamweaver is by far the best php writting tool, the color code is amazing and the auto complete features are irreplaceable. The only other program i have seen come close in the field of auto complete is zend and that lagged like no other. plus it has built in ftp AND it makes it pretty easy to move on to javascript (IMO)
As far as server software i personally favorite WAMP, but everyone will have their own preference
you can find dreamweaver(trial) here
Wampp is here (pretty sweet webpage):
For PHP, I'd use Notepad++ all the way due to dynamic typing instead of static.
Notepad++ is quite light-weight and won't be in your way.
What sort of debugging do you need? Heavy unit testing and profiling or just print_r type of debugging? Have you tried http://www.firephp.org/ ? It's an extension to Firebug that works really well with AJAX.
There is no Eclipse juno PDT . The latest one is for indigo and that one crashes from time to time.
I use Dreamweaver and Xampp, and occasionally Notepad+++ and Xampp.
As stated in the thread, Dreamweaver has a great color code system and is very user friendly. I suggest it.
xampp
Notepad
I suggest use of Nusphere php ide , its too great for php, it has auto complete features and in built server and you can debug run time, you can also set browser foo debugging your code , its true php debugger, i am using this debugger since last 3years ,its amazing and it has inbuilt ftp feature so you can also debug your ftp file.
Here is link Nusphere

PHP IDE for Search in remote file without store the files to local [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
Are there any good IDEs which can search for a word or phrase from the remote files without storing/synchroning to my local computer first?
I have tried Aptana, but it doesn't seem to be able to do this but, the remote file system is good(not store to local)
I have tried Netbeans, which seems to alway store files to my local machine first.
I hoping that there are (preferably free) IDEs out there that can run searches for strings on the my remote host?
I see three possible (common) options:
Connect via ssh and use vim. I would do that.
Mount the remote file system via scp (sshfs on Linux) or ftp (curlftpfs on Linux). This will hide file transmission from you but they will be done it background. So it's much the same as let the IDE do the ftp work
Have the IDE (whatever you prefer) running on the remote host and using RemoteDesktop or somewhat else.
I prefer ssh + vim :)
Using ssh may be the most secure and usual approach. The less data intensive will be using FTP with Aptana as you already doing (Expecting that Aptana just transmitts changed files). (Also this may depend on the filesize and circumstances but with usual code files I would say so)
If you are working on Windows expandrive might be an approach. It supports mounting remote servers a local netdrive in Windows via FTP, SSH or SFTP . An IDE would see that folder like a local folder. You should give it a try.
Update: Trying to explain more....
If you want to search in a remote file, you have two general options:
The search program runs locally and will need input data from remote (the file)
The serach program runs remotely. You'll send arguments to it, and it will send back the search results
No further options.
In IDE speaks it means: Either you use the search functionality of your IDE itself, means the search program (IDE) runs locally, then the file has to be downloaded / sychnronized / netmounted whatever. Or you execute grep or whatever remotely and display the results. Then it mostly comes to ssh. Your IDE will need a ssh plugin for that. Eclipse for example has one. (Think to remember the name was RSE. Remote Systems Explorer) (It will work with Aptana too) .

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

PHP compiler for windows [closed]

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