how do you run a php file on a chromebook? - php

I've been looking on YouTube and other places, i'm not sure how, this place is filled with smart people so i thought i would ask you guys!

This blog post lists some options:
Termux lets you install a Linux environment and has a PHP distribution (but it is highly restricted and you will probably run into plenty of frustrating limits)
You can enable Developer Mode and then press Ctrl-Alt-T to open a crosh shell, from which you get type shell to get a regular shell and from there either:
Install Linux and dual-boot
Create a chroot environment to develop in
Meanwhile OS 69 introduces Linux for Chromebook which should be an easier way to get a Linux environment.
… but that said, Chromebooks are generally low-powered machines that aren't ideal hardware for doing development work. I'd look at setting up a remote server and doing my dev work over SSH.

You need to install MAMP or XAMPP on your Chromebook. MAMP or XAMPP will turn your Chromebook into a web server capable of reading PHP.
EDITED:
Since you can't run MAMP or XAMPP on your Chromebook, then you should look into using a Cloud solution such as AWS or Google Cloud.

Related

Do I need a Linux machine for back-end web development in PHP?

I do not understand fully how might the operating system have anything to do with something deployed on the web if you are not hosting the site locally.
Also, if I do not have a Linux machine, can I replace it by running WSL on my Windows PC? Or are there some fatal drawbacks that might point to not doing that?
No, you can develop PHP fine in Windows or MacOS.
You will have to install the right tools though like a webserver (Apache, Microsoft IIS, etc).
I good starting point is to use XAMPP.
PHP can be installed and run on Windows and MacOS as well as Linux and others - see https://www.php.net/manual/en/install.php for details.
Having said that, if you're planning to host the live site on a remote webserver which runs Linux, then developing that site on a machine which runs a similar operating system is likely to result in fewer unexpected compatibility issues when you deploy it to the live server. There are ways you can write the code in a cross-platform way (and 90+% of it isn't an issue anyway, there are just a few sticky areas mainly around files and paths etc), but there's always the danger of missing something.
If you prefer to develop mainly on Windows you could mitigate the above by having a virtual machine, or container, or by using WSL (Windows Subsystem for Linux), where you run tests against the site in a comparable environment to its live environment before deploying it to live. There are other resources already available such as this online which discuss the specifics of using PHP with WSL, if you want to pursue that.
No, you can do PHP development on any OS.
BTW I will suggest you to do learn linux in future.

Complicated setup with Git, Laravel, PHPStorm and VPS

What I have so far:
Two VirtualBox LAMP machines (separate locations) where I connect my two Windows development machines via SFTP, to write code using PHPStorm.
One VPS machine where I deploy my code written for a project in Laravel.
What I am trying to achieve:
Fast and easy code deployment, as in: write the code in Windows via PHPStorm, test it on the LAMP machine, deploy to VPS if necessary.
The problem is that I need to use some php artisan commands on LAMP machines to get some code generated. This means that I always have to synchronize PHPStorm with LAMP files tree in order to see the changes. Then, I need to also sync the other dev (LAMP) machine and the other PHPStorm running on Windows machine number 2. I know that this can be done via Git.
So everytime I use the command line to generate code, I need to sync 4 machines (excluding the deployment server).
Later, if I add another pair of Windows/LAMP dev machines, the complexity grows.
Back in the days of Dreamweaver, I could write code directly on the deployment server. Not the greatest idea, but it was way much simpler and faster, and that's what I need now.
Any ideas on how can I simplify this?
Switching to WAMP so I can have files in sync with PHPStorm (because all is locally) is not OK because... Windows and PHP libraries issues :)
Also, switching to Dreamweaver is not OK either.
What other options do I have?
Thanks!
LE: on the side, I am also thinking if a NAS can be helpful for this type of problem.
LLE: is Linux Desktop + PHPStorm the only straight solution?
No matter the protocols
You can put your code outside of the guest machine and configure the guest machine to mount the code (mount a folder from the host inside the guest).
Apache will run slower because it will use the mounted remote-folder but PHPStorm will run at its maximum speed.
Taking protocols into consideration
Try using SSHFS on windows.
I use SSHFS for remote development from my Linux host machine to headless vagrant boxes (and/or to remote development servers / staging servers).
It's much faster than SAMBA (the windows SMB protocol) and oddly faster than NFS even though SSH uses encryption.
Coleages using Windows+SMB often leave their computers for 30 min while PHPStorm is indexing and git branch changes on the dev machine go unnoticed for minutes at a time.
Indexing over SSHFS usually takes less than 5 min on a Symfony2 project. Branch changes are detected in less than 15s.
Using Linux (shameless plug)
Linux is nice, and it's free, and it works out of the box (Ubuntu) -- including pesky USB-Modems which would normally require an install on windows.
You already know how to handle a Linux CLI the learning curve is already halfway crossed.
Auto-updates don't rule your life, they're not the king of you!
All the applications you need are part of the software repositories you don't need to look for anything, download 40+ executables and attempt to install them just to be welcomed by an error "invalid architecture", "windows version not supported", ".NET framework version too old", "DirectX version too new (wtf?)", "your cousin is a software pirate".
Dependency management is a concept Linux never fully solved -- but at least the bloody tried and in 90% of consumer use-cases it fits the bill. Windows is still eating glue at the back of the class.
How I solved the problem:
I have an extra Mac, on which I installed everything for my PHP ecosystem, including the IDE, so everything is local. That's the dev machine. Then I manually copy the code to the VPS when needed. Another solution was to install Ubuntu Desktop (or similar) on dual boot with Windows and use it as a local dev environment.
Much faster development / deployment :)

