PHP Frameworks Archives - Page 13 of 13

Cakephp | URL routing using prefix after domain name

Author - Webner

Routes in an application are configured in app/Config/routes.php. Defining your own routes allows you to define where your application will take the control to for a given URL.

Default routing is like this:

domain/controller/action
Ex. www.xyz.com/user/login

Prefix routing will add a Read more…

Moodle / PHP | The uploaded file exceeds the upload_max_filesize directive in php.ini

Author - Webner

How to increase the value of ‘upload_max_filesize’ variable to upload a file/plugin of larger size.

We were trying to install a new plugin with size of approx 3.5 mb in our moodle site. It was showing an error:”The uploaded file exceeds the upload_max_filesize directive in php.ini Read more…

Zoho Creator | post data to external URL and redirect there

Author - Webner

In zoho creator, we have postURL function to post the data to an external URL but it receives a response back instead of transferring control to the external webpage. For redirection Zoho provides openURL function in zoho creator with which we can send the data to another url by passing Read more…

Air Gapping | Mobile app connectivity with localhost services

Author - Webner

When we were trying to connect an android app with the php localhost services it was giving an error: cannot connect to the server please check your network connection.
Code independently was working but not when we were connecting Android app to localhost code. It was working on uploading the Read more…

Heroku | How to create/deploy your Php/CakePHP app (Ubuntu)

Author - Webner

1.  Sign up:

First, go to Heroku.com and click “sign up” to get your free Heroku account.

2.  Install the Heroku Toolbelt:

The Heroku Toolbelt contains the Heroku client, a command-line tool for creating and managing Heroku apps Read more…

XML parsing problem – HTML entity characters in XML

Author - Webner

Problem

We had written a PHP program to parse large XML files and split each file into smaller chunks. Program was working fine for all the XML files except few. It was not splitting some XML files. After looking for the issue we found that Read more…

Accessing AWS S3 bucket in PHP | Period / Dot in Bucket Name

Author - Webner

You may face a problem in your code if you are trying to access an AWS S3 bucket which contains period / dot in its name (like my.first.bucket). It gives a fatal error in PHP. This problem actually occurs with some AWS SDKs not all, so the solution is Read more…

PHP | Encoding Spanish Characters with json_encode

Author - Webner

You may face a problem with Spanish characters in PHP while trying to use json_encode. After json_encode it doesn’t give any result and no any error either. For solving this use utf8_encode instead of json_encode.
$result = utf8_encode ($value)

Webner Solutions is a Software Development company focused on developing CRM Read more…

Salesforce password expires and it needs to be changed in code everytime

Author - Webner

Problem:

We’re integrating Salesforce to a third-party e-commerce site using our custom cakephp app. In the app we’ve written code which uses Salesforce API to connect to Salesforce using Salesforce account username and password and then makes use of API calls to insert and Read more…

Codeigniter | How to remove index.php from URLs

Author - Webner

Problem: The default URL for Codeigniter contains index.php in it. How to remove that from URL?

For example: How do we change

http://localhost/workspace/pagination_demo/index.php/Home/ to http://localhost/workspace/pagination_demo/Home/

Solution:

Steps:

1.  Go to application- config folder inside your project:

2 Read more…

Error Code: 3. Error writing file ‘/tmp/MYMI5iqH’ (Errcode: 28)

Author - Webner

Problem

Recently in a website we were developing in Codeigniter PHP Framework, some of the urls stopped working and started throwing 500 internal server error. On investigation we found a MySQL query which was causing the problem .Query is simple but when we ran it Read more…

Heroku | Run Cakephp Code as Cron Job

Author - Webner

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 need to add Heroku scheduler Read more…

Shared Hosting | Absolute location of a file

Author - Webner

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 is not visible to us for security reasons (as machine Read more…

PHP Code | Connect to remote SFTP location on Windows

Author - Webner

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 Read more…

Amazon S3 and PHP | How to list only top level folders in a bucket

Author - Webner

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 list of all the Read more…

How to Remove Empty Objects From Array In CakePHP

Author - Webner

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 call:
$sampleArray =
[
true,
0,
[‘one, ‘two, ‘three’] ]

 
Webner Solutions is Read more…

Importance of Website for Business – Part 3

Author - Webner

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 this third and final post of “Importance of Website Read more…

Fatal error: Allowed memory size of 16777216 bytes exhausted

Author - Webner

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 is in /etc/php5/apache2/php.ini

Open Read more…

‹ Prev page1 ... 8 9 10 11 12 13