Squeeze: Apache2 mit PHP5 und MySQL-Problem

Du kommst mit der Installation nicht voran oder willst noch was nachfragen? Schau auch in den "Tipps und Tricks"-Bereich.
Antworten
ThomasCornelius
Beiträge: 5
Registriert: 25.02.2014 16:02:12

Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von ThomasCornelius » 25.02.2014 16:26:08

Bisher hatte ich auf meinem Squeeze-Server php und mysql installiert (für Zarafa Groupware). Nun benötige ich auch die Unterstützung für MySQL in PHP5-Programmen. Ich habe brav alle fehlenden Pakete wie z. B. in http://www.howtoforge.de/anleitung/apac ... eren-lamp/ beschrieben installiert.

Mit dpkg -l wird mir auch alles angezeigt
  • apache2 2.2.16-6+squeeze12 Apache HTTP Server metapackage
    apache2-mpm-prefork 2.2.16-6+squeeze12 Apache HTTP Server - traditional non-threaded model
    apache2-utils 2.2.16-6+squeeze12 utility programs for webservers
    apache2.2-bin 2.2.16-6+squeeze12 Apache HTTP Server common binary files
    apache2.2-common 2.2.16-6+squeeze12 Apache HTTP Server common files
    mysql-client-5.1 5.1.73-1 MySQL database client binaries
    mysql-common 5.1.73-1 MySQL database common files, e.g. /etc/mysql/my.cnf
    mysql-server-5.1 5.1.73-1 MySQL database server binaries and system database setup
    mysql-server-core-5.1 5.1.73-1 MySQL database server binaries
    php-auth-sasl 1.0.4-1 Abstraction of various SASL mechanism responses
    php-gettext 1.0.10-1 read gettext MO files directly, without requiring anything other than PHP
    php-http-request 1.4.4-3 provides an easy way to perform HTTP requests
    php-mail 1.2.0-2 PHP PEAR module for sending email
    php-mail-mime 1.8.0-2 PHP PEAR module for creating MIME messages
    php-mail-mimedecode 1.5.0-3 PHP PEAR module to decode MIME messages
    php-net-dime 0.3-3 class that implements DIME encoding
    php-net-smtp 1.4.2-3 PHP PEAR module implementing SMTP protocol
    php-net-socket 1.0.9-2 PHP PEAR Network Socket Interface module
    php-net-url 1.0.15-2 easy parsing of Urls
    php-pear 5.3.3-7+squeeze18 PEAR - PHP Extension and Application Repository
    php-soap 0.12.0-2 a SOAP Client/Server class for PHP
    php5 5.3.3-7+squeeze18 server-side, HTML-embedded scripting language (metapackage)
    php5-cli 5.3.3-7+squeeze18 command-line interpreter for the php5 scripting language
    php5-common 5.3.3-7+squeeze18 Common files for packages built from the php5 source
    php5-curl 5.3.3-7+squeeze18 CURL module for php5
    php5-gd 5.3.3-7+squeeze18 GD module for php5
    php5-idn 1.2b-6 PHP API for the IDNA library
    php5-imagick 3.0.0~rc1-1 ImageMagick module for php5
    php5-imap 5.3.3-7+squeeze18 IMAP module for php5
    php5-mapi 7.1.8-43801 PHP MAPI bindings
    php5-mcrypt 5.3.3-7+squeeze18 MCrypt module for php5
    php5-memcache 3.0.4-4+squeeze1 memcache extension module for PHP5
    php5-ming 1:0.4.3-1+b1 Ming module for php5
    php5-mysql 5.3.3-7+squeeze18 MySQL module for php5
    php5-ps 1.3.6-3+b1 ps module for PHP 5
    php5-pspell 5.3.3-7+squeeze18 pspell module for php5
    php5-recode 5.3.3-7+squeeze18 recode module for php5
    php5-snmp 5.3.3-7+squeeze18 SNMP module for php5
    php5-sqlite 5.3.3-7+squeeze18 SQLite module for php5
    php5-suhosin 0.9.32.1-1 advanced protection module for php5
    php5-tidy 5.3.3-7+squeeze18 tidy module for php5
    php5-xmlrpc 5.3.3-7+squeeze18 XML-RPC module for php5
    php5-xsl 5.3.3-7+squeeze18 XSL module for php5
Dennoch sehe ich keine mysql-section in der phpinfo()-Abfrage und bekomme ich keinen connect zur mysql-datenbank hin.

Wäre sehr dankbar für Hinweise, wie ich das Problem einkreisen und lösen kann.

Besten Dank
Thomas

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von rendegast » 25.02.2014 18:18:39

Code: Alles auswählen

php -i | egrep -i "addit|mysql" -A5
Nix?

Code: Alles auswählen

aptitude reinstall php5-mysql
dpkg-reconfigure php5-mysql
Webserver neu starten?
Muß vielleicht bei der benutzten domain nochmal separat aktiviert werden?
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

