Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Thursday, May 19, 2011

Thrift

Thrift is a software framework for scalable cross-language services development. It combines a software stack with a code generation engine to build services that work efficiently and seamlessly between C++, Java, Python, PHP, Ruby, Erlang, Perl, Haskell, C#, Cocoa, JavaScript, Node.js, Smalltalk, and OCaml.
Originally developed at Facebook, Thrift was open sourced in April 2007 and entered the Apache Incubator in May, 2008.

Read more: Apache Thrift

Thursday, February 03, 2011

CodeIgniter

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you're a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you're tired of ponderously large and thoroughly undocumented frameworks

Read more: CodeIgniter

Tuesday, January 18, 2011

Устанавливаем Apache 2, PHP 5.3 и MySQL 5.1 на CentOS 5.4/5.5

В моей работе мне чаще всего приходится работать с системами на Debian или Ubuntu, но в этот раз новый сервер оказался на CentOS, а так как с этой системой я сталкиваюсь впервые, то пришлось немного «погуглить», прежде чем освоиться в ней. Для начала необходимо было развернуть web сервер для проектов, то есть поставить Apache+PHP и MySQL. Впоследствии необходимо будет настроить эти компоненты, а так же установить и настроить nginx, но пока не об этом.

В качестве установщика пакетов здесь используется yum вместо привычного apt-get, что в принципе и понятно,т.к. данный дистрибутив основан на коммерческом Red Hat Enterprise Linux компании Red Hat, и совместимый с ним. Да и сам Apache называется не apache2, а httpd.
Ну что же, приступим к установке и настройке нашего веб-сервера.

1. Зайдем под пользователем root
su -
## Или ##
sudo -i

2. Добавим репозиторий Remi
В данном репозитории находятся новые пакеты, например там лежит php-5.3, т.к. в стандартном репозитории php ещё версии 5.1.6

## Remi Dependency on CentOS and Red Hat (RHEL)
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Стоит заметить, что на момент написания статьи последний релиз epel был 5.4 и он может в будущем измениться. За ссылкой на последнюю версию epel можно обратиться вот сюда

3. Установим Apache (httpd) Web server и PHP 5.3

Read more: Блог Вячеслава Волкова

Monday, December 06, 2010

PHP Interview Questions and Tips

So you’ve been slinging resumes for a while and now you have an interview for an awesome PHP job. While part of the interview will be the typical job interview, you should also be prepared for a technical interview. Technical interviews are often given to determine how well you truly know the technologies with which you’ll be working. There are numerous books and articles to help you prepare for the job interview portion but very little has been said on preparing for a PHP technical interview.

General PHP Questions

The first type of questions you’ll be asking in a PHP interview will be general questions about PHP itself. Typically, technical interviewers like to start with easy general questions about PHP such as special output tags, how to pass parameters, how to define constants and how to define variables. Depending on the interviewers own technical background, they may progress to questions on more advanced usage such as the object oriented features of PHP. Spend some time prior to your interview to brush up somewhat on the basics of the language. A quick read of a basic PHP book like PHP and MySQL Web Development (4th Edition) may help you review the high points.

Sample Questions

Q: What’s a PHP Session?
A: PHP Session is an object created by the PHP engine that persists data between HTTP requests
Q: What are tags used for?
A: They allow to output the result of the expression between the tags directly to the browser response.
Q: How do you define a constant?
A: define(“CONSTANT_NAME”, “constant value”);
Q: How would you get the number of parameters passed into a method?
A: use the fun_num_args() call within the method

MySQL

If you are having a PHP interview, it is pretty likely that you are interviewing for some type of web development job. That means it is almost certain that MySQL will be used. You should expect to be asked some questions about accessing MySQL from PHP in your interview. These questions don’t always get very deep. If you can describe how to connect to a database and execute a simple select query, you will likely pass your PHP interview.

Sample Questions

Q: How would you create a MySQL database from PHP?
A: mysql_query(“CREATE DATABASE db_name” connector);
Q: How would you see all tables in a database?
A: mysql> use db_name; show tables;
Q: How do you change a password for a given user via mysqladmin utility?
A: mysqladmin -u root -p password “newpassword”

PHP Frameworks

Read more: Learn computer

Sunday, November 07, 2010

Notes from porting C# code to PHP

After years of hearing negative things about PHP, I had been led to believe that touching it would rot my brain. Ok, maybe that’s a bit much, but its reputation had me believe it was full of bad problems. Even the cool kids had issues with PHP. But I thought that it couldn’t be too bad because there was that one website that gets a few hits using a dialect of it. When Kaggle offered to sponsor a port of my TrueSkill C# code to PHP, I thought I’d finally have my first real encounter with PHP.
<?php echo "Disclaimer:"; ?>
To make the port quick, I kept most of the design and class structure from my C# implementation. This led to a less-than-optimal result since PHP really isn’t object-oriented. I didn’t do a deep dive on redesigning it in the native PHP way. I stuck with the philosophy that you can write quasi-C# in any language. Also, I didn’t use any of the web and database features that motivate most people to choose PHP in the first place. In other words, I didn’t cater to PHP’s specialty, so my reflections are probably an unfair and biased comparison as I was not using PHP the way it was intended. I expect that I missed tons of great things about PHP.
Personal disclaimers aside, even PHP book authors don’t claim that it’s the nicest language. Instead, they highlight the language’s popularity. I sort of got the feeling that people mainly choose PHP in lieu of languages like C# because of its current popularity and its perception of having a lower upfront cost, especially among cash-strapped startups. Matt Doyle, author of Beginning PHP 5.3, wrote the following while comparing PHP to other languages:
“Many would argue that C# is a nicer, better-organized language to program in than PHP, although C# is arguably harder to learn. Another advantage of ASP.NET is that C# is a compiled language, which generally means it runs faster than PHP’s interpreted scripts (although PHP compilers are available).” - p.5
He continued:
“ASP and ASP.NET have a couple of other disadvantages compared to PHP. First of all, they have a commercial license, which can mean spending additional money on server software, and hosting is often more expensive as a result. Secondly, ASP and ASP.NET are fairly heavily tied to the Windows platform, whereas the other technologies in this list are much more cross-platform.” - p.5
Read more: MOSERWARE