How do I find out what php version my imac is running?

Discussion in 'Web Design and Development' started by tech0925, Mar 2, 2011.

  1. tech0925 macrumors member

    tech0925

    Joined:
    Sep 4, 2009
    #1
    Well the title says it all. The reason I ask is b/c I am studying PHP via a text book for PHP 5.0.. I am using text wrangler as my editor. I noticed that when I plug in some codes from the book I get errors like this:

    Notice: Undefined index: add in /Library/WebServer/Documents/test/untitled.php on line 35

    Notice: Undefined index: update in /Library/WebServer/Documents/test/untitled.php on line 49

    Notice: Undefined index: clear in /Library/WebServer/Documents/test/untitled.php on line 65


    However, when I upload it to my hosting account via Just Host's cpanel, I do not get the errors. I know Just Host's current PHP version installed on the server is 5.2.14. I am assuming I must be running something older on my mac. Any help with this and how to ugrade it to the latest version would be great. I have an iMac that is only about 1 1/2 years old. Currently running version 10.5.8. Figured I needed to note that. Thanks
     
  2. dmmcintyre3 macrumors 68020

    Joined:
    Mar 4, 2007
    #2
    create a file with .php extension with:

    <?php phpinfo(); ?>

    in it.
     
  3. tech0925 thread starter macrumors member

    tech0925

    Joined:
    Sep 4, 2009
    #3
    Thank You!

    Now I am confused :confused:! It is running the same PHP version.

    PHP Version 5.2.14

    System Darwin 71-8-19-186.dhcp.leds.al.charter.com 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
    Build Date Oct 6 2010 16:55:34
    Configure Command '/SourceCache/apache_mod_php/apache_mod_php-44.6/php/configure' '--prefix=/usr' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--disable-dependency-tracking' '--with-apxs2=/usr/sbin/apxs' '--with-ldap=/usr' '--with-kerberos=/usr' '--enable-cli' '--with-zlib-dir=/usr' '--enable-trans-sid' '--with-xml' '--enable-exif' '--enable-ftp' '--enable-mbstring' '--enable-mbregex' '--enable-dbx' '--enable-sockets' '--with-iodbc=/usr' '--with-curl=/usr' '--with-config-file-path=/etc' '--sysconfdir=/private/etc' '--with-mysql-sock=/var/mysql' '--with-mysqli=/usr/bin/mysql_config' '--with-mysql=/usr' '--with-openssl' '--with-xmlrpc' '--with-xsl=/usr' '--without-pear'
    Server API Apache 2.0 Handler
    Virtual Directory Support disabled
    Configuration File (php.ini) Path /etc
    Loaded Configuration File /private/etc/php.ini
    Scan this dir for additional .ini files (none)
    additional .ini files parsed (none)
    PHP API 20041225
    PHP Extension 20060613
    Zend Extension 220060519
    Debug Build no
    Thread Safety disabled
    Zend Memory Manager enabled
    IPv6 Support enabled
    Registered PHP Streams https, ftps, compress.zlib, php, file, data, http, ftp
    Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
    Registered Stream Filters zlib.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed

    Zend logo This program makes use of the Zend Scripting Language Engine:
    Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies


    Why would I get the errors then? Do you see anything here causing it? Also, please let me know if there is any info here that I should not be sharing with others. LOL
     

    Attached Files:

  4. designguy79 macrumors 6502

    Joined:
    Sep 24, 2009
    Location:
    Michigan
    #4
  5. Cabbit macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #5
    These are not errors there warnings. What it is telling you is the variables add, update, and clear are empty. This is due to them not being used, though you may be using them at a later stage when your developing.

    Your host will be set up not to show warnings, the best way to get around this on your local machine is to define the variable as null.

    PHP:
    $create NULL;
     
  6. Darth.Titan macrumors 68030

    Darth.Titan

    Joined:
    Oct 31, 2007
    Location:
    Austin, TX
    #6
    Put that same
    Code:
    <?php phpinfo(); ?>
    file on your host, and check what your host's error_reporting value is set to. Change the php.ini file on your Mac to match then restart Apache.
     
  7. tech0925 thread starter macrumors member

    tech0925

    Joined:
    Sep 4, 2009
  8. Cabbit macrumors 68020

    Cabbit

    Joined:
    Jan 30, 2006
    Location:
    Scotland
    #8
    This is not really the best advice, you do want to be developing with all errors on show in order to debug code.
     
  9. tech0925 thread starter macrumors member

    tech0925

    Joined:
    Sep 4, 2009
    #9
    Thanks, I have my side set to show errors. It makes more since to me. Like you said, that way you can figure out what problems you have and if the script stops.
     

Share This Page