EzDevInfo.com

lamp interview questions

Top lamp frequently asked interview questions

How do I convert a PDF document to a preview image in PHP?

What libraries, extensions etc. would be required to render a portion of a PDF document to an image file?

Most PHP PDF libraries that I have found center around creating PDF documents, but is there a simple way to render a document to an image format suitable for web use?

Our environment is a LAMP stack.


Source: (StackOverflow)

How to enable curl, installed Ubuntu LAMP stack?

I have installed ubuntu Lamp stack. But the curl is not enabled, neither can I can find the extension listed in the INI file. I added manually but it didn't work either.

How should I enable Curl then?


Source: (StackOverflow)

Advertisements

Why use deflate instead of gzip for text files served by Apache?

What advantages do either method offer for html, css and javascript files served by a LAMP server. Are there better alternatives?

The server provides information to a map application using Json, so a high volume of small files.

See also Is there any performance hit involved in choosing gzip over deflate for http compression?


Source: (StackOverflow)

How do I change the root directory of an apache server?

Does anyone know how to change the document root of the Apache server? I basically want localhost to come from /users/spencer/projects directory instead of /var/www.

Edit

I ended up figuring it out. Some suggested I change the httpd.conf file, but I ended up finding a file in /etc/apache2/sites-available/default and changed the root directory from /var/www to /home/myusername/projects_folder and that worked.


Source: (StackOverflow)

How Can I Enable Root SSH Access in An Amazon EC2 Instance?

This issue has been bugging me for the past several days.

I've been working on setting up a LAMP Server on Amazon EC2. The main issue is that I'm writing an application for a client that requires a lot of high-end processing, and Amazon EC2 seemed like a good choice.

Initially I started off with a basic AMI which really didn't have anything. I tried using root access to log into SSH (using WinSCP) and I was told to use ec2-user.

I tried using ec2-user, and I was able to log in. However, I still didn't have root access and couldn't install apache. I did some reason and I found out about the "sudo" command, and pretty much every article I read on this issue said to either use root access, or log into ec2-user and user sudo.

I have since tried again with a different AMI where LAMP was already installed. I was able to get it working, set up a database and start running a website off of it. However, I still needed to install some extensions. Namely, an API I'm trying to use for this application requires SOAP to be installed.

Here's my dilemma:

/$ whereis soap
soap:
/$ whereis yum
yum: /usr/bin/yum /etc/yum /etc/yum.conf /usr/share/man/man8/yum.8.gz
/$ yum install php-soap
Loaded plugins: fastestmirror, priorities, security
You need to be root to perform this command.
/$ sudo yum install php-soap
sudo: sorry, you must have a tty to run sudo

Command 'sudo yum install php-soap' failed with return code 1 and error message sudo: sorry, you must have a tty to run sudo

I can't use yum because I don't have root access, and whenever I log into root it either tells me to use ec2-user or provide a password I don't have. The other alternative was to use sudo to make ec2-user act like root, but I always get the error 'sorry, you must have a tty to run sudo.' I've ran that error message online and that it seems I need to add a user to sudoers... which I can't do without root access.

This exact same issue plagued me on two separate AMI's. On the first I just received a message saying I had to log in as ec2-user (and I must have a tty to run sudo), while the second (with LAMP installed) required me to enter a password for root, and for user I got the same sudo error.

Here are the id's of the AMI's I used:

ami-8c1fece5
ami-6ae81503

I also tried a third AMI later that also had LAMP installed... I couldn't even get into that one at all.

I did download my SSH key and used PuttyGen to convert it to a ppk file. I can log in successfully as ec2-user, but I cannot gain root access anywhere.

I have been looking around quite a bit for help on this, but every article I've read assumes that the user either has root access available or has sudo available on ec2-user. I don't have either. Is it just that I need a new image?

Any help would be greatly appreciated...


Source: (StackOverflow)

How to enable mod_rewrite in LAMP on ubuntu? [closed]

I'm using Ubuntu 12.04 LTS linux on my machine. I've already installed LAMP on it. Now I want to enable the mod_rewrite module. I did google a lot and tried lots of tricks but couldn't be able to enable mod_rewrite. Can anyone help me to enable the mod_rewrite? Thanks in advance.


