Hacker Newsnew | comments | show | ask | jobs | submit login
Ask HN: I'm starting a new job as a PHP developer tomorrow
18 points by grover_hartmann 5 hours ago | 48 comments
I have to admit I haven't touched a single line of PHP code in more than 8 years.

I've been working with Rails remotely since 2008 (~7 years in total). However, remote work has died out and decreased dramatically.

Is there anything you guys could recommend? I haven't worked with PHP in years so I'm worried about my performance with PHP on the new job.

I know how to program but I'm not familiar with PHP anymore, in fact I don't recall anything about it.

The reason I'm going back to PHP? Sorry, it's not my decision, and there aren't many local jobs in my area, so I'm taking what I can, and that's work with PHP at the moment.

Hopefully I'll find other jobs with saner languages in the future.

One other thing I want to mention is that I'm a Linux person, I can't use anything else. However, I've noticed that the company that wants to hire me is a Windows shop, they use Windows mostly (Windows desktops, Sublime Text, and so on).

Do you guys think it's acceptable if I use Arch Linux on a VM (VirtualBox) and I fullscreen the VM? I use things like i3-wm and vim and I'm really used to tiling WM these days, so using Windows would be very painful.

I asked if I could install Arch Linux on bare metal but they said no. They said I have to use a VM. They also mentioned I can't bring my own hardware.

I've been using Linux for 15 years and I currently use Arch Linux at home and on my laptop.

Suggestions welcome.






Based on your post, my concern is that you will stick out as a "sore thumb" insisting on using Arch Linux in a Windows shop. Basically, you are signaling to your employer and coworkers that you will be difficult to work with.

Please spend first 90 days building a good reputation and impression for yourself with your supervisor and coworkers and later use your reputation to drive any changes. By insisting on using Arch Linux, you will be wasting yours and others time in accommodating your preferences in recreating the workflow and tools that everyone else is used too.

You should focus on learning the tools and workflow used by your employer. You are no longer a freelancer who can chose their own tools and workflow, you are a cog in a machine now and learn how machine operates.

Your first priority should be to learn Windows and Development tools used by your coworkers. Find out what PHP framework and technology stack being used. And learning them is your next priority.


The company likely has a processes setup around the fact that everyone is running their dev environments the same way. Trying to do things differently without yet understanding their process will only complicate things.

For example, at my job everyone runs OS X, so build scripts, etc are all written with that assumption in mind.


Agree with you 100% and that is the point of my comment. Understand the tools, workflow and processes used by the employer first.

Not only that, being so adamant about using Arch Linux would make you look ignorant/partisan. Now don't get me wrong, I'm more likely that most to make a stink about not being able to use Linux on the job, but you can still get most of the important tools on a Windows box: Unix utilities (cygwin), nice tabbed terminal (Console2), GVim, Emacs, Perl, Python, Ruby, etc. One tool I lean on heavily is the Silver Searcher (granted, you could could install Perl/App::Ack) and I was able to even quickly find a Windows port of that just now: https://blog.kowalczyk.info/software/the-silver-searcher-for...

Given the availability of most of the good stuff on Windows, I don't think my workflow would change very much if I were forced onto a Windows box right now, apart from the occasional bummer about some bleeding edge software being unported or some library assuming Mac/Linux. Indeed, it was being forced to work on a Windows machine for a couple years that made me switch from TextMate to Vim (it made sense to become proficient with a single cross-platform editor).


I stuck out at my job using Emacs with C# and did just fine. A lot of experienced developers have their favorite dev environment. I've never seen it used against them.

I spent my own time, i.e. lunch breaks, adopting the company workflows to my dev environment.


Do you use Resharper at all?

Some in VS. I didn't use emacs exclusively.

I did this mistake once... I'm also a linux guy, but I was working in a company where everyone was using Os X. I did install an arch on my laptop and used it for almost a year.

Now, with the hindsight, it was a big mistake : it did make me loose so much time ! I did had to fix one script out of 2, the build system was not working properly, etc... And linux and Os X are not that different !

Don't do that... Use the tools that you company gives you, and try to fit in the company. Otherwise, you will be seen as the guy who does not want to do stuff the same way as the others. Even if everything goes well with your coworkers, you will end up waisting time every day.

You can install vim on windows (and sublime text does have quite a few almost decent vim plugins). You will miss i3wm a lot, but you don't need it to do good work.

Learn how to use the most efficiently the tools your company gives you (Windows and PHP). If you want to change something (at least for your first couple of month), try to change something that will make everyone life easier, not more complicated.


