Category: PHP Frameworks
Heroku | Run Cakephp Code as Cron Job
Problem The requirement was to run CakePHP controller action as cron job on Heroku. In order to achieve this you need to schedule this action so that it runs at specific time intervals on Heroku. To run the code you
Shared Hosting | Absolute location of a file
If you want to access a file on a shared hosting server by specifying its absolute location it may not work. The reason is what we see on shared hosting as root folder actually may have more before it that
PHP Code | Connect to remote SFTP location on Windows
We need to use the phpseclib library to connect to SFTP server: $sftp = new Net_SFTP(‘www.webnersolutions.com’); if (!$sftp->login(‘user_name’, ‘password’)) { exit(‘Login Failed’); } $this->downloadfiles($sftp->nlist()); //to download all files on remote root folder
Amazon S3 and PHP | How to list only top level folders in a bucket
Sample code: $result= $client->listObjects(array(“Bucket” => $bucket,”Delimiter” => “/”)); $files = $response2->getPath(‘Contents’); foreach ($result[‘CommonPrefixes’] as $object) { echo $object[‘Prefix’]’; } This will list only the top level folder. If we do not use delimiter with listObject function then it will give
How to Remove Empty Objects From Array In CakePHP
In CakePHP, to remove empty or ‘false’ values from an Array, use CakePHP’s static ‘filter’ method contained in ‘Hash’ class: $sampleArray = [ , false, true, 0, [‘one, ‘two, ‘three’] ] $sampleArray = Hash::filter($sampleArray); Here’s the array after filter method
Importance of Website for Business – Part 3
In previous 2 posts in this series we covered benefits of having a website for your business and difference between Responsive and Non-Responsive website. We also shared some stats on how small business presence on Internet is going up. In
Fatal error: Allowed memory size of 16777216 bytes exhausted
You need to change the maximum memory allowed to a php script to run. For this you need to open your php.ini (location of this file will depend on where php is installed on your machine). In my case php.ini