Developing on both Windows & Linux machines simultaneously

Sorry for the bad title (couldn't think of a better way to describe it)
I have a windows machine which I do development on. However, I have a new project which needs to interact with a linux system (executing linux commands etc.).
So, obviously I can't do development on my windows machine..and I don't wish to code on the dev machine, svn commit and then svn update it on the linux machine.
Is there a way where any changes I make on my dev machine will be quickly mirrored to the linux machine? SVN is not a very quick alternative and of course some changes will be very minor.
Any ideas? A network share I guess....but that's not very pretty (bit slow too).
As fellow developers I would like to know if you've been in a similar situation and how you've resolved it.
On a furthernote, I can't just install Ubuntu as my development machine and mirror the commands, applications etc. from the linux machine because it's a cluster 'master' machine and so therefore it has quite a special configuration.
Thanks guys!
EDIT: I've also thought about having web services on the linux machine and then just calling them from code thus seperating platform development dependency. What do you think about that too? thanks
Edit your files on the Linux machine, using Samba to expose them to Windows file-sharing.
(Alternatively via SFTP, but Windows software to mount SFTP as a filesystem isn't free.)
Have you considered using an XServer on your Windows box? You should be able to fire up a desktop session on the Linux box and have it display on your Windows machine.
Depending on how Linux-savvy you are, you may be able to get away with simply using SSH to get a terminal window, then editing files with vi or emacs. If you're working with PHP, I assume that you'll be able to see the results with your regular browser. I've done this a lot, and while it's not a full-on IDE, it's certainly workable.
You can developp your app in Windows and test it throug cygwin ;)

Which Linux distro is best for running in a virtual machine, for programming research?

I'd like to learn LAMP development for my own personal edification.
I tried setting up Ubuntu 8.10 "Hardy Heron" in Microsoft VPC, but I can't get the video to work above 800x600. Played with xorg.conf a million times but no joy. Can anyone recommend a good distro to work with that plays well with VPC? Any guidance on getting started with Apache and Perl/PHP would also be welcome.
I installed ubuntu 8.10 in a virtual machine on my Vista 64-bit laptop. I attempted the install with Virtual PC, VM Ware and Virtual Box from SUN. Virtual Box was the only vm software that I was successful with from the start. In the setup you choose that you are installing linux as your guest OS and everything works without spending your evening sifting through blogs trying to get install to work.
Firstly, if your goal is to learn LAMP development, I'd start by just downloading the WAMP stack for windows from http://www.wampserver.com/en/ or one of it's competitors. The "Linux" part of LAMP programming isn't likely to be a major part of your learning experience. Avoiding running a VM will be much less resource intense on your development workstation and avoid having issues with suspend/resume and disk IO contention.
Secondly, any linux should work, under virtualbox or msvpc. All the modern desktop virtualization systems emulate a full system, so it's just a matter of configuration and getting the right drivers. Like others said, virtualbox is more open source friendly so give that a shot.
Finally, I don't usually run X on my development VM's, since it just eats unnecessary resources. Just use putty on the host and ssh in to a VM running in console mode.
Not entirely the answer to your question, but I think it attacks your goal more directly.
If you're not wedded to VPC, a quick way to start might be to download the free VMWare Player at
http://vmware.com/products/player/
and then you can try any of many, many distros prepackaged for VMWare here:
http://vmware.com/appliances/directory/cat/508
The appliances at the second link should work out of box, so you don't have to fiddle with X conf files, which is probably not the topic of your research. As a bonus, you may be exposed to distros you normally wouldn't know about.
Edit: Here's an appliance with Ubuntu 8.10:
http://www.vmware.com/appliances/directory/54735
http://www.virtualbox.org/wiki/Guest_OSes
This is largely a matter of preference. As has been mentioned, Ubuntu is a good choice. I tend to prefer debian as it is a bit less cutting edge (and therefor more stable). But it's not as easy a platform to learn as Ubuntu.
As has also been pointed out, I would recommend VirtualBox as Virtual PC doesn't support non-MS operating systems.
I use Ubuntu 8.10 and Mono.
However, to get the graphics to work properly, you need the
noreplace-paravirt
kernel parameter.
I use Scientific Linux 5.2 (which is just a rebranded RedHat Enterprise Linux 5.2) and it works fine. I also have had success with many flavors of Ubuntu. I run all of my machines under VMWare Server and have successfully used them with both the 1.0.x versions and the 2.0.x versions of VMWare server.
Does it have to be Microsoft Virtual PC? Virtual Box is much more open-source friendly and I used it with no problems to display higher resolutions of the guest OS.
Check Bitnami stacks. They are ISO live disks images. You just need to attach the iso to the boot cd of the vistual machine. There is a LAMP stack based on Ubuntu.
If you like how it works, there is an option to install to a virtual disk.
I was able to get VMWare Server (free) to work fine with Ubuntu without much hassle (display, etc works out of the box). Install VMWare tools on the VM (they make it for linux) and you'll get a more seamless experience. My specific configuration:
VMWare Server 2.0
Host OS: Windows XP Pro, SP 3
Guest OS: KUbuntu 0804

How do I test on a Windows environment for a Linux server?

I have an Ubuntu Server (with all of LAMP and Subversion installed). I use Eclipse with Subclipse, PDT and a few other great addins and use those exclusively to develop applications. The problem I'm having is that I'm developing on a Windows Vista machine and transferring everything to the remote Linux server.
However, developing for windows and developing for Linux machines is quite different. One example would be the apostrophes/quotation marks required on the Windows server in the settings.ini file or the httpd.conf file. I tried installing XAMPP and getting the Eclipse debugger to work that way, but it was too much work and required me to constantly change my code when I moved them live on the server. I also tried using Wubi but didn't like that I had to reboot each time I wanted to go back to Vista.
Is there a solution for this situation? Is there a way to run a virtual copy of Linux on Windows Vista that will allow me to install LAMP and debug through Eclipse? Is there a better program with Eclipse that will allow me to debug my code with an internal server?
I'm looking for something really cheap as I'm in college and therefore low on funds, but am definitely open to any and all solutions to help me out.
You could use VMWare or Virtual PC to virtualise a linux build, or run the AMP stack up in Cygwin. Architecturally, Cygwin is a port of glibc adapted to sit on top of the Windows system call layer - it provides a unix-like system on top of Windows. There is a a large cross-section of ported software that you can install on it, including the AMP stack.
Edit: Just to add another good piece of software to the mix; VirtualBox is free for personal or evaluation use, partially open source, stable, and released by Sun. I've found it to be a good solid alternative to VMWare or Virtual PC.
I agree with NXC's answer (+1 ;) ), and here is a practical procedure to install a Linux on Windows XP using VMware Server.
That way, you will be able to deploy your server file directly on the target platform, but still debugging from a Widows eclipse session.
(source: cmsproducer.com)

Categories