Different hosts use different location for storing and accessing files and so you’ll need to research where your php.ini file. To do that Step 1. Create a script to display your PHP information Create a very simple php script and place it in your home directory(www or public_html or httpdocs). Use script editor or a […]
Posts in the PHP category:
Irfan Moosani Joomla and WordPress custom and maintenance work
Joomla Expert with Knowledge of LOVE FACTORY , Community Builder, RSForms WordPress Expert with Knowledge of WooCommerce PHP, MYSQL, C, C++ trainer
php code to save files on user machine
I was trying to save the ‘.xls’, ‘.doc’, ‘.wmv’ on user machine, which works correctly on Firefox(developer friendly) but not on Microsoft’s IE(Microsoft friendly); after searching on the net, i found this code which works on both the browser. here is the code: ————————- <?php // downloading a file $filename = $_GET[‘path’]; // fix for […]
PHP Script to load a PDF
To get PHP to load a PDF (for example) from file, use the following code. <?php $filename = $_SERVER[‘DOCUMENT_ROOT’] . “/path/to/file/my_file.pdf”; header(“Cache-Control: public”); header(“Content-Description: File Transfer”); header(‘Content-disposition: attachment; filename=’.basename($filename)); header(“Content-Type: application/pdf”); header(“Content-Transfer-Encoding: binary”); header(‘Content-Length: ‘. filesize($filename)); readfile($filename); ?>
Cannot modify header information – headers already sent
Warning: Cannot modify header information – headers already sent by (output started at /home/domain/public_html/file.php:42) in home/domain/public_html/includes/main.php on line 302 Solution The “headers already sent” error is usually caused by having white space before or after the opening and closing PHP tags (<?php . . . ?>). Remove the additional spaces , this should solve the […]
Header already sent
Note that if you don’t want to go through the process of making sure that there is no output before you send a header, you can use <?php ob_start(); ?> at the beginning of your page. This starts the output buffer, which allows you to send headers whenever you feel like it. Make sure that […]
Call to undefined function imagecreatefromjpeg()
We moved the site to the new server, The site was working fine , but while uploading the image, I encountered the following error Fatal error: Call to undefined function imagecreatefromjpeg() in /home/domain/public_html/admin/configs.php on line 53 The solution to the Problem is The GD has to be installed with your PHP installation or it has […]