Start with http://www.phptherightway.com/

I came here to say exactly this. Glad I scrolled down before creating a dupe. Seriously, this is the most helpful thing I keep coming back to. You don't have to read everything linked to here all at once; just progressively keep looking at the resources linked to here as slowly as you need to in order to understand what is going on.

PHP is quite possibly one of the best languages to use for a project these days.

The community is massive and full of people who are deeply passionate about best practices. There are more quality frameworks than you can hope to keep up with (if your ranking of quality is the meager toy that rails is, you'll be happy here). The frameworks are really good at abstracting away the awful API choices the language makes.

That said, if you're writing in "PHP" instead of a given set of frameworks... you're working at a company that hired someone who wrote a lot of code with no experience of what makes a good system... but you'll soon find the JS looks exactly like that too, because that's not a PHP problem.

For your OS: You can get windows analogues to all those things (in the case of vim, you can also just... use vim on windows). They offered me a mac or a windows machine where I work and I opted for mac because it's just BSD4... but like... the WM is a pile, and I wish I was using Windows98 over mac. But none of that has stopped me from making huge contributions to the team.


Modern PHP is a sane language. A lot has changed in 8 years. I second Cholmon with his recommendation for phptherightway. I also highly recommend using a modern and developer friendly framework like Laravel. You can learn about it quickly by watching some tutorials at LaraCasts.com. Check out the Laravel 5 Fundamentals series which is free.

https://laracasts.com/series/laravel-5-fundamentals


Quick rundown (in no particular order):

* The language has comes leaps and bounds since you last used it

* Install composer and learn how to use it (PHP package manager)

* Read up on Laravel, IMHO it's the best PHP Framework out there right now. They guy behind it is a genius and has great vision for it.

* You'll want to use nginx + php5-fpm (No more apache and php_mod)

* Check our PHPStorm, if you are going to use an IDE you can't bear intelij IMHO and PHPStorm has support for a myriad of things

* ORM's have greatly improved, even if you aren't going to use Laravel read up on it's ORM to see what is possible

* Much more OO now especially when it comes to interacting with the DB (no more mysql_connect/mysql_query nonsense)


As a satisfied PHPstorm user, I'd like to say that the parent probably meant beat when they wrote bear

> if you are going to use an IDE you can't bear intelij

if you are going to use an IDE you can't beat intelij. They are also the people behind resharper.

Readers, if you are a student, please check out https://www.jetbrains.com/student/


PHP isn't as bad as it used to be. Yes fundamental operator order is erratic and I'm forever googling basic functions, but the ecosystem has produced some good stuff over the past couple years.

Read up on Composer and Packagist. It's basically NPM, Gems, or PyPi for PHP. There are now solid interoperable libraries for most common tasks.

- https://getcomposer.org

- https://packagist.org

Laravel is a great framework, but quite a bit of what's out there seems to be built on the Symfony foundation.

- http://laravel.com

- http://symfony.com

There are also great coding guidelines and tools that are evolving. The PHP Framework Interoperability Group has produced some solid coding standards and tooling has followed.

- http://www.php-fig.org

WordPress...it makes me sad. But it's ubiquitous. If you're stuck doing WP work, take a look at the Roots project. It's a sane, modern approach with good tooling.

- https://roots.io


I've been called a few times to troubleshoot slow PHP websites only to discover they were using Symfony and could not sustain 5req/sec on fairly beefy hardware. All kinds of PHP optimizations couldn't make it run much faster (which complicated the infrastructure a lot later on). The last time was 1 year ago so unless something impressive happened since then, I would suggest against it.

Something impressive must have happened, as the symphony projects I've worked on recently have been able to support far more load than what you're describing on ec2 micro instances.

If it's a small shop then depending on the atmosphere being the only linux-vm guy might cause undue friction? If you are really talented then sticking out of the crowd with odd stuff might be considered as a positive characteristic but since you are not yet a PHP god I would approach the job from the point of view of learning their tools first - it's just me, though so I would not presume to give you any tactical advice.

A few things come to mind of Windows if you choose to give it a try. 1. Vim for windows works pretty well 2. It's pretty fast to switch to a different application context on windows using win-key. On windows 7 still win + 1-9 switches to the cirresponding application on task bar - and the order of applications can be reordered by dragging a mouse.

Windows nowadays is pretty solid tech but it's aimed at a general demographic so finding all the power user levers take a while. Of these:

-powershell ISE is a really nice command line (well, better than cmd) and it comes out of the box

- some people swear by automation through autohotkey scripting

- win-r is a fast way to start apps and scripts

- hitting win key and typing the name of an application is a fast way to start applucations by just the exe name

Good luck on the new job!


I am shocked you can't get remote work with 7 years exp. Rails.

I'm even more shocked OP got a job hacking a language they haven't touched in over eight years.

How so? It's not like OPs been working with the team in question anyway. So there's going to be a learning curve, the least of which is probably standard library/syntax changes?

This was my thought. I'm happily employed so I haven't been looking, but are others finding that Rails work is drying up as well?

I am pretty new to rails, 3 years, and I haven't had any trouble finding work. Remote work is definitely not the easiest thing to find but it hasn't been that hard to find. Although I have a front end speciality which is much more in demand than traditional backend heavy developers right now.

Curious to know where the original poster is located?

PHP and Windows seems like an odd combination to me, but definitely get a feel for how things are run, both in terms of workflow and interpersonal interaction before you start insisting on certain tools/environments. I work at a company that's a windows shop (it's possible to use other operating systems but requires jumping through a bunch of hoops that make it not worth it) but I rolled with it until I got a better feel for things.

