[Solved] Mageia 5 and PHP PDO installation

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[Solved] Mageia 5 and PHP PDO installation

Postby Setanta » Jul 7th, '15, 22:22

Hello,

I just discovered Linux & Mageia and I'm pretty impressed ! I almost think I'll never go back to Win...

However, I have a problem regarding the LAMP installation. I correctly have Apache, MariaDB and phpMyAdmin working.

I get all my code back from Win, but the PDO connection is not working :-(
I install the following:
urpmi php-mysql
urpmi php-pdo
urpmi php-pdo_mysql

which gives for the last ones :
[root@localhost ~]# urpmq -i php-pdo_mysql
Name : php-pdo_mysql
Version : 5.6.10
Release : 1.mga5
Group : Development/PHP
Size : 33009 Architecture: x86_64
Source RPM : php-5.6.10-1.mga5.src.rpm
URL : http://www.php.net/pdo_mysql
Summary : MySQL Interface driver for PDO
Description :
PDO_MYSQL is a driver that implements the PHP Data Objects (PDO) interface to
enable access from PHP to MySQL 3.x, 4.x and 5.x databases.

PDO_MYSQL will take advantage of native prepared statement support present in
MySQL 4.1 and higher. If you're using an older version of the mysql client
libraries, PDO will emulate them for you.

Please note that this build does NOT support compression protocol because it
is built with MySQL Native Driver (mysqlnd).

[root@localhost ~]# urpmq -i php-pdo
Name : php-pdo
Version : 5.6.10
Release : 1.mga5
Group : Development/PHP
Size : 124403 Architecture: x86_64
Source RPM : php-5.6.10-1.mga5.src.rpm
URL : http://www.php.net/pdo
Summary : PHP Data Objects Interface
Description :
PDO provides a uniform data access interface, sporting advanced features such
as prepared statements and bound parameters. PDO drivers are dynamically
loadable and may be developed independently from the core, but still accessed
using the same API.


but still the following code is not executing on the new PDO line and I get a blank page in Firefox :
<?php
session_start();
include('bdd.php');
include('./_includes/fct_speciales.php');

//if posted login & password
if(isset($_POST['login']) && isset($_POST['pass'])){

this line is not executing ==>
$res = doQuery('select','SELECT t1.* FROM `sc_users` as t1 WHERE t1.`login`= ?' , array($_POST['login']));


the bdd.php file which is not executing :
$dbo = new PDO("mysql:host=$dbhost;dbname=$dbname;charset=utf8","$dbuser","$dbpass");


It was working well with EasyPHP in Win. Thus, I think I made a mistake in the php / apache installation.

I would thank you if you would have any idea to correct !

Kind regards,
Setanta => Mageia newbie
Last edited by Setanta on Jul 8th, '15, 00:30, edited 1 time in total.
Ce qu'apporte le flot s'en retourne avec le jusant. - What does the tide turn back with the ebb.
User avatar
Setanta
 
Posts: 7
Joined: Jul 6th, '15, 22:51
Location: Between Luxembourg & France

Re: Mageia 5 and PHP PDO installation

Postby Setanta » Jul 8th, '15, 00:03

After deep search, I found the solution ... For those who are interested :

Packages were installed correctly, but :
1) I was not using the adequate password for the root mysql user account ... (I mixed it with linux root password ...)
2) I did not set correctly the timezone in the php.ini file.
To correct this, I change the following line in the file /etc/php.ini:
date.timezone = Europe/Paris

then restart httpd service and it's working fine !

The thing I discovered today : there is an error log file which is very useful here : /var/log/httpd/error.log

Cheers,
Setanta
Ce qu'apporte le flot s'en retourne avec le jusant. - What does the tide turn back with the ebb.
User avatar
Setanta
 
Posts: 7
Joined: Jul 6th, '15, 22:51
Location: Between Luxembourg & France

Re: [Solved] Mageia 5 and PHP PDO installation

Postby filip » Jul 8th, '15, 07:46

Hi Setanta.

Welcome and thanks for sharing.

Filip as another php fan ;).
filip
 
Posts: 478
Joined: May 4th, '11, 22:10
Location: Kranj, Slovenia


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest