I have installed PHP Version 5.2.4 under Linux Open SUSE 10.2, with Apache 2.2.6, with the following command:

'./configure' '--prefix=/usr/local/php' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-openssl' '--enable-bcmath' '--enable-calendar' '--with-curl' '--enable-ftp' '--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr' '--with-gettext' '--enable-mbstring' '--enable-mbstr-enc-trans' '--enable-mbregex' '--enable-mcrypt' '--enable-magic-quotes' '--enable-discard-path' '--enable-sockets' '--enable-track-vars' '--enable-gd-native-ttf' '--with-ttf' '--with-xmlrpc' '--with-zlib'

Everything is working fine. In phpinfo(), I see the location of php.ini here:

Configuration File (php.ini) Path: /usr/local/php/lib

But there is not any .ini file there. I tryed to copy the php.ini-recommend there and renamed it to php.ini. After that, PHP has been disabled. Stopping and starting Apache doesn't improve anything. I removed my php.ini from /usr/local/php/lib, and restart Apache. Again everything works fine.
Now can soembody tell me, where is the php.ini file? How can I change values in it?

    Run this from a terminal or SSH:

    <user>@<host>$ updatedb
    <user>@<host>$ locate php.ini

    If that shows up nothing, try /etc/php.ini or /usr/local/php

      Let me explain my problem again. I have compiled my PHP with the following command:

      ./configure --prefix=/usr/local/php --with-apxs2=/usr/local/apache/bin/apxs --with-config-file-path=/usr/local/apache/conf --with-mysql --with-mysqli=/usr/bin/mysql_config --with-openssl --enable-bcmath --enable-calendar --with-curl --enable-ftp --with-gd --with-jpeg-dir=/usr/local --with-png-dir=/usr --with-gettext --enable-mbstring --enable-mbstr-enc-trans --enable-mbregex --enable-mcrypt --enable-magic-quotes --enable-discard-path --enable-sockets --enable-track-vars --enable-gd-native-ttf --with-ttf --with-xmlrpc --with-zlib

      And I don't know why PHP doesn't make php.ini in /usr/local/apache/conf. I am exhausted after 7 times I install Linux, Apache, Mysql and PHP from the scratch:mad:. Please, can anybody help me through this?

      When I create php.ini myself and put it in folder /usr/local/apache/conf, after restarting Apache, phpinfo(); shows nothing. I tried to view the source, and I saw only the source code:

      <?
      phpinfo();
      ?>

      Looks like Apache can't parse PHP files. But after deleting php.ini from /usr/local/apache/conf, everything works fine. Where is this damny php.ini file? If there is not a php.ini file in , how PHP works fine (without the file)?

        Okay, let me reitterate my previous statements:

        Run this from the shell:

        $ updatedb
        $ locate php.ini

        That will give you a list of all php.ini files on your system. Did you do that?

        And to quote the all-knowing manual:

        PHP Manual wrote:

        By default on Unix it should be in /usr/local/lib which is <install-path>/lib. Most people will want to change this at compile-time with the --with-config-file-path flag. You would, for example, set it with something like:

        --with-config-file-path=/etc

        And then you would copy php.ini-dist from the distribution to /etc/php.ini and edit it to make any local changes you want.

        So perhaps the issue is that you may have something wrong with your php.ini which breaks the usage of it. As for what makes it work without php.ini, probably the fact that it might fall back to php.ini-dist or php.ini-recommended if php.ini isn't found in the config-file-path 😉

        Of course, the other thing to do is to utilize your Linux distro's package system to install PHP and Apache and MySQL. If you're using CentOS you could look at atomicrocketturtle.com for a centOS repo (click the SRPMs link on the left side) for php 5.x line with Apache 2.x 😉

          I've run both command, and both of them have received "command not found".
          I am using Open SUSE 10.2, and I don't change anything default of my OS nor Apache, and PHP.
          I have searched the whole computer hard disk via mc, and there is not any php.ini file exist in my computer! can you believe it? There is not any php.ini file, and my PHP still works!
          From where configuration settings loaded?

            Probably from the php.ini-dist

            So you need to copy php.ini-dist to /usr/local/apache/conf (or wherever you defined the php.ini would be), rename it to php.ini, and then configure it. Turn the error level all the way up (E_ALL & E_STRICT or php >= 5 and E_ALL for php < 5). Then go into apache to make sure that there is in fact a couple lines:

            1.a.) The module is loaded (if using a module and not the CGI)
            1.b.) The CGI is actually being called properly
            2.) The .php extension is a known Type (i.e. an AddType or AddHandler for PHP)
            3.) The path to php.ini is defined as your path to php.ini

            If you need help, just paste the httpd.conf here and I'll look it over.

              Hi
              I must add something special here. I tryed to run php at command line, while I have a php.ini file in /usr/local/apache/conf. And it doesn't work! PHP from the command line echos the source code, rather tahn interpret it (like Apache).

              Here is my httpd.conf. And you can find my PHP config command in previous post. As I said before, after compiling PHP, there isn't any php.ini file exists in /usr/local/apache/conf (which I have provided to PHP, in order to generate configuration file). And when I copy php.ini-recommend in /usr/local/apache/conf and rename it to php.ini, Apache stops parsing PHP pages (instead, when you choose view source from your browser, you will see pure PHP codes, which doesn't interpreted).
              I've also appended the error_log and access_log, maybe they help.

                Your httpd.conf is missing a few minor items

                1.) AddType is there (yay!)
                2.) There's no PHPIniDir directive:

                PHPIniDir /usr/local/apache/conf

                3.) LoadModule is there (yay!)

                Okay, so the only thing I see is that PHPIniDir isn't set. Try adding this somewhere to the httpd.conf file (somewhere not in the root of the file, not in a <Directory> or <Location> directive).

                You might also try reworking your httpd.conf to use a check to see if the module loaded like so:

                LoadModule php5_module  modules/libphp5.so
                
                <IfModule php5_module>
                    AddType application/x-httpd-php .php
                    AddType application/x-httpd-php-source .phps
                    PHPIniDir /usr/local/apache/conf
                </IfModule>

                Other than that, I'm out of ideas because I can't see anything wrong. The only other things I can think it could be are:
                1.) The module isn't loading properly
                2.) The mime_module isn't loading when you load PHP

                Sorry I can't be of much more help... but without knowing whether you had the php.ini in the conf directory the last 6 times you restarted the server or the last 6 times you accessed test.php it's difficult to really "debug" your error_log and access_log.

                  21 days later

                  You can't imagine how was it simple! In php.ini-recomended file, short tags are disabled! That's it. When I try to <?php instead of <? (or enable it in php.ini file), PHP works fine.
                  Thank you however for yout time and kindness.

                    Write a Reply...