ThomasCornelius
Beiträge: 5
Registriert: 25.02.2014 16:02:12

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von ThomasCornelius » 25.02.2014 18:35:14

Das sieht schon gut aus (s. u.), besten Dank. Bleibt für mich die Frage, warum beim Aufruf von
  • $conn = @mysql_connect("localhost", "xxxxxx", "yyyyyyyy");
aus einem php-Programm unter Apache2 nichts passiert und
  • phpinfo()
aus dem apache keine mysql-Section zeigt.
  • mysql

    MySQL Support => enabled
    Active Persistent Links => 0
    Active Links => 0
    Client API version => 5.1.73
    MYSQL_MODULE_TYPE => external
    MYSQL_SOCKET => /var/run/mysqld/mysqld.sock
    MYSQL_INCLUDE => -I/usr/include/mysql
    MYSQL_LIBS => -L/usr/lib -lmysqlclient_r

    Directive => Local Value => Master Value
    mysql.allow_local_infile => On => On
    mysql.allow_persistent => On => On
    mysql.connect_timeout => 60 => 60
    mysql.default_host => no value => no value
    mysql.default_password => no value => no value
    mysql.default_port => no value => no value
    mysql.default_socket => /var/run/mysqld/mysqld.sock => /var/run/mysqld/mysqld.sock
    mysql.default_user => no value => no value
    mysql.max_links => Unlimited => Unlimited
    mysql.max_persistent => Unlimited => Unlimited
    mysql.trace_mode => Off => Off

    mysqli

    MysqlI Support => enabled
    Client API library version => 5.1.73
    Active Persistent Links => 0
    Inactive Persistent Links => 0
    Active Links => 0
    Client API header version => 5.1.72
    MYSQLI_SOCKET => /var/run/mysqld/mysqld.sock

    Directive => Local Value => Master Value
    mysqli.allow_local_infile => On => On
    mysqli.allow_persistent => On => On
    mysqli.default_host => no value => no value
    mysqli.default_port => 3306 => 3306
    mysqli.default_pw => no value => no value
    mysqli.default_socket => no value => no value
    mysqli.default_user => no value => no value
    mysqli.max_links => Unlimited => Unlimited
    mysqli.max_persistent => Unlimited => Unlimited
    mysqli.reconnect => Off => Off

ThomasCornelius
Beiträge: 5
Registriert: 25.02.2014 16:02:12

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von ThomasCornelius » 25.02.2014 22:01:14

Mittlerweile habe ich einige ähnliche Situationen gefunden, in denen innerhalb von Apache keine mysql-Connection zu Stande kam. Lösung war unter Suse:
setsebool -P httpd_can_network_connect_db=1

Gibt es in Debian ähnliche Parameter, die die Apache-mysql Verbindung verhindern?

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von rendegast » 26.02.2014 01:59:34

[32]File [33]Packages
/usr/sbin/setsebool [34]policycoreutils
Stimmen für dieses Vorgehen denn die Voraussetzungen?
(spezifische Fehlermeldungen usw.)


Eine Ausgabe bekommst Du aber beim Aufruf des info.php?
Denn sonst würde wohl noch Debianlibapache2-mod-php5 oder Debianphp5-cgi fehlen.
(phpapi-......)


Mal die Logs von apache und mysql?
Zuletzt geändert von rendegast am 27.02.2014 07:06:19, insgesamt 2-mal geändert.
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

ThomasCornelius
Beiträge: 5
Registriert: 25.02.2014 16:02:12

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von ThomasCornelius » 26.02.2014 20:43:43

Ja, bei dem php -i Befehl von der Command-Line wird auch die mysql-Unterstützung aufgelistet. Im Browser bei Zugriff auf den Apache2-Server allerdings nicht.

Im Apache error.log steht nichts.

Welche Apache-Module müssen denn für den mysql-Zugriff enabled sein?

Nochmals Danke für jede Hilfe.

rendegast
Beiträge: 15041
Registriert: 27.02.2006 16:50:33
Lizenz eigener Beiträge: MIT Lizenz

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von rendegast » 27.02.2014 07:09:05

'a2enmod php5' und apache neu laden/starten.
Das sollte aber schon die Installation des php5 gemacht haben.
mfg rendegast
-----------------------
Viel Eifer, viel Irrtum; weniger Eifer, weniger Irrtum; kein Eifer, kein Irrtum.
(Lin Yutang "Moment in Peking")

ThomasCornelius
Beiträge: 5
Registriert: 25.02.2014 16:02:12

Re: Squeeze: Apache2 mit PHP5 und MySQL-Problem

Beitrag von ThomasCornelius » 27.02.2014 20:06:11

Habe den Fehler gefunden: in /etc/php5/apache2 fehlte der Link auf die conf.d-Directory mit den mysql.ini usw.

Eigentlich ganz einfach, wenn man sich nicht blöd anstellt oder nur oberflächliche Linux-Kenntnisse hat. Danke für die Antworten, das mit php -i usw. hat mich letztlich auf die Spur gebracht.

Antworten