How do I install sqlite on Laravel 5 for WAMP? - php

I'm using Laravel 5 on my WAMP Server and I am trying to get sqlite to work on it so I can follow the tutorials properly. I've uncommented the following in php.ini and restarted the WAMP server.
extension=php_pdo_sqlite.dll
extension=php_sqlite.dll
extension=php_sqlite3.dll
After restarting the server,
I've created a script to test if sqlite3 is supported or not located in C:\wamp2\www\laravel\test\test.php, and when I run it, the message says 'SQLite 3 supported.' So I know that it is working as far as that is concerned.
<?php
$dbname='base';
if(!class_exists('SQLite3'))
die("SQLite 3 NOT supported.");
$base=new SQLite3($dbname, 0666);
echo "SQLite 3 supported.";
?>
However, when I go into my database.php at: C:\wamp2\www\laravel\test\config\database.php and change the default to,
'default' => 'sqlite',
and then go into the cmd prompt to run the same command they do in the tutorial, which was: "C:\wamp2\www\laravel\test>sqlite3"
I get the error message
'sqlite3' is not recognized as an internal or external command, operable program or batch file.
In git it says:
Joe#JOEALAI /C/wamp2/www/laravel/test
$ sqlite3
sh: sqlite3: command not found
When my default was at 'mysql', it ran perfectly and I was able to connect and create tables no problem.
I am completely stuck. Is there anyone that has had this experience and can help me through this?

The test.php is just testing if the PHP module is installed.
I never worked with WAMP before but I'm pretty sure you need the actual sqlite3 programm installed on your server for the PHP module to work. Try downloading and installing the
Precompiled Binaries for Windows from their website.

Related

PHP on Ubuntu loads MSSQL extension from command line but NOT when run through Apache

I've been searching and trying for quite a while to find an answer, so will finally ask here.
I have a UBUNTU install from Turnkey LINUX, PHP Ver 5.6.23.
I have compiled and enabled mssql.so as I require to connect to a MSSQL server.
My simple connect PHP script is so:
$server = 'rslocal';
$connect = mssql_connect($server, 'sqluser', 'sqlpassword');
if (!$connect) {
echo 'can not connect';
}
I can run the above PHP script from the command line and it is successful.
I can also run the FreeTDS tsql utility and connect and query the server from the command line
When I run it from the browser through Apache, it tells me
Fatal error: Call to undefined function mssql_connect() ...
I have checked that php --ini (cli) and phpinfo() (browser) both report the same ini file in use.
I am not running SELinux so the setbool commands are not relevant here, however the problems stated by others where SELinux WAS the issue are exactly the same as mine, so perhaps this is a place to start.
My feeling is that it is a security policy or something stopping the extension from loading any function that wants to communicate with an outside server, but I am stuck.
Any help would be appreciated.
I found the "answer". On this distro, Ubuntu 14.x, the command
sudo apachectl restart
doesn't seem to be enough to reload php. The php.ini change, specifically adding extension=mssql.so had not been not applied when run through apache. This raises the question how to "hard" restart Apache so php.ini changes take, but that's a different question. I only noticed that it worked after a reboot.

php artisan migrate : PDOException could not find driver

I was in need to install Php 5.6 with postgres. I followed the instructions from here and did:
brew install php56 --without-mysql --without-apache --with-postgresql
brew install php56-pdo-pgsql
Php 5.6 and postgres are running fine with my Projects using PostgreSQL.
Now there is some problem with Laravel projects using mysql. On running php artisan migrate command, it shows:
[PDOException]
could not find driver
Project works fine in the browser though. Data is being fetched perfectly from the mysql tables. php -m also does not shows mysql. But phpinfo does shows mysql module.
What could be the problem? Do i need to reinstall mysql?
Probably, you would need to activate mysql extension in php
Find your php.ini. Create a php file with following content and run it. It will tell you where it is.
<?php phpinfo(); ?>
Just look at the path of loaded configuration file. Common places include /etc/apache/, /etc/php4/apache2/php.ini, /etc/php5/apache2/php.ini or even /usr/local/lib/php.ini for Windows it may be C:\Users\username\PHP\php.ini
Edit your server’s php.ini and look for the following line. Remove the ‘;’ from the start of the line and restart Apache. Things should work fine now!
;extension=mysql.so
should become
extension=mysql.so
For windows it will be
;extension=mysql.dll
should become
extension=mysql.dll
Restart your apache service to load the new configuration.

Cant install mongo into PHP (XAMPP, Windows)

I'm sitting on it 3rd day and i have no idea what to do next.
I'm using XAMPP on Windows.
I've downloaded mongo.dll from here:https://pecl.php.net/package/mongo/1.5.5/windows - for php5.6, TS, x32.
i've modified php.ini file.
When i run "php -m" i can see "mongo" on modules list. But when i open my page, i see "Class 'MongoClient' not found" error message.
i've tried also to type "php install mongo" but after some time i see message "Package "mongo" Version "1.6.10" does not have REST xml available
install failed"
I have installed mongo on my computer, but i don't think it's realy needed since i'm going to connect to another computer in LAN.
[UPDATE]
When i run phpinfo by www, there is no mongo on list.
when i run php -i, mongo is there.
I could understand, if there was another php.ini for CLI and Apache, but there is no other php.ini on my computer.

How to setup Mongo DB & PHP with core Mac OS 10.6.8, default Apache instance/Web Sharing

I am attempting to configure PHP and Mongo DB to connect with one another and I'm having some troubles. Before I say the problem let me recap what I have so far.
I am using MAC OS X 10.6.8
I have mongo DB installed and working stand-alone.
I have enabled PHP on the default Mac OS Apache web server. It is working and the server recognizes PHP ( it is not allowing inline PHP scripts in HTML files...not sure if this an issue)
"Web sharing" works just fine.
I have installed pear via this url: curl -O http://pear.php.net/go-pear.phar
I have the pear folder and files accessible and have launched o-pear.php from a web browser.
I have gone through the step-by-step install process ( and removed any red displayed errors ).
Presumably Pear is now installed.
It says at the bottom of the install front end:
Note: To use PEAR without any problems you need to add your PEAR
Installation path (/Users/myname/Sites/PEAR) to your
include_path.
Using a .htaccess file or directly edit httpd.conf would be working
solutions for Apache running servers, too.
I am not sure what the code is I need to add for the httaccess rewrite.
As of this moment
Terminal does not recognize the pear command.
When I launch the pear "front end" from a web browser I get:
Fatal error: No PEAR.php in supplied PEAR directory: /Users/myname/Sites/PEAR in /Users/myname/Sites/index.php on line 24
Thank you.
That is all.
Create a new PHP file called phpinfo.php. Add the content <?php phpinfo(); ?> there. Run the script from within your webbrowser.
You should see a big page with PHP configuration information. Watch out for include_path. This is where your webserver/PHP module/process searches for include files.
You will also find Loaded Configuration File. This is the PHP configuration file being used. Open that file in any editor, and search for include_path again. Add /Users/myname/Sites/PEAR to the end of the include_path.
Restart your webserver. PEAR now should work.
If you need to install the MongoDB PHP extension, go for pecl install mongo from command line.

Why can't CakePHP bake connect to MySQL running under EasyPHP on Windows Vista Ultimate?

I have CakePHP (cake_1.2.2.8120) and EasyPHP (3.0) installed on Windows Vista Ultimate. I followed the "baking" tutorials online and successfully set the database connection with the "cake bake" command from the CLI.
I baked the controller for my "Users" table using the "php cake.php bake controller Users" command - worked fine. However, when I tried baking the view similarly, I got this message:
Fatal error: Call to undefined function mysql_connect() in C:\Web\EasyPHP
\www\cake\cake\libs\model\datasources\dbo\dbo_mysql.php on line 374'
Also, the MySQL module is enabled for PHP on the phpMyAdmin page (web), but I can't find it in the CLI (using "php -m" from the command line) even though I've uncommented the "extension=php_mysql.dll" line in the php.ini file.
How can I fix this?
Grab XAMPP which has Apache with the MySQL and PHP modules setup and working together, as well at the MySQL and command-line versions. It just unzips to any directory, so it won't mess up any other Apache installs you have. Just be careful of any port conflicts between the different installations.
Download XAMPP
The root cause of the problem is that in EasyPHP 5.3 there isn't any php.ini file in the php folder.
Copy php.ini from EasyPHP5.3\apache to EasyPHP5.3\php to solve this nasty issue.
Copy the apache/php.ini file to php/php.ini.
I don't know EasyPHP, but it seems to be Apache-based. Check if you're using a Apache-module for the MySQL connection, as this will not work in CLI.

Categories