How to create a instance of aws s3 class to upload files using php?
if (!class_exists(‘S3’)) require_once ‘s3.php’; // include s3.php file if (!defined(‘awsAccessKey’)) define(‘awsAccessKey’, ‘keyhere’); //awsAccessKey key here if (!defined(‘awsSecretKey’)) define(‘awsSecretKey’, ‘secretkey here’); //secret key $bucketName = “bucketname”; // bucketname if (!extension_loaded(‘curl’) && !@dl(PHP_SHLIB_SUFFIX == ‘so’ ? ‘curl.so’ : ‘php_curl.dll’)) exit(“\nERROR: CURL extension not loaded\n\n”); $s3 = new S3(awsAccessKey, awsSecretKey); For more deatils : https://www.pgs-soft.com/blog/how-to-store-and-manage-files-on-amazon-s3-with-php-class/
Difference between parse error and fatal error in php?
Difference between parse error(syntax error) and fatal errors: Parse error or syntax error occurs if any syntax mistakes in code, example missing braces, semi column, quotes etc.. Fatal error occurs when we try to call any function that is not exist. Both errors stop the execution of program and shows the errors. Warning and notices…
How to create and access buckets in amazon s3?
How to create and access buckets in amazon s3 with php? In amazon s3 storage, files(objects) are stored inside buckets,we need to create buckets to store the objects. To create buckets s3 provide different API, that is we can create buckets within code itself. Or we can create the buckets from s3 console itself. We…
What is amazon s3?
Amazon s3 or simple storage system is storage service by aws. Here files are stored as objects. Objects are stored in buckets. so we need to create buckets first and then store objects inside it. we can assign the accessibility (ACL) to objects as private or public. public objects will be accessible to all. Private…
Difference between require and include
Difference between require and include in php: require(‘filename’) includes the file we specified , while executing, if any error occurred, it produce a fatal error and stop execution of the code. include(‘filename’) include the file, while executing the same, if any error occurred, produce a warning and execute the reaming code. require(‘filename’) and require_once(‘filename’) require_once…
Sessions in php
Sessions used to store information on server. Session variables are used to store the details in server. Can be store unlimited amount of data. Once a connection made with server, all data like, input field information, etc will be stored in server. Once user logged out, or browser closed otherwise connection lost, sessionĀ will be…
How to get Php configuration information
To get the configuration details(like php version, host details, mysql details) use the following function: How to get the installed php version ? phpinfo();
How to compare php vesrion ?
echo version_compare(PHP_VERSION,’5.0.0′); if our php version is greater than ‘5.0.0’ will print 1. echo version_compare(PHP_VERSION,’7.0.0′); if our php version is greater than ‘7.0.0’ will print 1. so, if(version_compare(PHP_VERSION,’5.0.0′)>=0){ echo “php version is greater or equal to 5.0.0 ” }
How to execute a function in php after a specific amount of time?
How to call a function in PHP after 5 seconds in php ? sleep(timeinsecond); is used to make a delay in php. sleep(5); 5 second delay . Then we can call any function in php
How to check whether an email is valid or not in php ?
Using filter_var function , we can check whether an email is valid or not valid with FILTER_VALIDATE_EMAIL filter. if(filter_var(“sample@gmail.com”,FILTER_VALIDATE_EMAIL)) { echo “valid”; } else echo “not valid”;