Mysql.sock error with php

Hi,
I'm trying to get MySQL working on my Mac running OS X 10.5.1
The server runs and I have imported one of my databases into
it. However when I run Dreamweaver and try and add the new database
I get this error in Dreamweaver;
Can't connect to local MySQL server through socket
'/var/mysql/mysql.sock' (38)
Speaking with MySQL they have said that file is found in
/tmp/
I have copied it and added it where DW wants it but still no
joy.

there seems to be a simpler perm fix farther down the page-
It can be much simpler.
sudo cp /etc/php.ini.default /etc/php.ini
sudo chmod 777 /etc/php.ini
Open the file with a nice Editor, like PathFinder or BBEdit.
Find the line for the mysql.default.host
; Default socket name for local MySQL connects. If
empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock
and enter: /tmp/mysql.sock
You will then have:
; Default socket name for local MySQL connects. If
empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock
save it, go back to terminal and enter:
sudo chmod 644 /etc/php.ini
You then can restart Apache and SQL, or do a normal restart.
It should work
afterwards.
Alan
Adobe Community Expert, dreamweaver
http://www.adobe.com/communities/experts/

Similar Messages

  • ORA-12541 error with php

    Hi everybody,
    I'm a Thai web developer, this is my first time for using Orcle.
    Now I run Oracle 10g on WinXP pro and I want to develop PHP web application with Oracle.
    I just set up Oracle and config my iis + php to support Oracle yesterday, Today I try to connect to Orcle it's still error with error ORA-12541: no listener
    I search for solve this problem, I found "starting listener by command-line" via http://www.orafaq.com/faq/Middleware/SQLNet/faq372.htm with lsnrctl start [listener name]
    I can not start my listener with this stuff It's still error
    Message 1070 not found; No message file for product=NETWORK, facility=TNSTNS-125
    57: Message 12557 not found; No message file for product=NETWORK, facility=TNS
    TNS-12560: Message 12560 not found; No message file for product=NETWORK, facili
    ty=TNS
    TNS-00527: Message 527 not found; No message file for product=NETWORK, facilit
    y=TNS
    I run all stuff in my local computer on WinXP (IIS + PHP + Oracle)
    How I solve this error?
    Sorry about my english
    Best regards,
    Sheroku

    Hi,
    Typically when you get "Message xxxx not found: ..." error messages when trying to start the listener, it means that your ORACLE_HOME is not properly set.
    The walkthrough is to set the ORACLE_HOME at envionment level just before using the command, and maybe also as a system environment parameter.C:\>ECHO %ORACLE_HOME%
    %ORACLE_HOME%
    C:\>SET ORACLE_HOME=C:\NOWHERE!
    C:\>ECHO %ORACLE_HOME%
    C:\NOWHERE!
    C:\>lsnrctl start
    LSNRCTL for 32-bit Windows: Version 10.1.0.4.0 - Production on 15-SEP-2005 12:23:45
    Copyright (c) 1991, 2004, Oracle.  All rights reserved.
    Message 1070 not found; No message file for product=NETWORK, facility=TNSTNS-12557: Message 12557 not found; No message file for product=NETWORK, facility=TNS
    TNS-12560: Message 12560 not found; No message file for product=NETWORK, facility=TNS
      TNS-00527: Message 527 not found; No message file for product=NETWORK, facility=TNS
    C:\>SET ORACLE_HOME=C:\oracle\ora10g
    C:\>lsnrctl start
    LSNRCTL for 32-bit Windows: Version 10.1.0.4.0 - Production on 15-SEPT.-2005 12:24:02
    Copyright (c) 1991, 2004, Oracle.  All rights reserved.
    Lancement de tnslsnr: Veuillez patienter...
    TNSLSNR for 32-bit Windows: Version 10.1.0.4.0 - Production
    Le fichier de ...
    La commande a réussi"La commande a réussi" = "Command successful"
    And don't worry about bad English, we don't speak well either.
    Regards,
    Yoann.

  • MySQL syntax error with TestStand 4.0 database logging

    I had been using MS Access database to log results which worked fine but the access database is too limited. Switched to MySql. Database works fine and I can query it from Visual C++ and was able to create all my result tables fine from TestStand.
    I get a syntax error when actually trying to log results and it has to do with either a missing quote or and extra quote, I can't quite tell. I thought I saw a post on this somewhere but can't find it now. Here is the complaint from TestStand:
    An error occurred calling 'LogOneResult' in 'ITSDBLog' of 'zNI TestStand Database Logging'
    An error occurred executing a statement.
    Statement: UUT_RESULT.
    [MySQL][ODBC 3.51 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT VALUES' at line 1
    Description: [MySQL][ODBC 3.51 Driver][mysqld-5.0.45-community-nt]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT VALUES' at line 1
    Number: -2147467259
    NativeError: 1064
    SQLState: 37000
    Reported by: Microsoft OLE DB Provider for ODBC Drivers
    Description: Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.
    Number: -2147217887
    NativeError: 0
    SQLState: 37000
    Reported by: Microsoft OLE DB Provider for ODBC Drivers
    Source: TSDBLog
    And here is all that appears in the MySql logfile:
    INSERT INTO UUT_RESULT DEFAULT VALUES
    070914
    You can't see it here but the string is truncated after the word VALUES. The next line starts with the odd number.
    Any ideas?
    Thanks,
    Bill Peters
    BAE SYSTEMS

    Sure. There were two bugs in the ini file that contains the default TS schemas (I think it was Default_Database_Options.ini or like that...).
    Anyway the table description for STEP_NUMERICLIMIT had for it's command line INSERT INTO MEAS_NUMERICLIMIT. I guess TestStand looked at that and said hmm I better create that table too. Then later down the page when you try to create MEAS_NUMERICLIMIT it says the table already exists even though it is empty. The generate SQL button builds a bad file and then the database viewer creates a bad database. I would have to go into MySql and drop the database. I had to save the schema under a custom name, edit it read it back in, generate a new SQL file, but then it would still fail validation because the ini files don't get updated until you exit TestStand. So basically I did this process 3 times before I got it right.
    It's wasn't a big deal but it's amazing how a little thing can cause a lot of work.
    The second bug, I'm not certain was initially in the file or somehow got set on the fly. There was a random int statement at the very end of the SQL table description for UUT_RESULT. It was also in the schema INI file. Since the int had no name and occurred in a odd place, it created a syntax error in MySql. Same fix as above.
    But like I said it's working great now. I like this approach because I serve it to the net with Apache and parse the database with simple PHP scripts.
    Thanks,
    Bill Peters
    BAE SYSTEMS

  • MySQL date fomat with PHP

    I have a problem with format date stored in mySql db ( in the
    fied named 'dt_news') as dd-mm-yyyy.
    Now when I view my php page where I show all the records, I
    have the following type yyyy/mm/dd.
    Please help me to modify the attached code an have that
    result.

    Add to your code
    <?php
    function mysql2date($date){
    $temp = explode("-",$date);
    $newdate = $temp[2] . "/" . $temp[1] . "/" . $temp[0];
    return $newdate;
    Then instead of:
    <?php echo $row_View_News['dt_news']; ?>
    Use:
    <?php echo mysql2date($row_View_News['dt_news']); ?>
    This will change the mysql date format from YYYY-MM-DD to
    DD/MM/YYYY
    Gareth
    http://www.phploginsuite.co.uk/
    PHP Login Suite V2 - 34 Server Behaviors to build a complete
    Login system.

  • MySQL Sytax error with master and detail pages

    Master and Detail pages.
    I get an SQL error when I click on an Item in the Master
    page.
    “You have an error in your SQL syntax; check the manual
    that corresponds to your MySQL server version for the right syntax
    to use near 'ID = 16 LIMIT 0, 10' at line 1 “
    If I try to open the detail page I get
    “You have an error in your SQL syntax; check the manual
    that corresponds to your MySQL server version for the right syntax
    to use near 'ID = -1 LIMIT 0, 10' at line 1 “
    I created this pair by simply clicking on Insert/data object/
    master detail page.
    I have tried this various ways, but always get the same
    result.
    Is there a bug in CS3?

    Sorry I have solved it myself.
    I had accidentally put a space in a table header in the mySQL
    data bank.
    All works well now.

  • New error with php code

    why below example doesn't work?
    <?php
    $table =" select h.order_number,b.inventory_item_id,b.description item_desc
    from oe_order_headers_all h,
    oe_order_lines_all l,
    mtl_system_items_b b
    where h.header_id = l.header_id
    and l.inventory_item_id = b.inventory_item_id
    and b.organization_id = 85
    AND h.org_id = 85
    and l.org_id = 85
    and to_char(h.ordered_date,'YYYYMMDD') = '20060508'";
    $conn = ocilogon("apps", "apps", "prod");
    $sql="select distinct(item_desc) item_desc from $table";
    $stmt = oci_parse ($conn, $sql);
    oci_execute ($stmt);
    $items=array();
    $result= array();
    $i=0;
    while ($result = oci_fetch_array($stmt,OCI_BOTH)) {
    $items[$i]=$result['ITEM_DESC'];
    echo $result['ITEM_DESC'];
    $i=$i+1;
    //build part of select stateme
    for ($i=0; $i<sizeof($items); $i++) {
    $select_items .= "SUM($items[$i]) $items[$i],";
    for ($i=0; $i<sizeof($items); $i++) {
    $decode_items .= "DECODE(item_desc,'$items[$i]', quantity, null) $items[$i],";
    //final SQL statement
    $sql="SELECT $select_items order_number
    FROM (SELECT $decode_items order_number FROM $table )
    group by order_number";
    $stmt=oci_parse ($conn, $sql);
    oci_execute($stmt);
    echo "<table border=1>";
    echo "<tr>";
    echo "<td>Order Number</td>";
    for ($i=0; $i<sizeof($items); $i++) {
    echo "<td>".$items[$i]."</td>";
    echo "</tr>";
    while ($row = oci_fetch_array ($stmt, OCI_BOTH)) {
    echo "<tr>";
    echo "<td>".$row['ORDER_NUMBER']."</td>";
    for ($i=0; $i<sizeof($items); $i++) {
    echo "<td>".$row[$i]."</td>";
    echo "</tr>";
    echo "</table>";
    ?>

    Hey,
    I'm French so i'll try to explain in my best english.
    I had the same problem. And i solved it.
    In fact i change the dll because the one which php install give us is not compatible.
    I choose the one which is provides with wampserver 2.0i.
    php_oci8_11g.dll
    with instantclient_11_1g
    Next i'll create environnement variables
    NLS_LANG=FRENCH_FRANCE.WE8ISO8859P15
    TNS_ADMIN=d:\oracle
    and in path variable add the way to the instantclient11_1
    D:\oracle\instantclient_11_1
    Then i restart the server and lucky all services start and run perfectly.

  • Error with PHP (can't resolve the connect identifier)

    Hello everybody,
    I have an issue that I hope you can help me with.
    I installed on an OpenSuse the following applications using the guides I found on this web site:
    - Apache 2 HTTP Server
    - PHP 5.2.9
    - Instantclient 11.1
    - Oracle 11g
    After hours of hard work and web navigation looking for information about the problems I got, I'm stucked and I don't find a way to continue.
    When PHP tries to connect to the Database, I get this message:
    Warning: oci_connect() [function.oci-connect]: ORA-12154: TNS:could not resolve the connect identifier specified in [...]
    ORA-12154: TNS:could not resolve the connect identifier specifiedtnsping from a terminal resolves the name successfully, as you can see:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.4.201)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = Blog.coremain.com)))
    OK (0 msec)The problem comes when PHP tries to connect, that's where Oracle doesn't resolve the SID.
    Environment variables ($ORACLE_HOME, $ORACLE_SID, $LD_LIBRARY_PATH) are set as guides say.
    By the way, maybe it's related: I can't either connect with JDeveloper to this database in other PC from the network. The data is correct (user, password, IP, port, SID/Service Name).
    This happens with a Linux O.S. Installing the same stuff on a Windows, PHP and JDeveloper work fine.
    Can you help me, please? I read all the info on the Internet I could get and can't find the solution.
    Tell me if you need me to show you any log or configuration file.
    Regards

    Hi there,
    I agree, I think it's an environment issue, but I don't know how to set it up. Here is the environment section of phpinfo():
    Apache Environment
    Variable     Value
    HTTP_HOST      127.0.0.1
    HTTP_USER_AGENT      Mozilla/5.0 (X11; U; Linux i686; es-ES; rv:1.9.0.8) Gecko/2009032600 SUSE/3.0.8-1.1.1 Firefox/3.0.8
    HTTP_ACCEPT      text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_LANGUAGE      es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
    HTTP_ACCEPT_ENCODING      gzip,deflate
    HTTP_ACCEPT_CHARSET      ISO-8859-1,utf-8;q=0.7,*;q=0.7
    HTTP_KEEP_ALIVE      300
    HTTP_CONNECTION      keep-alive
    HTTP_REFERER      http://127.0.0.1/
    PATH      /usr/sbin:/bin:/usr/bin:/sbin
    SERVER_SIGNATURE      no value
    SERVER_SOFTWARE      Apache/2.2.11 (Unix) PHP/5.2.9
    SERVER_NAME      127.0.0.1
    SERVER_ADDR      127.0.0.1
    SERVER_PORT      80
    REMOTE_ADDR      127.0.0.1
    DOCUMENT_ROOT      /usr/local/apache2/htdocs
    SERVER_ADMIN      [email protected]
    SCRIPT_FILENAME      /usr/local/apache2/htdocs/index.php
    REMOTE_PORT      61677
    GATEWAY_INTERFACE      CGI/1.1
    SERVER_PROTOCOL      HTTP/1.1
    REQUEST_METHOD      GET
    QUERY_STRING      no value
    REQUEST_URI      /index.php
    SCRIPT_NAME      /index.php By the way, I can tnsping only with oracle and root user, with sergio.solis user can't do it: "TNS-03505: Failed to resolve name".
    Thanks for your answer.
    Regards.

  • ERROR#: 2002 can't connect to MySQL server through socket '/var/mysql/mysql.sock'

    I was following this adobe article (
    http://www.adobe.com/devnet/dreamweaver/articles/php_macintosh.html)
    to set up PHP and MySQL and connect a MySQL database to dreamweaver
    in Mac OS 10.4.8 and I kept getting:
    "Can't connect to MySQL server through socket
    '/var/mysql/mysql.sock' ERROR#: 2002".
    After a lot of searching I came across
    this
    article which said that there was an error in the PHP and MySQL
    connection or something.
    Anyway all I had to do was type (in a TERMINAL window):
    $ sudo mkdir /var/mysql
    $ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
    and that fixed the problem, otherwise the adobe article
    worked very well.
    Check out the "this article" link to get the fix straight
    from the horse's mouth.

    I was following this adobe article (
    http://www.adobe.com/devnet/dreamweaver/articles/php_macintosh.html)
    to set up PHP and MySQL and connect a MySQL database to dreamweaver
    in Mac OS 10.4.8 and I kept getting:
    "Can't connect to MySQL server through socket
    '/var/mysql/mysql.sock' ERROR#: 2002".
    After a lot of searching I came across
    this
    article which said that there was an error in the PHP and MySQL
    connection or something.
    Anyway all I had to do was type (in a TERMINAL window):
    $ sudo mkdir /var/mysql
    $ sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock
    and that fixed the problem, otherwise the adobe article
    worked very well.
    Check out the "this article" link to get the fix straight
    from the horse's mouth.

  • MySQL - Another 'Can't connect through mysql.sock' question...

    Hey, folks.
    So I'm trying to install MySQL to run with PHP on my PowerBook G4 (running 10.4.7, non-server edition) to use it to test out a shopping cart program for a website I'm building.
    I had it working as of Monday, when I installed it, got all the permissions set, built the necessary tables, and changed the root password (and logged in just to make sure it worked before retiring for the night)...but today I realized that I had somehow installed the wrong version of MySQL (I connected to it earlier today and discovered it was 4.026 - and I needed to be running MySQL 4.1.20, in order to be running the same version as my webhost).
    So I decided to upgrade. I downloaded and installed the 4.1.20 file, followed the directions about creating the system tables, changed permissions via sudo chown -R mysql:mysql data...and now, when I go to change the root user password (just to make sure it's still the same as it was), I get the following error:
    error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
    Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
    This error also occurs when I try to simply startup MySQL. I also now find I can't connect via MySQL Admin, either - it gives me the same error. Pinging the host works, however.
    Sooo...anyone have any ideas? I've read up on the forums re: Apple changing the socket to /var/mysql/mysql.sock as of 10.4.4, but it seems that would have affected me earlier this week when I was running the previous version of MySQL, too (I certainly haven't upgraded the OS since then).
    Regardless, I can't connect through MySQL Admin using the /var/mysql/mysql.sock socket, anyway...nor the standard /tmp/mysql.sock.
    Any thoughts on what might be causing this? I should confess, I'm well-versed in DOS (ugh), but UNIX is not really my strong suit, so I'm still figuring out how to get around in the Terminal...
    Thanks so much for any input you can give me!
    (Oh, one more thing, since it'll probably come up - I'm not currently connecting via PHP, but I will be eventually. Right now, I just want to be able to change my root password, and login from the Terminal)!
    Thanks again!\
    PowerBook G4 1GHz 15   Mac OS X (10.4.7)  

    Alright, folks.
    Somehow my computer has fixed itself. After wiping the mysql directories entirely, then reinstalling, I was still getting the same error.
    After going back to the original "MySQL-On-Mac" site at Marc Liyanage's entropy.ch site & following some of the instructions there, somehow my problem seems to have fixed itself.
    I wish I could tell you what the solution was (to benefit anyone else having this problem), but since I was simply following the unix commands listed there (without much explanation, at times, as to what they were doing), I just know that somehow it worked.
    (But if I had to make a guess, I think it had to do with starting the server via sudo ./bin/mysqld_safe &)...

  • Mysql error 2002 & missing mysql.sock

    ok, I know this issue is all over the internet, however after reading many posts I have not been able to solve my issue. I hoping someone can help me out. Lets start with the error I get when typing "mysql start" in the terminal:
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/mysql/mysql.sock' (2)
    I have mysql 5.0.51a x86_64 installed on my macbook pro, I used the package installer. I can tell you that the mysql.sock file is nowhere on my machine. It isn't in "private/var/mysql/ or private/tmp".
    I have the php.ini set to look for the socket like this: "mysql.default_socket = /var/mysql/mysql.sock" & "mysqli.default_socket = /var/mysql/mysql.sock"
    I have the my.cnf file set to:
    client (client is contained in square brackets)
    socket = /var/mysql/mysql.sock
    mysqld (mysqld is contained in square brackets)
    socket = /var/mysql/mysql.sock
    I cannot get mysql to start from the mysql preference panel or the terminal. How do I fix this missing socket file issue? Please help me I'm so frustrated by the fact I cannot get this worked out. Thanks in advance!

    http://discussions.apple.com/thread.jspa?messageID=5059320
    http://forums.macosxhints.com/archive/index.php/t-77067.html
    I've seen this before, on Tiger Server, personally. I think the php.ini change was what I did to resolve it. I can't recall for sure.

  • Nginx with php-fpm, connection with php-fpm.sock failed

    I am feeling stumped, trying to setup NGINX for the first time on Arch. Followed the wiki a few times and keep getting hung up in the same spot. I followed the instructions to install NGINX in a chroot, then went on to setup php-fpm. I have not tried setting up any sites, just trying to get to the point of showing the "it works" page, before I moved to setting up a site.
    The error I am getting on the page
    Sorry, the page you are looking for is currently unavailable.
    Please try again later.
    error in log
    2013/03/07 13:04:05 [crit] 1868#0: *1 connect() to unix:/run/php-fpm/php-fpm.sock failed (2: No such file or directory) while connecting to upstream, client: MYIP, server: SERVERIP, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/php-fpm.sock:", host: "SERVERIP"
    SERVERIP: is the IP of the server and shows properly in the log, same with MYIP
    Here are my configs
    /srv/http/etc/nginx.conf
    #user http;
    worker_processes 1;
    #error_log logs/error.log;
    #error_log logs/error.log notice;
    #error_log logs/error.log info;
    #pid logs/nginx.pid;
    events {
    worker_connections 1024;
    http {
    include mime.types;
    default_type application/octet-stream;
    #log_format main '$remote_addr - $remote_user [$time_local] "$request" '
    # '$status $body_bytes_sent "$http_referer" '
    # '"$http_user_agent" "$http_x_forwarded_for"';
    #access_log logs/access.log main;
    sendfile on;
    #tcp_nopush on;
    #keepalive_timeout 0;
    keepalive_timeout 65;
    #gzip on;
    server {
    listen 80;
    server_name SERVERIP;
    include fpm.conf;
    #charset koi8-r;
    #access_log logs/host.access.log main;
    location / {
    root /usr/share/nginx/html;
    index index.html index.htm;
    #error_page 404 /404.html;
    # redirect server error pages to the static page /50x.html
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
    root /usr/share/nginx/html;
    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #location ~ \.php$ {
    # proxy_pass http://127.0.0.1;
    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    #location ~ \.php$ {
    # root html;
    # fastcgi_pass 127.0.0.1:9000;
    # fastcgi_index index.php;
    # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
    # include fastcgi_params;
    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #location ~ /\.ht {
    # deny all;
    # another virtual host using mix of IP-, name-, and port-based configuration
    #server {
    # listen 8000;
    # listen somename:8080;
    # server_name somename alias another.alias;
    # location / {
    # root html;
    # index index.html index.htm;
    # HTTPS server
    #server {
    # listen 443;
    # server_name localhost;
    # ssl on;
    # ssl_certificate cert.pem;
    # ssl_certificate_key cert.key;
    # ssl_session_timeout 5m;
    # ssl_protocols SSLv2 SSLv3 TLSv1;
    # ssl_ciphers HIGH:!aNULL:!MD5;
    # ssl_prefer_server_ciphers on;
    # location / {
    # root html;
    # index index.html index.htm;
    /srv/http/etc/nginx/fpm.conf  - this is the file in the wiki that says php.conf
    location ~ \.(php|html|htm)$ {
    fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    include fastcgi.conf;
    /etc/php/php-fpm.conf
    ; FPM Configuration ;
    ; All relative paths in this configuration file are relative to PHP's install
    ; prefix (/usr). This prefix can be dynamicaly changed by using the
    ; '-p' argument from the command line.
    ; Include one or more files. If glob(3) exists, it is used to include a bunch of
    ; files from a glob(3) pattern. This directive can be used everywhere in the
    ; file.
    ; Relative path can also be used. They will be prefixed by:
    ; - the global prefix if it's been set (-p arguement)
    ; - /usr otherwise
    ;include=/etc/php/fpm.d/*.conf
    ; Global Options ;
    [global]
    ; Pid file
    ; Note: the default prefix is /var
    ; Default Value: none
    pid = /run/php-fpm/php-fpm.pid
    ; Error log file
    ; If it's set to "syslog", log is sent to syslogd instead of being written
    ; in a local file.
    ; Note: the default prefix is /var
    ; Default Value: log/php-fpm.log
    ;error_log = log/php-fpm.log
    ; syslog_facility is used to specify what type of program is logging the
    ; message. This lets syslogd specify that messages from different facilities
    ; will be handled differently.
    ; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
    ; Default Value: daemon
    ;syslog.facility = daemon
    ; syslog_ident is prepended to every message. If you have multiple FPM
    ; instances running on the same server, you can change the default value
    ; which must suit common needs.
    ; Default Value: php-fpm
    ;syslog.ident = php-fpm
    ; Log level
    ; Possible Values: alert, error, warning, notice, debug
    ; Default Value: notice
    ;log_level = notice
    ; If this number of child processes exit with SIGSEGV or SIGBUS within the time
    ; interval set by emergency_restart_interval then FPM will restart. A value
    ; of '0' means 'Off'.
    ; Default Value: 0
    ;emergency_restart_threshold = 0
    ; Interval of time used by emergency_restart_interval to determine when
    ; a graceful restart will be initiated. This can be useful to work around
    ; accidental corruptions in an accelerator's shared memory.
    ; Available Units: s(econds), m(inutes), h(ours), or d(ays)
    ; Default Unit: seconds
    ; Default Value: 0
    ;emergency_restart_interval = 0
    ; Time limit for child processes to wait for a reaction on signals from master.
    ; Available units: s(econds), m(inutes), h(ours), or d(ays)
    ; Default Unit: seconds
    ; Default Value: 0
    ;process_control_timeout = 0
    ; The maximum number of processes FPM will fork. This has been design to control
    ; the global number of processes when using dynamic PM within a lot of pools.
    ; Use it with caution.
    ; Note: A value of 0 indicates no limit
    ; Default Value: 0
    ; process.max = 128
    ; Specify the nice(2) priority to apply to the master process (only if set)
    ; The value can vary from -19 (highest priority) to 20 (lower priority)
    ; Note: - It will only work if the FPM master process is launched as root
    ; - The pool process will inherit the master process priority
    ; unless it specified otherwise
    ; Default Value: no set
    ; process.priority = -19
    ; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
    ; Default Value: yes
    ;daemonize = yes
    ; Set open file descriptor rlimit for the master process.
    ; Default Value: system defined value
    ;rlimit_files = 1024
    ; Set max core size rlimit for the master process.
    ; Possible Values: 'unlimited' or an integer greater or equal to 0
    ; Default Value: system defined value
    ;rlimit_core = 0
    ; Specify the event mechanism FPM will use. The following is available:
    ; - select (any POSIX os)
    ; - poll (any POSIX os)
    ; - epoll (linux >= 2.5.44)
    ; - kqueue (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
    ; - /dev/poll (Solaris >= 7)
    ; - port (Solaris >= 10)
    ; Default Value: not set (auto detection)
    ; events.mechanism = epoll
    ; Pool Definitions ;
    ; Multiple pools of child processes may be started with different listening
    ; ports and different management options. The name of the pool will be
    ; used in logs and stats. There is no limitation on the number of pools which
    ; FPM can handle. Your system will tell you anyway :)
    ; Start a new pool named 'www'.
    ; the variable $pool can we used in any directive and will be replaced by the
    ; pool name ('www' here)
    [www]
    ; Per pool prefix
    ; It only applies on the following directives:
    ; - 'slowlog'
    ; - 'listen' (unixsocket)
    ; - 'chroot'
    ; - 'chdir'
    ; - 'php_values'
    ; - 'php_admin_values'
    ; When not set, the global prefix (or /usr) applies instead.
    ; Note: This directive can also be relative to the global prefix.
    ; Default Value: none
    ;prefix = /path/to/pools/$pool
    ; Unix user/group of processes
    ; Note: The user is mandatory. If the group is not set, the default user's group
    ; will be used.
    user = http
    group = http
    ; The address on which to accept FastCGI requests.
    ; Valid syntaxes are:
    ; 'ip.add.re.ss:port' - to listen on a TCP socket to a specific address on
    ; a specific port;
    ; 'port' - to listen on a TCP socket to all addresses on a
    ; specific port;
    ; '/path/to/unix/socket' - to listen on a unix socket.
    ; Note: This value is mandatory.
    ;listen = 127.0.0.1:9000
    listen = /run/php-fpm/php-fpm.sock
    ; Set listen(2) backlog.
    ; Default Value: 128 (-1 on FreeBSD and OpenBSD)
    ;listen.backlog = 128
    ; Set permissions for unix socket, if one is used. In Linux, read/write
    ; permissions must be set in order to allow connections from a web server. Many
    ; BSD-derived systems allow connections regardless of permissions.
    ; Default Values: user and group are set as the running user
    ; mode is set to 0666
    listen.owner = http
    listen.group = http
    listen.mode = 0666
    ; List of ipv4 addresses of FastCGI clients which are allowed to connect.
    ; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
    ; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
    ; must be separated by a comma. If this value is left blank, connections will be
    ; accepted from any ip address.
    ; Default Value: any
    ;listen.allowed_clients = 127.0.0.1
    ; Specify the nice(2) priority to apply to the pool processes (only if set)
    ; The value can vary from -19 (highest priority) to 20 (lower priority)
    ; Note: - It will only work if the FPM master process is launched as root
    ; - The pool processes will inherit the master process priority
    ; unless it specified otherwise
    ; Default Value: no set
    ; priority = -19
    ; Choose how the process manager will control the number of child processes.
    ; Possible Values:
    ; static - a fixed number (pm.max_children) of child processes;
    ; dynamic - the number of child processes are set dynamically based on the
    ; following directives. With this process management, there will be
    ; always at least 1 children.
    ; pm.max_children - the maximum number of children that can
    ; be alive at the same time.
    ; pm.start_servers - the number of children created on startup.
    ; pm.min_spare_servers - the minimum number of children in 'idle'
    ; state (waiting to process). If the number
    ; of 'idle' processes is less than this
    ; number then some children will be created.
    ; pm.max_spare_servers - the maximum number of children in 'idle'
    ; state (waiting to process). If the number
    ; of 'idle' processes is greater than this
    ; number then some children will be killed.
    ; ondemand - no children are created at startup. Children will be forked when
    ; new requests will connect. The following parameter are used:
    ; pm.max_children - the maximum number of children that
    ; can be alive at the same time.
    ; pm.process_idle_timeout - The number of seconds after which
    ; an idle process will be killed.
    ; Note: This value is mandatory.
    pm = dynamic
    ; The number of child processes to be created when pm is set to 'static' and the
    ; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
    ; This value sets the limit on the number of simultaneous requests that will be
    ; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
    ; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
    ; CGI. The below defaults are based on a server without much resources. Don't
    ; forget to tweak pm.* to fit your needs.
    ; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
    ; Note: This value is mandatory.
    pm.max_children = 5
    ; The number of child processes created on startup.
    ; Note: Used only when pm is set to 'dynamic'
    ; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
    pm.start_servers = 2
    ; The desired minimum number of idle server processes.
    ; Note: Used only when pm is set to 'dynamic'
    ; Note: Mandatory when pm is set to 'dynamic'
    pm.min_spare_servers = 1
    ; The desired maximum number of idle server processes.
    ; Note: Used only when pm is set to 'dynamic'
    ; Note: Mandatory when pm is set to 'dynamic'
    pm.max_spare_servers = 3
    ; The number of seconds after which an idle process will be killed.
    ; Note: Used only when pm is set to 'ondemand'
    ; Default Value: 10s
    ;pm.process_idle_timeout = 10s;
    ; The number of requests each child process should execute before respawning.
    ; This can be useful to work around memory leaks in 3rd party libraries. For
    ; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
    ; Default Value: 0
    ;pm.max_requests = 500
    ; The URI to view the FPM status page. If this value is not set, no URI will be
    ; recognized as a status page. It shows the following informations:
    ; pool - the name of the pool;
    ; process manager - static, dynamic or ondemand;
    ; start time - the date and time FPM has started;
    ; start since - number of seconds since FPM has started;
    ; accepted conn - the number of request accepted by the pool;
    ; listen queue - the number of request in the queue of pending
    ; connections (see backlog in listen(2));
    ; max listen queue - the maximum number of requests in the queue
    ; of pending connections since FPM has started;
    ; listen queue len - the size of the socket queue of pending connections;
    ; idle processes - the number of idle processes;
    ; active processes - the number of active processes;
    ; total processes - the number of idle + active processes;
    ; max active processes - the maximum number of active processes since FPM
    ; has started;
    ; max children reached - number of times, the process limit has been reached,
    ; when pm tries to start more children (works only for
    ; pm 'dynamic' and 'ondemand');
    ; Value are updated in real time.
    ; Example output:
    ; pool: www
    ; process manager: static
    ; start time: 01/Jul/2011:17:53:49 +0200
    ; start since: 62636
    ; accepted conn: 190460
    ; listen queue: 0
    ; max listen queue: 1
    ; listen queue len: 42
    ; idle processes: 4
    ; active processes: 11
    ; total processes: 15
    ; max active processes: 12
    ; max children reached: 0
    ; By default the status page output is formatted as text/plain. Passing either
    ; 'html', 'xml' or 'json' in the query string will return the corresponding
    ; output syntax. Example:
    ; http://www.foo.bar/status
    ; http://www.foo.bar/status?json
    ; http://www.foo.bar/status?html
    ; http://www.foo.bar/status?xml
    ; By default the status page only outputs short status. Passing 'full' in the
    ; query string will also return status for each pool process.
    ; Example:
    ; http://www.foo.bar/status?full
    ; http://www.foo.bar/status?json&full
    ; http://www.foo.bar/status?html&full
    ; http://www.foo.bar/status?xml&full
    ; The Full status returns for each process:
    ; pid - the PID of the process;
    ; state - the state of the process (Idle, Running, ...);
    ; start time - the date and time the process has started;
    ; start since - the number of seconds since the process has started;
    ; requests - the number of requests the process has served;
    ; request duration - the duration in µs of the requests;
    ; request method - the request method (GET, POST, ...);
    ; request URI - the request URI with the query string;
    ; content length - the content length of the request (only with POST);
    ; user - the user (PHP_AUTH_USER) (or '-' if not set);
    ; script - the main script called (or '-' if not set);
    ; last request cpu - the %cpu the last request consumed
    ; it's always 0 if the process is not in Idle state
    ; because CPU calculation is done when the request
    ; processing has terminated;
    ; last request memory - the max amount of memory the last request consumed
    ; it's always 0 if the process is not in Idle state
    ; because memory calculation is done when the request
    ; processing has terminated;
    ; If the process is in Idle state, then informations are related to the
    ; last request the process has served. Otherwise informations are related to
    ; the current request being served.
    ; Example output:
    ; pid: 31330
    ; state: Running
    ; start time: 01/Jul/2011:17:53:49 +0200
    ; start since: 63087
    ; requests: 12808
    ; request duration: 1250261
    ; request method: GET
    ; request URI: /test_mem.php?N=10000
    ; content length: 0
    ; user: -
    ; script: /home/fat/web/docs/php/test_mem.php
    ; last request cpu: 0.00
    ; last request memory: 0
    ; Note: There is a real-time FPM status monitoring sample web page available
    ; It's available in: ${prefix}/share/fpm/status.html
    ; Note: The value must start with a leading slash (/). The value can be
    ; anything, but it may not be a good idea to use the .php extension or it
    ; may conflict with a real PHP file.
    ; Default Value: not set
    ;pm.status_path = /status
    ; The ping URI to call the monitoring page of FPM. If this value is not set, no
    ; URI will be recognized as a ping page. This could be used to test from outside
    ; that FPM is alive and responding, or to
    ; - create a graph of FPM availability (rrd or such);
    ; - remove a server from a group if it is not responding (load balancing);
    ; - trigger alerts for the operating team (24/7).
    ; Note: The value must start with a leading slash (/). The value can be
    ; anything, but it may not be a good idea to use the .php extension or it
    ; may conflict with a real PHP file.
    ; Default Value: not set
    ;ping.path = /ping
    ; This directive may be used to customize the response of a ping request. The
    ; response is formatted as text/plain with a 200 response code.
    ; Default Value: pong
    ;ping.response = pong
    ; The access log file
    ; Default: not set
    ;access.log = log/$pool.access.log
    ; The access log format.
    ; The following syntax is allowed
    ; %%: the '%' character
    ; %C: %CPU used by the request
    ; it can accept the following format:
    ; - %{user}C for user CPU only
    ; - %{system}C for system CPU only
    ; - %{total}C for user + system CPU (default)
    ; %d: time taken to serve the request
    ; it can accept the following format:
    ; - %{seconds}d (default)
    ; - %{miliseconds}d
    ; - %{mili}d
    ; - %{microseconds}d
    ; - %{micro}d
    ; %e: an environment variable (same as $_ENV or $_SERVER)
    ; it must be associated with embraces to specify the name of the env
    ; variable. Some exemples:
    ; - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
    ; - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
    ; %f: script filename
    ; %l: content-length of the request (for POST request only)
    ; %m: request method
    ; %M: peak of memory allocated by PHP
    ; it can accept the following format:
    ; - %{bytes}M (default)
    ; - %{kilobytes}M
    ; - %{kilo}M
    ; - %{megabytes}M
    ; - %{mega}M
    ; %n: pool name
    ; %o: ouput header
    ; it must be associated with embraces to specify the name of the header:
    ; - %{Content-Type}o
    ; - %{X-Powered-By}o
    ; - %{Transfert-Encoding}o
    ; %p: PID of the child that serviced the request
    ; %P: PID of the parent of the child that serviced the request
    ; %q: the query string
    ; %Q: the '?' character if query string exists
    ; %r: the request URI (without the query string, see %q and %Q)
    ; %R: remote IP address
    ; %s: status (response code)
    ; %t: server time the request was received
    ; it can accept a strftime(3) format:
    ; %d/%b/%Y:%H:%M:%S %z (default)
    ; %T: time the log has been written (the request has finished)
    ; it can accept a strftime(3) format:
    ; %d/%b/%Y:%H:%M:%S %z (default)
    ; %u: remote user
    ; Default: "%R - %u %t \"%m %r\" %s"
    ;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
    ; The log file for slow requests
    ; Default Value: not set
    ; Note: slowlog is mandatory if request_slowlog_timeout is set
    ;slowlog = log/$pool.log.slow
    ; The timeout for serving a single request after which a PHP backtrace will be
    ; dumped to the 'slowlog' file. A value of '0s' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_slowlog_timeout = 0
    ; The timeout for serving a single request after which the worker process will
    ; be killed. This option should be used when the 'max_execution_time' ini option
    ; does not stop script execution for some reason. A value of '0' means 'off'.
    ; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
    ; Default Value: 0
    ;request_terminate_timeout = 0
    ; Set open file descriptor rlimit.
    ; Default Value: system defined value
    ;rlimit_files = 1024
    ; Set max core size rlimit.
    ; Possible Values: 'unlimited' or an integer greater or equal to 0
    ; Default Value: system defined value
    ;rlimit_core = 0
    ; Chroot to this directory at the start. This value must be defined as an
    ; absolute path. When this value is not set, chroot is not used.
    ; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
    ; of its subdirectories. If the pool prefix is not set, the global prefix
    ; will be used instead.
    ; Note: chrooting is a great security feature and should be used whenever
    ; possible. However, all PHP paths will be relative to the chroot
    ; (error_log, sessions.save_path, ...).
    ; Default Value: not set
    ;chroot =
    ; Chdir to this directory at the start.
    ; Note: relative path can be used.
    ; Default Value: current directory or / when chroot
    ;chdir = /srv/http
    ; Redirect worker stdout and stderr into main error log. If not set, stdout and
    ; stderr will be redirected to /dev/null according to FastCGI specs.
    ; Note: on highloaded environement, this can cause some delay in the page
    ; process time (several ms).
    ; Default Value: no
    ;catch_workers_output = yes
    ; Limits the extensions of the main script FPM will allow to parse. This can
    ; prevent configuration mistakes on the web server side. You should only limit
    ; FPM to .php extensions to prevent malicious users to use other extensions to
    ; exectute php code.
    ; Note: set an empty value to allow all extensions.
    ; Default Value: .php
    ;security.limit_extensions = .php .php3 .php4 .php5
    security.limit_extensions = .php .html
    ; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
    ; the current environment.
    ; Default Value: clean env
    ;env[HOSTNAME] = $HOSTNAME
    ;env[PATH] = /usr/local/bin:/usr/bin:/bin
    ;env[TMP] = /tmp
    ;env[TMPDIR] = /tmp
    ;env[TEMP] = /tmp
    ; Additional php.ini defines, specific to this pool of workers. These settings
    ; overwrite the values previously defined in the php.ini. The directives are the
    ; same as the PHP SAPI:
    ; php_value/php_flag - you can set classic ini defines which can
    ; be overwritten from PHP call 'ini_set'.
    ; php_admin_value/php_admin_flag - these directives won't be overwritten by
    ; PHP call 'ini_set'
    ; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
    ; Defining 'extension' will load the corresponding shared extension from
    ; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
    ; overwrite previously defined php.ini values, but will append the new value
    ; instead.
    ; Note: path INI options can be relative and will be expanded with the prefix
    ; (pool, global or /usr)
    ; Default Value: nothing is defined by default except the values in php.ini and
    ; specified at startup with the -d argument
    ;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f [email protected]
    ;php_flag[display_errors] = off
    ;php_admin_value[error_log] = /var/log/fpm-php.www.log
    ;php_admin_flag[log_errors] = on
    ;php_admin_value[memory_limit] = 32M
    In php-fpm.conf I have modified the permissions to be 0666 and I am still hitting the no such file or directory. But it is created.
    ls -la /run/php-fpm/
    total 4
    drwxr-xr-x 2 root root 80 Mar 7 13:05 .
    drwxr-xr-x 17 root root 520 Mar 7 10:59 ..
    -rw-r--r-- 1 root root 4 Mar 7 13:05 php-fpm.pid
    srw-rw-rw- 1 http http 0 Mar 7 13:05 php-fpm.sock
    Not getting what I am missing here, can someone help shed some light or smack me in the correct direction. Thanks.
    edit:
    Also verified that it is for sure running in the chroot
    ps -C nginx | awk '{print $1}' | sed 1d | while read -r PID; do ls -l /proc/$PID/root; done
    lrwxrwxrwx 1 root root 0 Mar 7 14:06 /proc/313/root -> /srv/http
    lrwxrwxrwx 1 http http 0 Mar 7 14:06 /proc/314/root -> /srv/http
    edit2:
    I just rebooted the box and was going over everything again to see if I missed anything or anything was not matching the wiki and the only extra info I could dig out of my box was new error in the logs relating to the nginx.pid
    2013/03/07 18:10:41 [notice] 411#0: signal process started
    2013/03/07 18:10:41 [alert] 387#0: unlink() "/run/nginx.pid" failed (13: Permission denied)
    ls -la /srv/http/run/
    total 12
    drwxr-xr-x 2 root root 4096 Mar 7 14:02 .
    d--x--x--x 9 root root 4096 Mar 7 11:07 ..
    -rw-r--r-- 1 http http 4 Mar 7 18:12 nginx.pid
    It appears to have the proper permissions and it is not in /run/
    ls -la /run/nginx.pid
    ls: cannot access /run/nginx.pid: No such file or directory
    Going to try setting it up again on another box to see if I catch what I did wrong on this one, but will be leaving this one as is to make sure I figure out what happened. Is it that my chroot is bad? That is really the only thing I can think of that is really any different than other NGINX installs I have done, which have always been on a Debian based system.
    Last edited by vwyodajl (2013-03-07 18:24:55)

    Might sound stupid, but do you have php-fpm running?
    Means, is there a php-fpm process on your box, and does the socket exist like in:
    └» ps -ef|grep php-fpm
    root 3045 1 0 Mär04 ? 00:00:09 php-fpm: master process (/etc/php/php-fpm.conf)
    http 13534 3045 0 18:22 ? 00:00:10 php-fpm: pool www
    http 13545 3045 0 18:22 ? 00:00:08 php-fpm: pool www
    http 22807 3045 0 19:46 ? 00:00:01 php-fpm: pool www
    tom 27863 28055 0 20:16 pts/1 00:00:00 grep --colour=auto php-fpm
    └» ls -l /run/php-fpm/php-fpm.sock
    srw-rw---- 1 http http 0 4. Mär 22:24 /run/php-fpm/php-fpm.sock
    EDIT: somehow missed your output regarding the php-fpm socket. Ignore above then, I have no idea about chroot, I use LXC.
    Last edited by teekay (2013-03-07 19:24:04)

  • Can't get php mysql to work with DW CC2014

    Even though I opened the WAMP server first and can see my database it will not connect to DW.
    The error is:
    MySQL Error#: 2002
    Can't connect to local MySQL server through socket
    '/var/lib/mysql/mysql.sock'2
    Have attempted to follow instructions in Adobe support pages but it doesn't deal with this.
    I am using Windows 8.1 and Internet Explorer.
    All I am trying to do is create a Registration page for now.  If I can connect I then hope to move on to Log In, etc. Please help!

    Yes, I did that first, nowhere does it deal with errors and how to correct them.
    I started over again numerous times following step by step on several YouTube vids trying to see what I might be misconstruing.
    However, I am still stuck and cannot move forward until I can connect. Or can I? I don’t even know that for sure.
    Regards,
    Chris
    Chris Bukovac, CEO Conquering Computers
    8834 E. Jumping Cholla Dr. Gold Canyon, AZ 85118
    Office: 480.474.8037  Mobile: 480.577.4309
    <mailto:[email protected]> [email protected]
    www.conqueringcomputers.com
    "I'll have you conquering computers in no time!"
    <https://www.facebook.com/pages/Conquering-Computers/131230543569597> Click to Like!     <http://www.linkedin.com/profile/edit?goback=%2Enmp_1_1_1_1_1_1_1_1_*1&trk=spm_pic>  LinkedIn   <https://twitter.com/ChrisBukovac1>  Follow us on Twitter!

  • Inserting special character like apostrophes with PHP/Mysql

    Hi friends,
    I have a problem with php/mysql. I have created a form inton a php page with dreamweaver and when i try to fill the form with a string containing apostrophe ( ' ), i have a error. It seems that the insertion is not possible. Could you have any idea for that. I give you the php dreamweaver code and thank you for your help.
    <?php require_once('Connections/Mainconnect.php'); ?>
    <?php require_once('Zend/Date.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
    if ($theValue=="")
        $theValue="NULL";
    else
        $zendDate=new Zend_Date($theValue,"dd/MM/yyyy");
        $theValue="'".$zendDate->toString("yyyy-MM-dd")."'";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
      $updateSQL = sprintf("UPDATE pers_soc_reg SET field1=%s, field2=%s,
                           GetSQLValueString($_POST['field1'], "text"),
                           GetSQLValueString($_POST['field2'], "double"));

    "Normally, you canot use mysql_real_escape_string without connection to database"
    That is not true at all. Try running the following script.
    <?php
    if ($_POST['submit']){
    $x1=$_POST['test1'];
    foreach ($_POST as $key => $value) {
    if (!is_array($value)){
    $_POST[$key] = mysql_real_escape_string($value);
    extract($_POST);
    echo "The text after 'becomes' should be escaped (\')<br/>";
    echo "$x1 becomes $test1<br/>";
    ?>
    <hr/>
      <form action="#" method="post" />
    Enter some text, including an apostrophe: <input name="test1" type="text"><br/>
        <p><input name="submit" value="submit" type="submit"/>
      </form>

  • I can't connect to MySQL getting Error #2002 after I updated php

    I'm on a mac and I updated my version of PHP and installed the GD library.
    The problem is that I needed up date my connection to the database or something to that affect so I ran this command line:
    sudo mkdir /var/mysql
    sudo ln -s /private/tmp/mysql.sock /var/mysql/mysql.sock
    And it worked... but then I restarted my computer and now I can't connect and I'm getting the error I had of...
    #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
    So I tried the above two lines of code and it said those files/directory exist.
    I went into /etc/php.ini file to change this mysql.default_socket = /var/mysql/mysql.sock
    So what do I need to do here to change this permanently?

    Post Unix queries to the Unix forum under OS X Technologies.

  • Problems with mysql after update to php 5.3

    Hi everyone,
    I know I am not the only one having trouble with that upgrade but so far I still have some issues.
    I have read the news about the update and the wiki. I use apache, php, mysql and phpmyadmin.
    After the update, I installed php-apache, php-mcrypt and used php.ini.pacnew to do my new configuration.
    Everything works fine except mysql.
    I have a weird problem that is that I can access and do whatever I want to databases with phpmyadmin but as soon as I try to connect to the mysql database with php code then my browser tells me that the page can't be loaded and that "the connection terminated unexpectedly". What is the problem ? Am I the only one in this situation ?
    Thanks for your time !

    Here it is, that's the error log of httpd:
    [Sun Sep 27 17:25:07 2009] [notice] child pid 2006 exit signal Segmentation fault (11)
    [Sun Sep 27 19:40:32 2009] [error] [client 127.0.0.1] File does not exist: /srv/http/favicon.ico
    [Sun Sep 27 19:40:36 2009] [error] [client 127.0.0.1] File does not exist: /srv/http/favicon.ico
    [Sun Sep 27 19:40:37 2009] [error] [client 127.0.0.1] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/yms/projects/homepage/yms/index.php on line 60, referer: http://localhost/~yms/
    [Sun Sep 27 19:40:37 2009] [error] [client 127.0.0.1] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/yms/projects/homepage/yms/index.php on line 73, referer: http://localhost/~yms/
    [Sun Sep 27 19:40:37 2009] [error] [client 127.0.0.1] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/yms/projects/homepage/yms/index.php on line 60, referer: http://localhost/~yms/
    [Sun Sep 27 19:40:37 2009] [error] [client 127.0.0.1] PHP Warning:  date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead in /home/yms/projects/homepage/yms/index.php on line 73, referer: http://localhost/~yms/
    [Sun Sep 27 19:40:37 2009] [error] [client 127.0.0.1] File does not exist: /srv/http/favicon.ico
    [Sun Sep 27 19:40:38 2009] [notice] child pid 2003 exit signal Segmentation fault (11)
    [Sun Sep 27 19:40:38 2009] [notice] child pid 2577 exit signal Segmentation fault (11)
    And that's the access log in case it is useful:
    127.0.0.1 - - [27/Sep/2009:19:40:32 +0200] "GET / HTTP/1.1" 200 788
    127.0.0.1 - - [27/Sep/2009:19:40:32 +0200] "GET /favicon.ico HTTP/1.1" 404 1085
    127.0.0.1 - - [27/Sep/2009:19:40:32 +0200] "GET /icons/blank.gif HTTP/1.1" 200 148
    127.0.0.1 - - [27/Sep/2009:19:40:32 +0200] "GET /icons/folder.gif HTTP/1.1" 200 225
    127.0.0.1 - - [27/Sep/2009:19:40:36 +0200] "GET /~yms HTTP/1.1" 301 368
    127.0.0.1 - - [27/Sep/2009:19:40:36 +0200] "GET /~yms/ HTTP/1.1" 200 1150
    127.0.0.1 - - [27/Sep/2009:19:40:36 +0200] "GET /favicon.ico HTTP/1.1" 404 1085
    127.0.0.1 - - [27/Sep/2009:19:40:36 +0200] "GET /icons/back.gif HTTP/1.1" 200 216
    127.0.0.1 - - [27/Sep/2009:19:40:37 +0200] "GET /favicon.ico HTTP/1.1" 404 1085
    And thanks for trying to help me ;-)

Maybe you are looking for