Artigos de PHP & Development

PHP & Development 1,141 How to change your PHP version You can choose which PHP version your site runs on, from the older releases up to the most recent ones, and turn...
PHP & Development 774 Which technologies run here: PHP, Node, Python, Perl, games and the limits «My developer asks whether you support X.» This page answers that in one go, with names and versions - and it also...
PHP & Development 1,665 Viewing and adjusting your PHP configuration: version per folder, extensions and phpinfo Changing a whole site's PHP version is easy and is covered in how to change your PHP version. This article is the...
PHP & Development 870 PHP limits: memory, time, upload size and the one that fails silently «I cannot upload the image.» «The import stops halfway.» «The menu lost half its items after saving.» Three...
PHP & Development 884 Where the PHP error log is, how to read it, and the errors you will see most When a site breaks there are two ways to react: guess, or read what the server already wrote down. The second is...
PHP & Development 761 Do exec and shell_exec work here? Why no PHP function is disabled Anyone installing a tool that converts images, generates PDFs or shells out to some command eventually hits this...
PHP & Development 720 Changing your PHP version without breaking the site Switching version is one click, and it is written out step by step in «How to change your PHP version». This article...
PHP & Development 718 Getting a Laravel application running Laravel is not a CMS: it is the foundation you write a PHP application on top of. So this article has two halves....
PHP & Development 794 Sending e-mail from your own code with PHPMailer A contact form, an order receipt, a password reset: sooner or later your code has to send an e-mail. The simple...
PHP & Development 656 Switching Imagick on in PHP: in the panel, or with WHM Imagick is the extension that gives PHP the power of ImageMagick: opening formats nothing else opens, better...
PHP & Development 896 Rebuilding the wp-config.php connection wp-config.php is the file that tells WordPress which database to connect to, and with what password. Without it,...
PHP & Development 631 PHP warnings showing on your site: what they are and how to silence them At the top of the page, or in the middle of the dashboard, lines appear like Warning: ... in...
PHP & Development 649 Git in cPanel: publishing your site from a repository Anyone who works with Git knows the nuisance: the code is in a repository, the site is on the server, and between...
PHP & Development 328 Which PHP version should your site use Use the newest version your application says it supports, and never one that PHP itself no longer maintains. Here...
PHP & Development 314 Switching a PHP extension on or off in Select PHP Version In cPanel, open Select PHP Version (the Software section), pick the PHP version, open the Extensions tab and tick or...
PHP & Development 328 Composer on shared hosting: installing it and running it Composer is not installed as a command on the server, but you do not need it that way. You download a single file,...
PHP & Development 321 Running a PHP script from a cron job In Cron Jobs, in cPanel, the command is the full path of PHP, a space, and the full path of the script:...
PHP & Development 302 php.ini and .user.ini: where to set a value and what applies where For a value that suits the whole account, use the Options tab of Select PHP Version. For a value that only suits one...
PHP & Development 286 Fixing “Allowed memory size exhausted” The full message reads “Allowed memory size of … bytes exhausted (tried to allocate … bytes)”. It means a single...
PHP & Development 239 Fixing “Maximum execution time exceeded” “Maximum execution time of N seconds exceeded” means the script took longer than PHP’s max_execution_time allows and...
PHP & Development 270 Fixing “Call to undefined function”: the extension that is missing The message “Call to undefined function name()” says the code called a function that the PHP of this folder does not...
PHP & Development 355 Uploading large files in PHP: upload_max_filesize and post_max_size To upload a big file through a form, two values have to be high enough, and the second has to be larger than the...
PHP & Development 327 PHP sessions: where they live, and why users get logged out A PHP session is a small file on the server, tied to the visitor by a cookie (the PHPSESSID). That is where the...
PHP & Development 159 .htaccess for PHP projects: friendly URLs and redirects The .htaccess file is where you tell the server how to treat addresses: send every request to a single index.php...
PHP & Development 308 Sending e-mail from PHP: mail() or SMTP Use SMTP with a real mailbox on your domain. The mail() function is fine for a quick test, but it returns “sent”...
PHP & Development 294 A blank page in PHP: how to see the error A white page means PHP hit a fatal error and is set not to show it. That is the right setting for a public site,...
PHP & Development 343 Keeping passwords out of your PHP code: .env files and the right permissions Put passwords and keys in a configuration file outside the public folder, readable only by your account, and let the...
PHP & Development 357 OPcache in PHP: what it does, how to switch it on, and why edits do not show Every time someone visits a PHP page, PHP reads the code files and translates them into an internal format before...
PHP & Development 251 cURL error 28, 7 and 6 in PHP: timeout, connection refused and could not resolve host When your site calls an outside service (a payment, an API, an update) and it fails, PHP returns a cURL error...
PHP & Development 307 cURL error 60 in PHP: SSL certificate problem, and why not to switch verification off “cURL error 60: SSL certificate problem” means PHP connected to a service over HTTPS and did not trust the...
PHP & Development 283 Cannot modify header information, headers already sent: finding the line that caused it The full message is “Warning: Cannot modify header information - headers already sent by (output started at...
PHP & Development 430 File upload fails with failed to open stream or move_uploaded_file: the causes, in order The file reaches the server, PHP stores it in a temporary folder and your code tries to move it to its final place...
PHP & Development 315 Composer says your requirements could not be resolved: PHP version and missing extensions Composer installs libraries and, before doing so, checks that the PHP it runs on meets what each one demands. The...
PHP & Development 435 Errors after moving to PHP 8: undefined array key, null parameters and dynamic properties You moved the site to PHP 8 and new messages appear. Nearly all come from the same place: PHP 8 became less tolerant...
PHP & Development 338 Putting a CodeIgniter application on cPanel hosting A CodeIgniter application runs well on cPanel hosting, as long as the domain points at the application’s public...
PHP & Development 255 Laravel shows a 500 error or a missing application key: what to check In most cases a freshly uploaded Laravel that shows a 500 error has one of four causes: the application key is...
PHP & Development 339 php -v in SSH shows another version than your site: running the PHP you chose The php command you type in the Terminal or over SSH is not required to be the version you chose for the site. The...
PHP & Development 237 Calling a web API from PHP with cURL and reading the JSON reply To talk to an API from PHP you use cURL: open a request, send it, read the status code (200, 401, 404…) and only...
PHP & Development 233 json_decode returns null: how to find out what is wrong with the JSON When json_decode returns null, PHP knows why: ask it. The function json_last_error_msg() gives the reason in words,...
PHP & Development 335 Writing your own log from PHP: error_log and a log file you can read When something fails only in production, your best ally is a log your own code writes: one line with the time, what...
PHP & Development 193 ionCube Loader: when a script asks for it and how to switch it on The short answer: some bought programs (themes, modules, management systems) come with their code encoded so it...
PHP & Development 182 The wrong date or time on your site or e-mails: WordPress, PHP and time zones The short answer: “the time is wrong” can come from four places, and fixing one does not fix the others: WordPress...
PHP & Development 179 Accents turning into strange symbols on your site: UTF-8 from file to database The short answer: “ação” shows as “ação”, or as “a��o”, or as “a?o”. It is always the same problem: the text was...
PHP & Development 177 Sending one-time codes (OTP) by SMS safely: expiry, attempt limits and logs The short answer (for developers): a code sent by SMS is only as safe as the code around it. The rules: generate it...
PHP & Development 123 What an API is, in plain words: requests, answers and a REST example The short answer: an API is the agreed way for one program to ask another for something. Instead of a person opening...
PHP & Development 141 Callback URL or return URL: why a customer coming back is not proof of payment The short answer: an online payment usually involves two addresses of yours that the operator uses. The return URL...
PHP & Development 119 Timeouts, retries and idempotency: how not to charge a customer twice The short answer: when a request to an API times out, you do not know whether it got through. It may have failed...