Showing posts with label Php. Show all posts
Showing posts with label Php. Show all posts

Wednesday, December 2, 2020

sqlite3 and pdo_sqlite not loaded in php apache2 localhost after upgrade to php 7.4 on Windows

The problem is that the two extensions php_sqlite3.dll and php_pdo_sqlite.dll are not loaded eventhough the two are exist in the extension directory, I had this problem when I upgraded php to version 7.4 and I thought the problem was in my system but after a while I found on Php.net that an additional setup on Windows is required as of PHP 7.4.0.

Note: Additional setup on Windows as of PHP 7.4.0

In order for this extension to work, there are DLL files that must be available to the Windows system PATH. For information on how to do this, see the FAQ entitled "How do I add my PHP directory to the PATH on Windows". Although copying DLL files from the PHP folder into the Windows system directory also works (because the system directory is by default in the system's PATH), this is not recommended. This extension requires the following files to be in the PATH: libsqlite3.dll.

 That is great, but putting this file in the system path seems not a good practice , so it is better to copy this file to the Apache BIN folder, and you will not be worry about sqlite3 extension again unless a new version of libsqlite3.dll library released.

Sunday, October 1, 2017

htmlspecialchars() expects parameter 1 to be string, array given Laravel 5.

This Error Happened in View where php trying to echo a value using the function htmlspecialchars(), and this function cannot accept an Array as its first Parameter.

Debug : if you are using Whoops for debugging your application you will see in the left panel a link to the view templates directory .

…\storage\framework\views\eec8a32e98fad0167a61a9f879d076bc29cad5a6.php 43
 
the number in red may change in your case , So open this file in any editor and find the line number 43 , you will find the echo function containing something  function as its parameter, like this :

echo e(app->Somthing()));

the e function is a laravel helper function , which apply htmlspecialchars() function to the expected string between brackets.


Now, the function inside the brackets is causing the error , Here it is the app->Something which is bringing an array as its result while htmlspecialchars () expecting a string , find this function in your view file and change it to give you a string not an array.

Sunday, March 16, 2014

in Wamp PHP Startup: Unable to load dynamic library c:\php\

If you are using Wamp server, and when you try to switch between php versions or trying to swirch between Apache versions and you get an error message saying that Php cannot load the dynamic library that you know it is exist in the extensions folder. and the stupid wamp server  looking for that extension in a place other than the one mentioned in phpForApache.ini file.
The Problem here is that php-win.exe running without depending on apache server, So php will use the php.ini file that reside in php folder not the one that reside in Apache folder .
Because I didn't change this file (the one in php folder) and used to deal with phpForApache.ini because it is the one that will be copied to Apache folder .
To solve this issue just make the two files identical , that means when you make any changes to one of the be assure that you make these vhanges in the other one.

Friday, March 14, 2014

Add a new version of PHP to Wamp Server

To Add a new version of PHP to wamp server , Say you have php5.4.3 and you want to add a new version php5.5.8.

You have to follow these steps to be assure that you can run the new version in your wamp server :

 1. Copy the new php version folder to the php folder in Wamp/bin folder .
                       Example :
                                Wamp/bin/php/
                                                      /php5.4.3
                                                      /php5.5.8

  (Note: the first number must be attached directly to php, no space no dots) .

2.Create a new file and name it wampserver.conf in the new php folder(php5.5.8) .

 3.Copy the content of the wampserver.conf that reside in the last php version (php5.4.3) to the wampserver.conf of the new php version(php5.5.8).

4.make a copy of php.ini file in the new php version(5.5.8) folder and name it phpForApache.ini .

5. (if it is not Exist)Add the following  line to the new  phpForApache.ini :

        extension_dir = "d:/wamp/bin/php/php5.5.8/ext/" .

6. Add the following line to the end of the LoadModule section in httpd.conf file which reside in wamp/bin/apache/apache2.4.*/:

 LoadModule php5_module "d:/wamp/bin/php/php5.5.8/php5apache.dll".

 7.Also add the following  line :

;AddModule php5

(Note: these two line will be replaced by the contents in the wampserver.conf variables ,So it is not important what is written here as long as the line contain the two words "LoadModule" and "php" or "AddModule" and "php").

Tuesday, June 25, 2013

Laravel-4 Tutorial-2 : Installation on Windows

The process of installation is clear and direct on windows and require 3 steps to do that : first , downloading the required packages, install them and check the path .

Downloading :
As I said in tutorial-1 , three main programs must be installed on your system Php,Composer And Git, Of course php will be installed with Apache server and mysql as a standard package (I use Wamp Server).

Download the Composer and Install it Just run the installation program , Then go to and download Git
Don't forget to choose the "Add to system Path" option when asked for .

Next check your installatio by running these commands from the command line :
C:\php --version
C:\composer --version
C:\git --version.
if it is ok and you will get a message of each program version.
Now you are ready to install Laravel-4 and begin creating your project.

Install  Laravel-4 using composer:
From the folder that you want to create laravel project in run the following command from command line:

composer create-project laravel/laravel 

The composer will connect to the git repository  and download the laravel
framework and all its components and their dependent packages.
even the Application key will be produces automatically by the installer. No need to do anything else just start configuring you application.

Friday, May 3, 2013

Wamp cannot load extensions- php5apache2_4.dll - Windows 7

Wamp is Automating every thing that's the great thing of this web server , So , If you enable the extension from the menu (Icon Tray-> Php Menu  ->Extensions) ,Wamp will un-comment the extension in your php.ini  automatically , you don't need to do anything.

Please Note : that there are three Php Initial files came with Wamp , one in Php Directory , the second in Apache->Bin Directory and the third is called phpForApache.ini and located in php directory.

We are talking here about the second file that located in Apache->Bin  folder and that file must be showed in the results of Phpinfo() function as "Loaded Configuration File " variable .

So, Don't Comment anything . wamp will do it for you , what you need to do Solve Any Problem is to check the Variable 'Extension_dir' in php.ini file , the directory must be related to the apache folder .I meant that the path to the Php extensions directory must be not  = "ext", Because that mean, the folder is inside the Apache->Bin  Folder , and that's not right . Just write the full Path to the extension Directory.

Another thing to mention here that is very important if you are going to play with wamp , when you switch the php version through the system tray menu, Wamp  will copy the phpForApahce.ini from php version directory to Apache version directory .
Then it will change  any line contain "LoadModule  And Php" with the  line from another file called "wampserver.conf" that is located in php folder which is relevant to the apache version.

Two files are  important to wamp to load php extension successfully on is the php.ini in the php directory and the other is in apache/bin directory they must include the same extension and the same extension_dir