PHP is honestly a pretty swell language despite its irregularities and reputation amongst people who work with newer, more trendy language. It has a great community, and the language its self keeps getting updated with modern features, even if they're sometimes done in a slightly awkward manner.


What about the fact that they all are using Windows on the desktop? I'm a Linux person and I can't use anything else. I've been using Linux for 15 years.

I asked if they can let me install Linux on the computers, they said I have to use a VM.

I'm fine with a VM but I also need my window manager of choice (i3-wm) and so on.

Would it be okay if I install Arch Linux on VirtualBox and I fullscreen the VM? What about performance then?

All the other developers are using Windows and putty shells and Sublime Text as their editor.

I asked if I could bring my own laptop but they said I can't.

Suggestions welcome.


I think it's really strange that you can not install linux or bring your own laptop. Maybe you should have second thoughts if you'd like to work at that place.

That said, I think you will be able to adjust if you want. Just use vim on Windows, or use sublime with vim keybindings. You can also use a VM fullscreen. Works fine, I've done it before.


Have you actually tried VirtualBox? Depending on the underlying hardware, the performance really might not be an issue.

I'm not sure VirtualBox have an edge compared to "native" Hyper-V. If you're running windows 8.1 pro (which would be the sane choice, before 10 arrives) -- you have to change the boot options[1] if you want proper hw support for VirtualBox.

Changing from Linux to Windows is indeed rather painful. As others have mentioned, depending on deployment/process etc -- you might still be better off trying to live on the windows side.

I'm not a windows dev, but from what I've seen mentioned by others -- running php on windows w/IIS and SQL server works fine -- but you'll want to have a test/dev environment that matches prod -- or you'll just constantly run in to pain points -- especially if the team isn't on board/interested in investing in a full heterogeneous environment.

For a small example with node, see eg:

https://github.com/keithamus/npm-scripts-example/issues/5

Hopefully your new team has some automation in place -- it's unlikely it'll work out of the box under linux if it's never been tested/linux has never been a requirement.

On the bright side, vim works fine under windows, and with some mingw32/64[2], things aren't entirely painful. If you're used to script things with ruby, that should be even easier. Having to work with cmd.exe and it's nasty find.exe rather than grep, feels like running with one leg tied behind your back.

Lack of proper tabbed/keyboard-friendly window manager is probably the biggest productivity drain -- thought there are some alternatives for that too[3].

[1] http://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxA...

[2] http://msys2.github.io/

[3] https://github.com/fuhsjr00/bug.n


PHP is totally fine, it gets a bad rep it doesn't deserve. It's not as elegant as Python or Ruby but it's acceptable and it'll be more familiar than you think. If you're looking for the Railsy-est thing in PHP it's Laravel. If you can move them to Laravel (if it would be a good MVC fit) you'll be happy you did. Otherwise, don't stress about it too much.

Its bad rep was well deserve with PHP 4 and below.

It wasn't OOP at the start and had weird warts.

As PHP mature it's much better than its past and have fixed some complaints but unfortunately the bad rep still stuck. Plus there are some fundamental warts that you can't just fix.

In general, I'm happy that PHP is thriving and continue to improve. It looked bleak for a while and I regretted choosing PHP over Python or Ruby for web dev.

I find that it doesn't matter much if you're using MVC frameworks such as Laravel. You hardly need to memorize or use crazy stuff with PHP and most of the time you're just googling framework stuff how to grab param from route, etc...

