Category: PHP Frameworks
Ubuntu | Remove sendmail completely
Problem: I installed sendmail in my ubuntu system with the help of link http://lukepeters.me/blog/getting-the-php-mail-function-to-work-on-ubuntu. I installed it to test php mail functionality on localhost for my project. It was working slow, therefore, after testing, I wanted to uninstall it completely
Moodle | Calling custom function on an event
Event driven architecture is inbuilt into Moodle. There are various kinds of events present in moodle like: 1. Course completion 2. Course creation 3. Course deletion 4. Course Module creation 5. Category Creation etc. On trigger of an event we
CakePhp 3.x | Declaration of user defined constants
In cakephp 3 we declare constants in bootstrap.php file under /app/config folder. A constant can be declared as: Configure::write(‘CONSTANT_NAME’, Value, true); Example: Configure::write(‘USERNAME’, ‘Webners’, true); To use this constant in another file, use this: use Cake\Core\Configure; Now the constant can
PHP and AWS | Copy AWS S3 file to local folder
How to copy a file from Amazon s3 to some local folder using PHP code $t=file_put_contents(‘[Destination file address]’, file_get_contents(“[S3 url]”)); Here $t will get the size of file in bytes if successful otherwise 0. Before executing this make sure that
Cron jobs in Totara
When I made any new changes to the audience or add a new user(s) to existing audience in totara, it didn’t reflect in the member area of that audience. Sometimes it doesn’t even show changes made for many days because
CakePHP | Calling Web API in CakePhp 3.x
Web API requests in CakePhp 3.x and difference from curl in php. Cakephp provides an easy method to communicate with webservices as compared to core PHP. In core php we make api requests using curl. Below is the sample code
Sendgrid | Display sender name with email in “from” field
If we want that when we send email to our users using sendgrid api then the name of the sender (if we provide) should appear along with sender-email then follow the process given below : To accomplish this, we just
AWS Amazon EC2 – Install php5.6 in Amazon linux
In Amazon Linux, it is not yet packaged with php5.6. When we install PHP by a standrad command: $yum install php* 1. It will install PHP version 5.3 Below are the steps to update PHP version from 5.3 to 5.6
CakePhp | beforeSave and afterSave Callback Methods
beforeSave(): This function is called automatically before every save or update operation. This function must return true if you want to continue save process. The data for save, if needed in this function, will be in $this->data. Syntax: class MyModel