Source: (StackOverflow)

Best practices for withstanding launch day traffic burst

We are working on a website for a client that (for once) is expected to get a fair amount of traffic on day one. There are press releases, people are blogging about it, etc. I am a little concerned that we're going to fall flat on our face on day one. What are the main things you would look at to ensure (in advance without real traffic data) that you can stay standing after a big launch.

Details: This is a L/A/M/PHP stack, using an internally developed MVC framework. This is currently being launched on one server, with Apache and MySQL both on it, but we can break that up if need be. We are already installing memcached and doing as much PHP-level caching as we can think of. Some of the pages are rather query intensive, and we are using Smarty as our template engine. Keep in mind there is no time to change any of these major aspects--this is the just the setup. What sorts of things should we watch out for?


Source: (StackOverflow)

Best practices for deploying tools & scripts to production?

I've got a number of batch processes that run behind the scenes for a Linux/PHP website. They are starting to grow in number and complexity, so I want to bring a small amount of process to bear on them.

My source tree has a bunch of cpp files and scripts, organized with development but not deployment in mind. After compiling all the executables, I need to put various scripts and binaries on a cluster of machines. Different machines need different executables, scripts, and config files for their batch processes. I also have a few of tools that I've written that belong on every machine. At the moment, this deployment process is manual and error prone.

I'm guessing I'm just going to end up with a script that runs at the root of the source tree and builds a smaller tree of everything necessary for any of the machines. Then, I'll just rsync that to the appropriate machines. But I'm curious how other people are managing this type of problem. Any ideas?


Source: (StackOverflow)

How do I use rpm to update/replace existing files?

I have several applications that I wish to deploy using rpm. Some of the files in my application deployments override files from other deployed packages. Simply including the new files in the deployment package will cause rpm conflicts.

I am looking for the proper way to use rpm to update/replace already installed files.

I have already come up with a few solutions but nothing seems quite right.

  • Maintain custom versions of the rpms containing the original files.

This seems like a large amount of work for a relatively small reward even though it feels less like a hack than some of the other possible solutions.

  • Include the files in the rpm with another name and copy them over in the post section.

This would work but will mean littering the system with multiple copies of the files. Also it means additional maintenance in the rpm build spec for each file.

  • Use wget in the post section to replace the original files from some known server.

This is similar to the copy technique but the files wouldn't even live in the rpm. This might act like a nice central configuration authority though.

  • Deploy the files as new files, then use symlinks to override the originals.

This is also similar to the copy technique but with less clutter. The problem here is that some files don't behave well as symlinks.


Source: (StackOverflow)

How much of Linux should I learn in order to deploy web sites using LAMP?

Being a Windows developer I'm currently working on my own project using LAMP. I understand what I need to know of PHP and MySQL, but Linux looks huge and it's not clear where to start and what is enough given my goals.
And my goals are to grasp general concepts, being able to deploy the project to a hosting provider and to be able to monitor the site's performance in order to spot problems, load issues, etc.
I know, the best solution is to get a Linux admin to do that but before I can do that I need to do it myself.

Tell me how!

It would be great if people expand their answers about what to learn with how to learn it (should I buy a particular book, or is there a good online tutorial or ...?).


Source: (StackOverflow)

Simple document repository

Please recommend me a simple web-based document repository for keeping my small company documents (.DOCs, .PDFs) so i can access them from everywhere. There are many available on the internet, but they are heavy and filled with unnecessary features and requirements.

I have little requirements: pleasant interface (AJAX feels nice), folders or tags, maybe versioning, maybe CIFS mounting or batch upload/download, preferably not written in Java (won't be able to host it).

Regards, Todor

Note - The question submitter is using a LAMP based environment.


Source: (StackOverflow)

What are alternatives to SQL database storage for a web site?

An SQL database is overkill if your storage needs are small. When I was young and dumb, I used a text file and flock()ed it when I needed to access it. This doesn't scale, but I still feel that non-database solutions have been completely ignored in Web 2.0.

Does anyone not use an SQL database for storage? What are the alternatives?


Source: (StackOverflow)

What is Options +FollowSymLinks?

I am using a Lamp server on my computer. I started to use Laravel php framework. In my .htaccess , If I use Options +FollowSymLinks , I get 500 error. And If I comment out , I have to use index.php in my all addresses ..example:

/~ytsejam/blog/public/index.php/login

I use Arch Linux . Is there a way to solve it?

edit: I solved this by using virtual hosts. And deleting index.php from application/config/application.php in laravel folder.


Source: (StackOverflow)

Best practices for optimizing LAMP sites for speed? [closed]

I want to know when building a typical site on the LAMP stack how do you optimize it for the best possible load times. I am picturing a typical DB-driven site.

This is a high-level look and could probably pull in question and let me break it down into each layer of the stack.

L - At the system level, (setup and filesystem) can you do to improve speed? One thing I can think of is image sizes, can compression here help optimize anything?

A - There have to be a ton of settings related to site speed here in the web server. Not my Forte. Probably depends a lot on how many sites are running concurrently.

M - MySQL in a database driven site, DB performance is key. Is there a better normalization approach i.e, using link tables? Web developers often just make simple monolithic tables resembling 1NF and this can kill performance.

P - aside from performance-boosting settings like caching, what can the programmer do to affect performance at a high level? I would really like to know if MVC design approaches hit performance more than quick-and-dirty. Other simple tips like are sessions faster than cookies would be interesting to know.

Obviously you have to get down and dirty into the details and find what code is slowing you down. Also I realize that many sites have many different performance characteristics, but let's assume a typical site that has more reads then writes.

I am just wondering if we can compile a bunch of best practices and fully expect people to link other questions so we can effectively workup a checklist.

My goal is to see if even in addition to the usual issues in performance we can see some oddball things you might not think of crop up to go along with a best-practices summary.

So my question is, if you were starting from scratch, how would you make sure your LAMP site was fast?


Source: (StackOverflow)

Is the LAMP stack appropriate for Enterprise use?

Is the LAMP (Linux, Apache, MySQL, PHP / Ruby / Python) stack appropriate for Enterprise use?

To be clear, by "Enterprise", I mean a large or very large company, where security, robustness, availability of skill sets, Total Cost of Ownership (TCO), scalability, and availability of tools are key considerations. Said another way, a company that looks for external adoption of frameworks / architecture - Something ubiquitous will be seen as more "valid" than something exotic / esoteric in this kind of environment.

I've seen use cases where Oracle, IBM, and Sun have implemented systems on the LAMP stack for various Enterprises. I've also seen examples where websites like yellowpages.com (Ruby on rails) and Facebook (php) are built on it. However, none of these examples are exactly what I'm looking for.

I'm really trying to find examples where it is an Enterprise standard at a very large bank (I.e., Citigroup), Telecom company (I.e., AT&T), or manufacturer (I.e., Proctor and Gamble). Just to be clear, I'm not looking for an example where it's used in a limited sense (Like at JPMorgan Chase), but where it's a core platform for systems like CRM, manufacturing systems, or HR management, as well as for internal and external websites.

The perception I've seen so far is that applications built on the LAMP stack perform slower and are less flexible. Some of the arguments I've heard are:

  • Linux is seen as not as well supported as Unix, Solaris, or Windows Servers.

  • Apache is harder to configure and maintain than web servers like BEA WebLogic or IIS.

  • MySQL is a "not ready for prime time" DB for hobbyists, and not a competitor for SQL Server or Oracle (Although PostgreSQL seems to have a reputation for being more robust).

  • PHP / Ruby on rails are optimized for CRUD (Create, Read, Update and Delete operations). Although this is an advantage when building CRUD-intensive web aplications, both perform slower than Java/Java EE or C# (which are both common Enterprise standards). Furthermore, a lot of applications and systems (like manufacturing systems) have a lot of non-CRUD functionality that may be harder to build with PHP or Ruby, or even Python.

Can anyone please provide arguments to support or refute the idea of the LAMP stack being appropriate for the Enterprise?

Thanks!

KA

UPDATE: Some times the LAMP Stack is Appropriate for Enterprise Use: Externally-Facing Blogs


Source: (StackOverflow)