I've done Scala Play framework that that language get in the way a lot on top of googling how to do stuff with play framework.

But I suspect that this observation is because more of dynamic language vs type language more than PHP vs Scala.

--

I think in general it's just language evolve and got better.

Perl started web dev and then PHP was better then Python came along and after that Ruby. With each subsequent programming languages the languages got prettier and had more thoughts into the design.


PHP is a decent language and ecosystem these days. Perhaps one of the minority of ecosystems that are actually on the rise rather than on the decline. It still has lots of warts, but whatever. Forget the idea that PHP is "taking what you can" or not a sane language -- you're in it now so might as well get up to speed with best practices and use it the best you can. I promise you can build compelling software in PHP.

http://www.phptherightway.com/ is a great resource for most things you'll need to know when working with modern PHP. Definitely start here.

Familiarize yourself with the ecosystem by poking at the most popular frameworks, at least skimming the docs to understand the types of things they provide and how they're structured: Zend, Symfony and Symfony Components, Laravel, Slim, Silex. Study WordPress, the "stereotypically bad" piece of software, for anti-patterns, but there's also a lot of good stuff in there and some improvements on the roadmap.

Composer is the npm of PHP. Check out packagist (horrible UI though) or browse github's PHP repos to find some of PHP's commonly used packages, like Monolog and phpunit. You can build a simple app in minutes in Laravel, and even put together a small product MVP using 90% boilerplate code within a matter of days on Laravel. Since there's a growing ecosystem for these tools now, it's getting easier and easier to write quality software in PHP, and it's actually a relatively pleasant experience.

Plus shipping and managing PHP in production is a breeze -- it's the most widely supported web platform, after all. We've got support on great CI systems like circleci and scrutinizer-ci.

Anyways, start there and good luck!


>Do you guys think it's acceptable if I use Arch Linux on a VM (VirtualBox) and I fullscreen the VM?

Yes. This should work provided you have a system with memory > 8GB, but you might face some issues when using a folder shared from windows. If something involves symlinks, then tread carefully. And file access to a shared folder is pretty slow too.

I am not going into how bad of an idea is going back to php since you have already considered it. But I will just say that php is every bit as bad as it was. I recommend /r/lolphp for an updated list of php gotchas...


I wouldn't say that php is every bit as bad as it was 8 years ago, its certainly made a lot of progress. There are now namespaces, generators/iterators, closures, traits, interfaces, type hinting, and with composer theres even a dependency manager. The zend engine rework coming later this year in php7 gives really promising performance boosts and some other niceties like ASTs.

Granted some (most?) of these modern php features aren't quite as nice as they are in other languages, and there is still some weirdness (/r/lolphp as you mentioned), and an inconsistently named standard library... But php has made some strides in the past 8 years. Once you're aware of the gotchas its not as bad as everyone makes it out to be.


This is the important bit

> Once you're aware of the gotchas (and keep your head stuffed with this useless info the whole time you are working with PHP) its not as bad as everyone makes it out to be..

First, you need to be aware of the gotchas. But this is not possible because,

1. We are still counting (take a look at /r/lolphp).

2. Even experienced (8+ years) php programmers know a very small percentage of the php gotchas. See this http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this.... You can see one commenter. who is an experienced php programmer who was not aware of that at the time. I myself had 8 years of experience when I was bitten by this bug..ahem..feature. So unless you haven't gone through all of /r/lolphp and commited the relavent ones to your memory and check them for every single line of code you write, you are bound to be bitten by one of those.

3. And documentation does not help. For eg. Even php core develpers agree that some of the important parts of documentation is incorrect but NO ONE CARES about things like that. Every one is out to implement flashy new stuff that fanboy can brag about. Even the existing documentation is does not go much deep into details. For eg this is the php.net page regarding exception handling

http://php.net/manual/en/language.exceptions.php

compare this to Pythons documentation

https://docs.python.org/3/tutorial/errors.html

https://docs.python.org/3/reference/compound_stmts.html#try

If you want to find how a return statement behaves inside of a finally block, the info simple isn't present in the php's documentation. Because "who cares because we copy stuff from java, so we probably does not not what is important to document anyway."..

I mean, it is very subtle and the recent 'facelift' that php received makes it hard to see its truly shitty nature for newcomers. When they look, they see all the shinny new features (often half assed) and think that php is on the same level as Python or whatever....


If you look into composer and start writing code using and contributing packages, you may be surprised at how similar modern PHP development is to other popular languages. Also look at the PSR standards, especially for auto loading at http://www.php-fig.org/psr/

>They said I have to use a VM. They also mentioned I can't bring my own hardware.

>Suggestions welcome.

Keep looking for a new job. I guarantee this is the tip of the nightmare iceberg you're about to hit.

I hope I am wrong, but I've seen this enough times before to know that I'm probably not.


are you trolling?

1) if you switching from ruby to php because there is no remote jobs.. well, there are plenty of them

2) you didn't touched php for 8 years, so why go php?

3) they are locked to windows and you can't install linux, well, don't go there

4) you can't even bring hardware! wtf! don't go there x2


Don't worry. PHP itself shouldn't be an issue. It's bog standard ALGOL-y syntax with some weird corner cases that aren't that hard to avoid.

The bigger gotcha will be getting used to the execution model, if it's standard LAMP-y type application hacking. Remember that, in this style of app, all of your state has to be either explicitly stored in a backend or in the browser cookies. The script begins not knowing anything, lives briefly, excreting HTML or JSON, and then dies, leaving behind only what it's explicitly saved. In some ways it's more complex than a Rails-type model, and in others it's simpler.

In any case, you should be up to speed in a week or two of hacking at it full time.


Aren't there pretty popular PHP frameworks that take care of magic like parsing variables and routing URLs and persisting state?

Of course, tons. But there's also a lot of PHP out there that doesn't use frameworks. Knowing how things like sessions and headers and requests actually work is probably more immediately useful for PHP than other languages, for which there's likely one de facto framework that everyone uses by default.

In PHP-land you're just as likely to walk into a job where interns have been hacking crazy stuff into a Simple Machines forum for the last year as encounter something built on a framework. And of course, mixing javascript, css and php together with whatever happens to come out of a database query (which is encoded in who knows what) is not at all uncommon, so even frontend knowledge is helpful.


If you want to run Windows 7 in a VM using a Linux box, I would recommend using KVM (http://www.linux-kvm.org/page/Main_Page) instead of using VirtualBox. I initially tried using Virtualbox to run Windows on Linux... but it had a hard time running multiple applications (multiple Visual Studio's, etc...). When I switched to using KVM, it was light years faster. All performance/reliability issues disappeared instantly. Never going back. So I now have all the goodness of Linux with an almost bare metal Windows VM.

Bringing your own hardware is not allowed in the majority of places (not located in SV). Its a security matter. Running a VM is fine. That shows they are flexible. you might run into issues if their whole development environment is built around windows and windows tools. Be open to it.

PHP is a language like any other. it has good and bad parts. what might prove useful is to focus on learning the codebase.

Good luck!


Your dev environment should ALWAYS run the exact same versions of the stack as production. With PHP, there are too many little gotchas between even minor versions.

I would suggest you get a PHP server going right away. Install WordPress or another PHP framework. Make the server do something useful. Use PHP to receive POSTed CURL messages.

Use PHP... and you will become familiar with PHP.


> it's not my decision, and there aren't many local jobs in my area, so I'm taking what I can, and that's work with PHP at the moment.

> I asked if I could install Arch Linux on bare metal but they said no. They said I have to use a VM. They also mentioned I can't bring my own hardware.

Beggars can't be choosers :(

Whether your Linux VM setup is acceptable will depend entirely on what the rest of the shop is used to. For example, if they develop on Windows desktops and deploy to Windows servers, you may need to use Windows scripts and test for Windows-specific corner cases, which would be difficult to do on a Linux VM. You may need to adjust all of your tools to use Windows line endings (CRLF). You may find that some of your tools don't work correctly on a vboxsf or samba filesystem. Be prepared to make compromises where necessary.

On the other hand, if they deploy to Linux servers, your knowledge of Linux and your VM might end up being a valuable asset for the shop.

In any case, don't say that you "can't use anything else". Of course you can. Learning to use a new OS or editor is not terribly different from learning a new language. If you can learn a new language, you can certainly learn to use Sublime Text or whatever.

Unwillingness to try a new tool just because it's outside of your comfort zone could reflect poorly on you, no matter how well justified you think your choices are. Your employer has shown flexibility by letting you run a VM. Try to show some flexibility in return.


Forgot one thing in my previous comment: Active Directory/Kerberos. For deployment etc - it's not likely to be feasible to get single-sign on to work correctly without running on your windows Desktop/uid. If they won't let you bring your own hw, they're not likely to allow you to join your vm to the AD domain either. Unless they're deploying to Linux and/or using github/bitbucket and/or plain pw auth etc.

This is why we can't have nice things.



Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact

Search: