I recently created a PHP server on an Amazon EC2 Linux AMI instance and I am struggling to figure out how do to upload the PHP code to in order to be displayed on the browser from a .php file type setting.
The only option that was availiable to me to write PHP code and have it displayed was through creating a script directly from the Linux Terminal using the following commands
>SamplePage.php #this creates the php file
nano SamplePage.php #this opens the editor to start writing the code in the terminal.
However is there a visual interface that I could use to upload php code files/documents/pictures. So that I can click and drag the .php file on to the server without typing it on the terminal?
Does the phpMyAdmin do that? Or is is only for used managing MySQL (database) tasks and not for uploading PHP files/graphs/pictures needed to develop a fully integrated site?
By the way, here are the instructions I used to create the LAMP server with PHP as well as MySQL.
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html
phpMyAdmin is a web-interface for managing databases.
You could check if there is already some ftp-server installed. Like vsfpt (just an example, there are a lot more free & open source ftp-servers available). if you encounter any problems with that a good place to ask questions related to hosting and servers is ServerFault
You could also transfer the files via ssh-connection with the help of scp (See: How to copy files from one machine to another using ssh or How to upload local system files to Amazon EC2 using ssh). Another option would be to use a visual ssh-client.
There is also server-management software available that offer a visual file-manager as a website, like plesk, but since you already setup most of the stack this would be hard to do on top of that.
There are many IDEs and Editors that have support for SSH and SCP. Either built in or through plugins. For example: Eclipse, Netbeans, Atom and VSCode. All of which are free and can be configured to support PHP development.
Related
My Setup: Ubuntu 20 with PHP and Composer
My Editor: VSCode with SSH FS extension to access remote workspace.
My Task: do some PHP stuff, mainly Wordpress Themes
My Problem: no PHP Formatter extension works on the remote Workspace
I tried to use: PHP-CS-fixer, Prettier with PHP plugin, phpfmt, phpcs, PHP Formatter...
Some of them will even not work on my local Workspace.
I can't install new Code on the remote Server (Composer), so i need a way to format PHP files just out of the Box like HTML or JS.
But meanwhile i think, this is not possible.
Solution: use Ubuntu to connect to the server and mount that folder in workspace, let VSC think it is a real local folder :-)
The problem with most formatting extensions is that they expect the files to be on a local drive, as in being mounted outside VS Code, including network shares by any NodeJS program (and therefore VS Code extensions). The extension uses the extension API's FileSystemProvider to provide FS access to VS Code. It is only recently that they added a way for one extension to use file systems provided by other extensions, and it's even more recent that they started pushing extensions to make use of this.
Sadly enough, not every extension developer might start using it, and it's especially tricky for extension that use native/external programs. That includes most language-servers and formatters.
For your use case, there are two solutions though:
Mount the folder on the OS level (e.g. sshfs) and just open it as a regular directory in VS Code, as another answer suggested
Use VS Code's Remote SSH, which actually runs the extensions on the server, therefore skipping the whole "files aren't on a local drive" problem
I am currently working alongside a project team for the development of a website and we are using SmartFtp for file sharing.
Does anyone know how to compile/edit php files through SmartFtp? I.e. using apache for compiling and atom for editing.
Please note: I have already tried copying the files into the htdocs folder within xampp but had no luck. The php files did not successfully copy into the htdocs folder.
Thanks again
Fair warning...
This is a terrible way to host a project. Each developer should have their own isolated project installation. Even though you only have a few developers, it's only a matter of time before you get a collision and somebody loses work.
Using FTP is also a terrible idea. It is completely insecure.
That said, you've got a couple options:
If your dev server is a *nix flavor, you can probably use SSHFS to mount the remote directory on your local machine. This will allow you to edit the remote files live, as if they were any other regular local file. This is secure and relatively easy to set up, but you may find it a bit too slow for anything but small projects.
Use FTPS/SFTP/SCP to push files to the remote server when you save them locally. I'm not terribly familiar with Atom, but many IDEs (like NetBeans and PHPStorm) can be configured to automatically FTPS/SFTP/SCP push changed files to remote servers. Just save locally as you normally would, and in the background, the IDE will perform an FTPS/SFTP/SCP push. Do not use FTP. If your server has FTP configured, it probably also has SFTP and/or FTPS configured.
Create your own development environment. Host your own site on your own machine so that you don't collide. You can run Apache/Nginx/PHP/MySQL directly on your machine, in a virtual box, or even a docker container. This is the best and most flexible option, but also requires the most effort to get running.
This should be a comment, but its a bit long.
I am really confused by your question.
how to compile/edit php files
PHP uses a run-time compiler. Are you talking about Roadsend or HipHop or something else?
development of a website and we are using SmartFtp for file sharing
Presumably you don't give a damn about your code integrity, managing conflicting code changes, version control or the security of your development environment. It's 2017. FTP was way past its sell-by date before the turn of the millenium.
compile/edit php files through SmartFtp
It's an FTP client. Just one of many things you don't use to compile or edit files (others include an avacado, a tennis shoe, scissors, a sunset...).
Presumably you are using this client to connect to a server - which you've told us nothing about. You probably want to do the collaborative bit of your code management (if that is what you are asking) on the server.
(from comments)
Development sever with multiple people pushing edits ad hoc while they code through an Ftp server.
That's not a "development server" that's a recipe for code armageddon.
I come from a .NET visual studio background and am learning PHP (with CakePHP) using NetBeans.
In visual studio there is a publish option that allows you to publish your application via file system tranfer (essentially just spits out the application in the form that is needed for it to run on a webserver). Is there anything similar in netbeans?
I do all my dev work on the built in PHP webserver, and would like this file system transfer option so I can just copy and paste the files wherever I want to.
I can't just copy the files from my working directory as it contains all the version control meta-data.
I am aware of the FTP and the remote server upload option, but I was hoping for the simpler approach as above.
Maybe the "visual studio approach" as above is not suited for a PHP environment, in that case I could use some pointers/tips!
Heres how to deploy to a remote server using NetBeans https://netbeans.org/kb/docs/php/remote-hosting-and-ftp-account.html
I am using OpenGeo package on windows to develop a web mapping application with sdk suite. I would like to create a submit form dialog box with a php script, which saves the data to the database. However, the problem is that it doesn't read 'submit.php' by Jetty server. When I check in firefox, the response shows the whole script only as belown. First, I tested with echo to return true. The created application was debugging on localhost at port 9080 while actual one is localhost:8060 which hosts Opengeo.
I have tried with Php/Java bridge also, however, it is still the same. It works on local host at port 8060/JavaBridge/ and shows the examples. I would really appreciate if you could suggest a way to configure Jetty with php in Opengeo package.
Cheers,
Zar Chi
We finally solved the problem by working with Ubuntu 12.04LTS and we wanted to share the solution in case is useful for someone else.
1- We installed opengeo following this process: link://suite.opengeo.org/docs/latest/installation/ubuntu/install.html
2-Then we found this blog: http://www.thomasknierim.com/140/java/
3- And we installed the apache using the fcgi option applying the configuration suggested in these files:
a) link: 2bits.com/articles/apache-fcgid-acceptable-performance-and-better-resource-utilization.html. It was also similar in these other blogs so I went ahead.
b) link: howtoforge.com/using-php5-fpm-with-apache2-on-ubuntu-12.04-lts
c) link: versatilewebsolutions.com/blog/2012/11/installing-apache-2-with-php-fastcgi-on-ubuntu-12-10.html
4- We followed the instructions here (link: /php-java-bridge.sourceforge.net/pjb/download.php):
Use a graphical packet installer to install PHP. Or download JavaBridge.war, which contains an embedded PHP binary. (I suggest you try again with PHP standalone directly, NOT with JavaBridge.war file)
Download and install Java 6 or above. (/usr/lib/jvm/java-6-openjdk)
Download and install the original tomcat servlet engine. (/var/lib/tomcat6)
There must be JavaBridge.jar, php-servlet.jar and php-script.jar files in your /usr/share/tomcat6/lib
Double-check again /var/lib/tomcat6/conf/web.xml
Retart Tomcat server and check it is working now?
5- If not, the problem could be related with the permissions of the jar.libraries. There should be accessed by tomcat6:tomcat6. Every deployment called these libraries to automatically create a Java folder which contains Java.inc and JavaProxy.php.
I'm a real klutz when it comes to Eclipse, but I'm also poor, which is why it is the option I've chosen.
I've installed Eclipse 3.5, Eclipse for PHP, and RSE. I've actually gotten to a point where I can create a new (local) project and download all files to my local (Windows) computer. I'm not running any kind of web server on my local box, and am hoping to keep it that way for now.
I've imported my remote folder into my local project, where I can see all my PHP files and edit them. But of course, when I save, it just saves the local copy. Is there no "put" command? Can I not save straight to the server? Or perform an immediate sync of that one file? I certainly wouldn't want to have to perform a complex sync operation after every little incremental change.
I have no idea what RSE really is, nor how it works, and the documentation is, well, cloaked at best, non-existent at worst. Does anyone have some tips for me? What should my workflow be (barring any local server to test)?
Ideally, I would love to be able to open up the entire "project" directly from its location on the remote server and avoid dealing with a "local" copy altogether. Failing that, I would be willing to "get" the entire remote site once, and then manually "put" individual files that I change locally back, provided it's not a cumbersome process. Am I asking too much? Dreamweaver operates this way, but it's support for PHP is limited at best and can't be considered a full-fledged IDE...
I use WinSCP and enable remote synchronization.
Everything that changes on the local system is automatically synchronized trough SCP/FTP onto the server.
Looks like RSE might be overkill for your needs. Here's a similar question and popular answer to your problem of uploading from Eclipse:
How do I add FTP support to Eclipse?
Secondly, you could try out a version control system like SVN - it would take a little bit of time and work to set it up but probably be far more useful than getting RSE going and then you could develop locally, commit your changes to the server and then update the workspace on the server.
Thirdly, there are other IDEs out there, like Netbeans, with built in support for working on remote files.
Sorry to drag up an old topic but Remote System Explorer is exactly what you need. No need for sFTP or a Shell. Setup the connection in the RSE perspective just like you normally would using your sFTP/SSH client.
Open the folder for the first time and you get the login dialog. Enter your credentials. Store them as needed.
Now navigate to your development files and double click or right click to open the file. Eclipse caches a local copy till you save, Ctrl-S.
Need to do some shell work. Right click on a folder and Launch a Terminal. If your files are source controlled, such as svn, you can checkout or update from the terminal.
I use to have Putty, FileZilla and a host of other editors and utilities. Now I never leave Eclipse. SQL, Shell, sFTP, PHP, CSS/HTML, C/C++, Droid, all within Eclipse.
I tackled the same problem recently. I got a web site hosting company and was using SeaMonkey and developing the code on the 'production server' and learned to do development on a 'development server' and then upload the debugged, working stuff to the production server.
So I use Xampp (it's a good, and FREE, local web server you can easily install on your laptop) and I use NetBeans to develop. Netbeans is better than Microsoft tools -- no ballmer involved in the deal.
xampp uses Apache as the (local) web server and provides Mysql and PHP server-side-scripting support.
The quality of these two is HIGH. Just excellent stuff. You will want to get a local web server running on your laptop, do your development locally, then upload using ftp or the Netbeans environment, the files to your 'production web server.'
I messed around with a lot of different unrelated pieces trying to put a local web server, debugger, mysql database together and then got really lucky and found xampp and then NetBeans.
I think #Ćukasz's note deserves to be an answer on this page - it would have saved me a great deal of time, so hopefully it will do the same for others:
Here is great tutorial for Eclipse: How to setup Eclipse with PHP PDT, Remote System Explorer, Theme Manager, and Drupal Plugins Eclipse + PDT + Remote System Explorer allows you to develop PHP applications remotely.
I will add that downloading and using the smaller Eclipse for PHP Developers and thus skipping step 2 on the blog works just fine.