Install LAMP Stack on AWS EC2 with Amazon Linux from Start to Finish

How to Install LAMP Stack on AWS EC2 with Amazon Linux Here are quick steps to install LAMP Amazon EC2 Access your EC2 instance via SSH or Instance Connect from terminal Start by updating yum: yum update Verify PHP doesn't currently exist: php -v Install PHP if it couldn't be found: sudo yum install php Verify php is installed: php -v Install various important php extensions: sudo yum install php-fpm php-mysqli php-json php-deve Install Apache web server and wget: sudo yum install httpd wget Install MySQL: sudo yum install -y mariadb-server Configure your PHP.ini file and add other required extensions #Update Linux Packages sudo yum update -y #Install PHP sudo yum install php #Check PHP version php -v #Install important PHP extensions sudo yum install php-fpm php-mysqli php-json php-deve #Install Apache Web Server and wget sudo yum install httpd wget #Install MariaDB server sudo yum install -y mariadb-server The article…

read more

Set Date Timezone in PHP Like a Pro With 2023 Code Examples

How to set a Date Timezone with PHP Code Examples There are 3 ways to set a date timezone in PHP. You can use the default_timezone_set, DateTime object and modifying the INI file. The right choice depends on whether you want to update timezone globally, on app level or on an object. Set Default Timezone in PHP using the date_default_timezone_set function date_default_timezone_set("America/New_York"); echo date_default_timezone_get(); //America/New_York That's one way of doing it. Explore other options by reading this article till the end. Context: PHP Default Date Timezone  A web server uses a bunch of configuration options under the hood. A server running PHP uses a configuration file - php.ini. The configuration file sets up all the necessary directives, including environment variables, timeouts, session and database configs. Some of the configurations vary based on the host's location. The date and timezone may vary based on the server's default configuration. An Apache server…

read more