How to use Linux Xampp mysql_pdo with Symfony 2.0 - mysql

I've got a serious problem.
I would like to use Doctrine 2 on my Symfony 2 projet.
I've change the php path from the app/console :
/opt/lampp/bin php
I've specify the good path for my mysql_pdo in /opt/lampp/etc/php.ini
pdo_mysql.default_socket = /opt/lampp/var/mysql/mysql.sock
and check to my php_info() for my pdo :
PDO
PDO support enabled
PDO drivers mysql, pgsql, sqlite, sqlite2
pdo_mysql
PDO Driver for MySQL enabled
Client API version mysqlnd 5.0.7-dev - 091210 - $Revision: 304625
$
Directive Local Value Master Value
pdo_mysql.default_socket /opt/lampp/var/mysql/mysql.sock /opt/lampp/var/mysql/mysql.sock
pdo_pgsql
PDO Driver for PostgreSQL enabled
PostgreSQL(libpq) Version 8.0.3
Module version 1.0.2
Revision $Id: pdo_pgsql.c 300351 2010-06-10 12:11:19Z iliaa $
Everything seems fine, but when I use this Symfony command :
php app/console doctrine:mapping:import WonderWBundle yml
It juste says :
[PDOException] could not find driver
I'm on Ubuntu 10.10
XAMPP for Linux 1.7.4 !
It seems that I've got everything to made Pdo work well but not on Symfony 2.
Does anyone could help ? Pleeeaaaassse (I'm going mad !!)
Thanks a lot :P
(P.S : Grrr cannot link my screenshots !)

Another reason could be related to PHP itself.
Various linux distros compile their php-cgi/fpm/apache and php-cli to use different php.ini files ( which actually makes sense )
Both ini files use to have their module configuration files included from subdirectories.
If you install an additional module manually, the `phpinfo()? viewed in a web browser may show the module, but programs executed on the commandline, just like Zend Framework app/console are using php-cli with another configuration.
e.g. for the apache module
/etc/php/php-apache/php.ini
/etc/php/php-apache/php.d/pdo_mysql.ini
for the commandline php
/etc/php/php-cli/php.ini
In this case you have to repeat your module configuration for the commandline client
/etc/php/php-cli/php.d/pdo_mysql.ini
The commandline php also has a phpinfo functionality, which you can use to verify your cli installation:
~ # php -i | grep "pdo"

Related

Installing Siremis stuck on Database Configuration

I have install Kamailio 4.3.4 on Ubuntu 16.0.5 LTS. I want to install Siremis 4.3.0 but stuck on Wizard step 2 (Database Configuration) there is message "Something went wrong". I found error 500 action=update on console inspect element. I have try installing Siremis 5.1.0 and still not working stuck on step 2.
My Apache ver 2.4.10, My Php ver 7.0.33, Mysql 14.14
Please any advise
Sounds like one of the dependencies is not met:
Check your permissions are set:
make prepare24
make chown
Check Mod Rewrite is enabled:
a2enmod rewrite
service apache2 reload
Check PHP Mod is Enabled in Apache
On 16.04 installing PHP doesn't automatically add the PHP Apache mod, should be a package like libapache2-mod-php, you can verify that Apache is actually parsing PHP files by setting up a PhpInfo page.
Remove the Lock File & Try Again
When you run the installer a lockfile is created to prevent running the installer multiple times.
Once we empty the database with:
mysql> drop database siremis;
We can remove the lockfile and try again (from the Siremis directory):
rm install.lock
I did a writeup on installing Siremis on Ubuntu 18.04 which works fine.

Configuring apache 2.4 with php 5.6.32 configuring with source in linux

I have installed httpd 2.4, downloaded .tar.gz and configured as:
./configure --with-apr=/tmp/apr-1.6.3 --with-apr-util=/tmp/apr-util-1.6.1 --enable-so && make && make install (my apr and apr-util are at /tmp location)
also I have installed php 5.6.32, downloaded tar.gz and configured as:
./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --enable-fpm && make && make install
Problem is I am unable to add the fpm handler, any direction what should I do.
Should I proceed with how its described in redhat developer guide or apache wiki for FPM
Thanks in advance and correcting me, if I am doing some/lots of thinh wrong :)
Why trying to build from sources when binary packages exists in various repositories ?
Yes the PHP Configuration Tips gives you correct way to use FPM (as the Apache wiki in the SetHandler way).
The linked howto is for CentOS 7, but works for CentOS 6 using the httpd24 Software Collections.
Alternative solution is to use a 3rd party repository, such as "remi", see the Wizard instructions.

How do I enable the intl extension in CakePHP?

I am using CakePHP 3 and MAMP Pro server for my project. When I am trying to bake the cake, this error shows up:
Fatal error: You must enable the intl extension to use CakePHP.
I have even included intl.so and extension=php_intl.dll in my php.ini file but couldn't figure out solution for this error.
this issue was happening to me some days ago. I had installed Ubuntu 18.04 and php 7.1.
I was trying to run the comman php cake.php bake in orden to use cakephp's console but I was getting the following error message:
You must enable the intl extension to use CakePHP.
This extension (intl) was installed for php 7.1 (php7.1-intl) but this message was appearing every time I used php cake.php bake
After some google searches, I saw that I have to install the extension but with the following command:
sudo apt-get install php-intl
The same issue happened with mbstring extension, I used the command:
sudo apt-get install php-mbstring
then I restarted the apache server with:
sudo service apache2 restart
It's difficult to pinpoint exactly what's wrong without seeing your system setup. However based on what was said in the question, you may be setting up the intl extension incorrectly.
First off, if your OS is Linux/macOS and the PHP extension is a shared library (i.e. has a .so extension) then the php.ini entry should be extension=intl.so not extension=php_intl.dll. Also make sure the intl.so file is in the directory configured under the ini entry extension_dir. Otherwise make sure the extension ini entry is fully qualified (e.g. extension=/path/to/extension/dir/intl.so).
If you are using a Linux OS that has a package manager such as Debian/Ubuntu, you may be able to more easily install the extension for the PHP packaged for that distro. For example, in Ubuntu/Debian the package php5-intl provides the intl extension for PHP5 (I assume it's something similar for PHP7 if you've enabled those repos).
If you build PHP from source, you can try bundling the extension into your PHP. See the instructions from the manual.
I faced the same issue.
I added extension="php_intl.dll" in php.ini and restarted the Apache server.
Now it is working.
I had the same issue. After starting from scratch, I did :
$ brew install php
$ composer install && composer update && composer dump-autoload --optimize
$ composer self-update && composer create-project --prefer-dist cakephp/app:^3.8 cms
$ cd cms
$ bin/cake server
And it was working !

PHP7 and pdo_mysql [duplicate]

This question already has answers here:
PDO drivers no value in Windows
(18 answers)
Closed 5 years ago.
I've just upgraded PHP5.6 to PHP7 on my XAMPP on Windows 10 following this guide. It works just fine, except for PDO.
In my phpinfo() I get PDO support enabled, PDO drivers no value.
I copied the php.ini-development and renamed it to php.ini, and I have uncommented the extension folder declaration, and the extention driver php_pdo_mysql.dll.
extension_dir = "ext"
...
extension=php_pdo_mysql.dll
I have verified that php_pdo_mysql.dll is located in C:\xampp\php\ext and when I run php -m in a console, both PDO and pdo_mysql are listed as active modules.
C:\xampp\php>php -m
[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
exif
filter
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
Reflection
session
SimpleXML
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlwriter
zip
zlib
[Zend Modules]
When I run a script that utilizes PDO, I get thrown
Fatal error: Uncaught PDOException: could not find driver in (path to script)
The script I am running is completely valid and worked fine before the upgrade (basically just a new PDO(params)).
What am I missing?
For some reason, not sure why, Windows needs an absolute path to the extension dir. So instead of
extension_dir = "ext"
in php.ini, I put
extension_dir = "C:/xampp/php/ext"
and then restarted apache. Everything works again.
Maybe someone can elaborate on this issue?

How to stacically compile DBD::mysql and move the files on a shared hosting where i have my own perl installation

I have downloaded and installed locally on my Ubuntu ActiveState Perl(ActivePerl-5.14.1.1401-x86_64-linux-glibc-2.3.5-294969.tar.gz).
I did "~$ sudo apt-get install libmysqlclient-dev"
I downloaded from CPAN DBD::mysql
I read INSTALL.html
And here is my problem:
I am not sure how to compile a statically linked DBD::mysql which i can copy from my local ActivePerl installation to the same perl instalaltion but on my shared hosting provider mashine.
Note that the uploaded via ftp(no ssh there) perl directory structure works on the shared hosting (also x86_64-linux) after changing executable file permissions in ActivePerl/bin/ directory.
My CGI scripts run well under mod_cgi and mod_fast_cgi on the shared hosting.
I tried the advises in the installation document(INSTALL.html#source_installation) but no luck.
On another shared hosting with i586 Active Perl DBD::mysql just works because I first installed it locally using PPM and then uploaded via FTP. However there is no x86_64 PPM package provided by ActiveState.
Can sonmebody provide the magick spells for the commandline(ubuntu 11.04), something like:
me#mine:~$ mkdir /tmp/mysql-static
me#mine:~$ cp /usr/lib/libmysqlclien* /tmp/mysql-static
me#mine:~$ cd ~/install/Perl/DBD-mysql-4.019/
me#mine:~/install/Perl/DBD-mysql-4.019$ perl Makefile.PL --libs="-L/tmp/mysql-static -lmysqlclient"
me#mine:~/install/Perl/DBD-mysql-4.019$ make
me#mine:~/install/Perl/DBD-mysql-4.019$ make install
...
...hm :D seems it worked this time, but anyway I wrote all of the above... it might be useful to others. I will upload later today on the shared hosting to see if it works.
This works.
The only thing that one has to be aware is when using it on the shared hosting. You should connect via TCP instead of via Unix socket:
$dsn = "DBI:mysql:database=$database;host=127.0.0.1;port=3306";
$dbh = DBI->connect($dsn, $user, $password);
As written in the docs:
To connect to a MySQL server on localhost using TCP/IP, you must specify the hostname as 127.0.0.1 (with the optional port).