IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Zend PHP Discussion :

Problème de paramètres


Sujet :

Zend PHP

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2005
    Messages
    184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 184
    Points : 149
    Points
    149
    Par défaut Problème de paramètres
    Je ne suis pas un spécialiste du PHP et j'avoue que je n'avais pas touché à mes scripts depuis un bon bout car ils fonctionnaient très bien.

    Maintenant, je ne sais pas pourquoi, mes scripts ne semblent pas recevoir les paramètres que je leur envois.

    Exemple:
    monsite.com/script.php?test=45

    Dans le script
    echo "test=";
    echo $test;
    echo "xxx"

    Résultat:
    test=xxx

    La variable $test est vide.

    Tout fonctionnait avant.

    C'est surement tout bête !


    Voici ce que j'avais reçu il y a 2 semaines environ de mon hébergeur. Peut-être est-ce un indice ?.



    Greetings,


    On friday evening at 12:01am CST Sat to 2:00am CST, April 21, the servers will experince web downtime during the maintainance for the upgrade to PHPSuexec configuration with native CGI-FastCGI PHP4 and PHP5 on the servers.


    One of the reasons for implementing this is that we want to offer everyone native use of PHP4 and PHP5, with options of Zend Optimizer or IonCube Loaders with Eaccelerator PHP Caching engine. It was not possible with the past implementation with PHP5 addon, and due to my work on hacking the phpsuexec patch, I was able to add the PHP5 into the patch to make it possible. So I am able to have PHP4 and PHP5 running at the same time with no conflict between both.


    What is PHPsuexec?


    On most Apache web servers PHP is run as an Apache module which is the default/standard method of running Apache on a web server. Because PHP runs as an Apache module all PHP applications are executed with the user ID of the web server which is usually the "nobody" user but can be set to any user ID that the system administrator wants to use. With PHPsuexec all PHP applications are executed with the user ID of the account that they are associated with and not the user ID of the Apache server.


    Why are we switching to PHPsuexec?


    We are switching to PHPsuexec because it improves the security and operation of the servers. Currently if an account is running malicious PHP scripts such as scripts used to send spam or cause performance issues on the server it can take a while to track down which account is causing the problem and resolve it. With PHPsuexec enabled we can find the offending account in minutes and resolve the problem caused by the offending script. PHPsuexec will also solve some of the file and directory ownership and permission problems that some of you have had with various PHP applications (mainly the CMS applications like Joomla and Drupal but other applications have the same issues).


    PHPsuexec Details to Keep in Mind:


    File/Directory Permissions and Ownership


    When PHP runs as an Apache Module it executes with the user ID and group ID of the web server which is usually "nobody". In this mode, files or directories that you require your php scripts to write to need to have 777 permissions (read/write/execute at user/group/world level). This is not secure because besides allowing the Apache and the PHP application to write to the file it also allows anyone else to read or write to the file if they figure out were to look and want to do so.


    With PHP running in PHPsuexec mode your php scripts now execute with your user ID and group ID. Files or directories that you require your php scripts to write to no longer need to have 777 permissions. In fact, having your scripts or the directories they reside in set to permissions of 777 will cause an "Internal Server Error 500" error when an attempt is made to execute your scripts. In PHPsuexec mode your scripts and directories can have a maximum of 755 permissions (read/write/execute by you, read/execute by everyone else).


    Files and directories will also need to be owned by your user ID and group ID. You probably don't need to worry about this because all files you upload or create will be owned by your user ID and group ID automatically.


    .htaccess File and PHP directives


    When PHP is run as an Apache Module mode you were able to manipulate the PHP settings from within an .htaccess file placed in a PHP script's directory.


    For example you could turn off the PHP setting "magic_quotes_gpc" with this line in .htaccess:


    php_value magic_quotes_gpc off


    With PHP running in PHPsuexec mode manipulating the PHP settings is still possible however it can not be done with the .htaccess file. Using an .htaccess file with php_value entries in it will cause an "Internal Server Error 500" error when attempting to access the scripts. This is because PHP is no longer running as an Apache module and Apache will not handle those directives any longer.


    All PHP configuration settings should be removed from your .htaccess files to avoid the "Internal Server Error 500" error. Creating a php.ini file to manipulate the PHP settings will solve this issue.


    What is a php.ini file and how do I go about making one?


    The php.ini file is a configuration file that PHP looks at to see what options have been set that are different from the default settings that we have configured for the server. While the name may seem advanced to those unfamiliar with it it's simply a text file with the name php.ini


    To create a php.ini file, just open up a text editor, add in the lines you need for the configuration settings you need to change from the default and save the file. You can name the file whatever you wish when saving. Once you are done creating and editing the file, upload the file to the directory where your script is located and then rename it to php.ini


    For example you can turn off the PHP setting "magic_quotes_gpc" with this line in php.ini:


    magic_quotes_gpc = off


    Troubleshooting


    What to do if your PHP script doesn't work or if you receive an error message.


    1. Check that the PHP script that you are attempting to execute has permissions of no more than 755. Permissions set to 644 will work just fine normally, this is not something that will need to be changed in most cases.


    2. Check that the permissions of the directory that the script resides in are set to a maximum of 755. This also includes directories that the script would need to have access to also.


    3. Check that you do not have an .htaccess file with php_values configuration statements in it. If you have an .htaccess file with php_values statements in it it will cause an "Internal Server Error 500" error when attempting to execute the script.


    The php_values statements will need to be removed from your .htaccess file and a php.ini file will need to be put into the directory that the PHP script resides in containing the php directives as explained above.


    4. To run PHP5 applications, you have to define in your .htaccess this line as follows:


    AddHandler application/x-httpd-php5 .php


    This will change the behavior of the webserver to use PHP5 instead of PHP4 to serve your pages.


    5. Standard PHP.ini configuration will have register_globals set as Off, so you will need to set your php.ini to have register_globals=On to have that enabled for your site. That will override the default php.ini configuration with your settings to have your site run properly.


    6. CLI version of PHP4 and PHP5 - cli version of php4 is named as php while the CLI version of php5 is named as php5 to avoid issues of running php in commandline between both versions.


    PHP4 CLI - /usr/bin/php
    PHP5 CLI - /usr/local/bin/php5

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Juillet 2004
    Messages : 54
    Points : 45
    Points
    45
    Par défaut
    Pour recuperer la valeur de ta variable test passée en paramètre de ta page script.php, tu doit l'appeler ainsi :

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2005
    Messages
    184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 184
    Points : 149
    Points
    149
    Par défaut
    Ça fonctionne !

    Merci beaucoup.

    Maintenant j'aimerais savoir si c'est nouveau cette syntaxe obligatoire car il y a deux semaines j'accédais directement aux paramètres en tapant $nomduparam

  4. #4
    Expert éminent sénior

    Profil pro
    Inscrit en
    Juin 2002
    Messages
    6 152
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2002
    Messages : 6 152
    Points : 17 778
    Points
    17 778
    Par défaut
    Le paramètre register_globals est passé de On à Off (cf point 5), par conséquent vous devez spécifier la méthode employée pour accéder aux données externes :
    • Formulaire : $_POST['test']
    • URL : $_GET['test']
    • Sessions : $_SESSION['test']
    • Cookies : $_COOKIE['test']
    • Fichiers uploadés : $_FILES['test']

    Au lieu de $test.

    J'imagine que vous ne voulez pas reprendre l'ensemble de vos scripts et que vous aimeriez revenir en arrière mais là tout dépend de votre hébergeur (ini_set, php.ini, htaccess).

    Edit : Arf, j'ai un train de retard là

  5. #5
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2005
    Messages
    184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 184
    Points : 149
    Points
    149
    Par défaut
    Merci beaucoup à tous. J'adore ce forum

    Dans le message envoyé par notre hébergeur et dont j'ai copié le contenu ci-haut il est mentionné ceci.

    Standard PHP.ini configuration will have register_globals set as Off, so you will need to set your php.ini to have register_globals=On
    Donc si je comprend bien c'est possible de ne pas avoir à modifier tous mes scripts en créant ce fichier ini avec cette instruction ?

  6. #6
    Membre habitué
    Profil pro
    Inscrit en
    Juillet 2005
    Messages
    184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 184
    Points : 149
    Points
    149
    Par défaut
    Voilà, j'ai créé le fichier php.ini contenant "register_globals=On" et mes scripts fonctionnent sans changement .

    Encore une fois merci, problème résolu.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Problème requête paramétrée mysqli
    Par Ethylene dans le forum Installation
    Réponses: 5
    Dernier message: 15/05/2006, 16h57
  2. Problème de paramètres dans mon code javascript
    Par cocacollection dans le forum Général JavaScript
    Réponses: 7
    Dernier message: 15/03/2006, 10h53
  3. [POO] Problème de paramètre passé par référence
    Par dug dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 31/08/2005, 20h29
  4. [JSP] Problème passage paramètre
    Par besco dans le forum Servlets/JSP
    Réponses: 5
    Dernier message: 13/09/2004, 10h15
  5. [SWT] Problème de paramètre GridData
    Par yolepro dans le forum SWT/JFace
    Réponses: 4
    Dernier message: 06/12/2002, 10h37

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo