AWS EC2 + LAMP + Ubuntu + Drupal install

Tutorial from AWS EC2 Docs

http://docs.aws.amazon.com/gettingstarted/latest/wah-linux/web-app-hosting-intro.html

Ubuntu install Apache + PHP

Check this tut but we have RDS so not need to install MySQL like this: http://www.chrishjorth.com/blog/free-aws-ec2-ubuntu-apache-php-mysql-setup/

Basic: http://howtoubuntu.org/how-to-install-lamp-on-ubuntu

Install php mysql:

Restart apache:

Error log:  /var/log/apache2/error.log

 

 

Using Git from BitBucket repository

Install git first. Then when I try to clone the Bitbucket repository, it failed and gives error:

To solve this, you need using SSH keys:

To create SSH keys:

 

Set PHP file upload size limit

It’s easy, just config the php.ini. But there is four setting we need to check:

For example in .htaccess:

If you set upload_max_filesize 100M but leave post_max_size 50M, you will only allow to upload 50M. That is a place we need to notice.

More check here:  How to upload big files

Create SOAP Client in PHP

Here is a very good tut for beginner:

http://devzone.zend.com/2202/php-and-soap-first-steps/

After read above tut, read this one then.

How to Create a PHP Client for a .NET and SOAP-based Web Service API

================================================================

FOR .net Web Service with http authentication, there is more need to attention:

First, somebody write this one:

Using SOAP PHP with NTLM Authentication

Then people make a lib for it:

PHP Exchange Web Services

If you choose to use old nusoap lib for PHP, then use this one:

How to use NTLM authentication with NuSOAP?

 

 

HTTP Authentication with PHP running as CGI

When I used HTTP Basic Authentication for my API, I just found it is not working on the server, but it is working on my localhost.

The reason is HTTP Authorization does not work when your PHP is installed and working as CGI. It works perfectly when PHP is installed as a module though. You can check PHP info to find which way is you php installed.

But we always can have a solution.

reference article:

My code:

.htaccess

PHP

Need notice:

Depending on your apache version the variable you rewrite can be prepended with ‘REDIRECT_’.

That is if you’re using HTTP_AUTHORIZATION the real variable in _SERVER becomes REDIRECT_HTTP_AUTHORIZATION.

Final in PHP

 

 

 

 

 

Add a link to a URL in a string – PHP

How to add a a tag in a string when it is a url like “http://…”?

Here is a simple solution: