RegEx PHP?
I'm validating a form with PHP RegEx name field.
Allowed characters: a - z A - Z, spaces, apostrophe (single quotation mark), hyphen.
I even tried to escape from the apostrophe, but it still does not work.
What Miss me?
If (! preg_match (' / ^ [a-zA-Z '-] + $/ ', $name)) {}
$errName = "only a' - z A - Z -"authorized;
}
Nancy O.
Nancy,
The script allows no foreign characters. (I tried with the Vietnamese, who looks like Latin, but with lots of accents)
One reason I like AOP is because, when you use-related settings, you do not have to worry of apostrophes and quotation marks spoil the query. I think not muSQLi related parameters (but I could be wrong).
The problem with foreign characters is the regular expression. I think you are fine with FILTER_SANITIZE_STRING. (However, there are options for SANITIZE_STRING to deal with encoding HIGH and LOW.)
Tags: Dreamweaver
Similar Questions
-
Hello
I need to replace my < div > tags to the tag < TEXT >, but I'm very bad at regex...
I am tring with that
< div % [^ >] * >(.*?) < /%div% >
but it does not work, what can I do, to change < div align = "left" > my text < / div > to < TEXT align = left "> my text < / TEXT >"
Thank you
Pluda
You say PHP regex in the subject line, so I wrote for PHP. It is slightly different if you use find and replace in Dreamweaver.
$text = <<
Content for id "div1" Goes Here
Display variable email PHP form
Hi all, another one!
I want the email address to be hidden in the form below - variable variables highlighted in red. What do I put for "$to ="?
Any help would be appreciated.
Tom
<? PHP
If (array_key_exists ('Send', $_POST)) {}
mail processing script
Remove characters from exhaust AFTER table
If (via PHP_VERSION < 6 & & get_magic_quotes_gpc()) {}
function stripslashes_deep ($value) {}
$value = is_array ($value)? array_map ('stripslashes_deep', $value): stripslashes ($value);
return $value;
}
$_POST = array_map ('stripslashes_deep', $_POST);
}
$to = ";
$subject = ";
list fields should
$expected = array ('name', 'email', 'Comments');
Set required fields
$required = array ('name', 'Comments');
create an empty array for all the missing fields
$missing = array();
Suppose that there is nothing suspicious
$suspect = false;
create a model to identify suspicious phrases
$pattern = ' / content-Type. Bcc. Cc: / I ';
function to check suspicious phrases
function isSuspect ($val, $pattern and $suspect) {}
If the variable is an array, loop through each element
and pass it to the same function recursively
If (is_array ($val)) {}
{foreach ($val as $item)
isSuspect ($item, $pattern, $suspect);
}
} else {}
If one of the suspicious phrases is found, the Boolean true value
If (preg_match ($pattern, $val)) {}
$suspect = true;
}
}
}
Check the array $_POST and suspicious content subdashboards
isSuspect ($_POST, $pattern, $suspect);
If {($suspect)
$mailSent = false;
unset ($missing);
} else {}
process Variables $_POST
foreach ($_POST as $key = > $value) {}
assign a temporary variable and in the band otherwise a table space
$temp = is_array ($value)? $value: trim ($value);
so empty and if necessary, add to the $missing table
If (empty ($temp) & & in_array ($key, $required)) {}
return ($manquant, $key);
} else if (in_array ($key, $expected)) {}
Otherwise, assign to a variable of the same name as $key
${$key} = $temp;
}
}
}
validate email address
If (! empty ($email)) {}
Regex to identify illegal characters in the e-mail address
$checkEmail = ' / ^ [^ @] + @[^ \s\r\n\'";,@%]+$/';]
reject the e-mail address, if it does not
If (! preg_match ($checkEmail, $email)) {}
$suspect = true;
$mailSent = false;
unset ($missing);
}
}
Go ahead ONLY if not suspicious and all fields OK
If (! $suspect & & empty ($missing)) {}
build the message
$message = "name: $name\r\n\r\n";
$message. = "e-mail: $email\r\n\r\n";
$message. = "message: $comments\r\n\r\n";
the length of the line is limited to 70 characters
$message = wordwrap ($message, 70);
Create other headers
$headers = "from: Enquiry\r\n website;
$headers. = "content-Type: text/plain;" charset = utf - 8';
If (! empty ($email)) {}
$headers. = "\r\nReply-To: $email";
}
Send it
$mailSent = mail ($ $subject, $message, $headers);
If {($mailSent)
$missing is more necessary if the email is sent, so unplugged it
unset ($missing);
}
}
}
? >
< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
" < html xmlns =" http://www.w3.org/1999/xhtml ">
< head >
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
<? PHP
If ($_POST & & $mailSent) {? >}
< META HTTP-EQUIV = "Refresh" CONTENT = "5; URL = index.php">
<? PHP}? >
< title > < / title >
< name meta = "description" content = "" / > "
< name meta = "keywords" content = "" / > "
< link href = "style/style.css" rel = "stylesheet" type = "text/css" / > "
< script src = "SpryAssets/SpryValidationTextField.js" type = "text/javascript" > < / script > "
< link href = "SpryAssets/SpryValidationTextField.css" rel = "stylesheet" type = "text/css" / > "
< script type = "text/javascript" >
var _gaq = _gaq. [];
_gaq.push (['_setAccount ', 'UA-11804201-5']);
_gaq.push (['_trackPageview ']);
(function() {}
GA var = document.createElement ('script'); GA.type = ' text/javascript '; GA. Async = true;
ga.src = ("https:" == document.location.protocol? ) https://SSL ' : ' http://www ( ') + «.google-analytics.com/ga.js ";
var s = document.getElementsByTagName ('script') [0]; ParentNode.InsertBefore (ga, s);
})();
< /script >
< / head >
< body <? PHP if ($_POST & & $mailSent) {? > onLoad = "redirect ()" <? php}? > >
"< img src="images/photography/background.jpg "alt = 'Jack Wilesmith furniture Design' class = 'bg' id ="bg"/ >
< div id = "container" >
< div id = "Header" >
< / div >
< div id = "content" >
<? PHP
If ($_POST & & isset ($missing) & &! empty ($missing)) {}
? >
< class p = "WARNING" > < strong > please fill in the missing elements indicated. < facilities > < /p > < br / >
<? PHP
} else if ($_POST & &! $mailSent) {}
? >
< class p = "WARNING" > < strong > sorry, there was a problem sending your message, please try again later. < facilities > < /p > < br / >
<? PHP
} else if ($_POST & & $mailSent) {}
? >
< p > < strong > your Message has been sent successfully - < strong > you will be redirected in 5 seconds < facilities > < / strong > < /p > < br / >
< SCRIPT LANGUAGE = "JavaScript" > <!--
function redirect () {setTimeout ("go_now ()", 5000) ;}}
function go_now () {window.location.href = 'index.php' ;}
--> < /script >
<? PHP}? >
< form id = "form1" name = "form1" method = "post" action = "<?" PHP echo $_SERVER ['PHP_SELF'];? > ">"
< p >
< label for 'name' = > name: < / label > < br / >
< input name = "name" type = "text" class = "textInput" id = 'name '.
<? PHP if (isset ($missing)) {}
' echo ' value = ' '. htmlentities ($_POST ['name'], ENT_COMPAT, ' UTF-8 ""). ' "';"
}
? >
/ > <? PHP
If (isset ($missing) & & in_array ('name', $missing)) {? > < span class = "WARNING" > please enter your name </span > <? php}? >
< /p > < br / >
< p >
< label for = "email" > Email: < / label > < br / >
< span id = "sprytextfield1" >
< input name = "email" type = "text" class = "textInput" id = "email".
<? PHP if (isset ($missing)) {}
' echo ' value = ' '. htmlentities ($_POST ['email'], ENT_COMPAT, ' UTF-8 ""). ' "';"
}
? >
/ >
< span class = "textfieldInvalidFormatMsg" > Invalid format. </span > < / span >
<? PHP
If (isset ($missing) & & in_array ('email', $missing)) {? > < span class = "WARNING" > please enter your email </span > <? php}? >
< /p > < br / >
the legend <>< / legend >
< p >
< label for 'comments' = > Message: < / label > < br / >
< = 'comments' id = cols 'comments' textarea name = "45" rows = "5" > <? PHP if (isset ($missing)) {}
echo htmlentities ($_POST ['comment'] ", ENT_COMPAT, ' UTF-8 ');
} ? > < / textarea > <? PHP
If (isset ($missing) & & in_array ('Comments', $missing)) {? > < span class = "WARNING" > please enter a Message </span > <? php}? >
< /p > < br / >
< class p = "clearIt" >
< input name = "send" type = "submit" id = "send" value = "Send message" / >
< /p >
" < input name ="email"type ="hidden"id = 'email' value = ' [email protected] "/ >
< / make >
< / div >
< / div >
< script type = "text/javascript" >
<!--
var sprytextfield1 = new Spry.Widget.ValidationTextField ("sprytextfield1", "email", {isRequired:false, index: "[email protected]"});
->
< /script >
< / body >
< / html >
$to = $_POST ['email'];
PHP includes the file is not read.
I made a php include file that contains all of the generic actions mail processing script. When I deploy my page contact form with appropriately updated code and linking using the include() function code and then provide a path to the file, it does not work. The end result is that I get an email to my account that I put in place must be sent to me as an alert if there is a problem reading the include file. I'll give you the coding for the include file and the feedback form page:
Include a file code:
<? PHP
If (isset($_SERVER['SCRIPT_NAME']) & & strpos ($_SERVER ['SCRIPT_NAME'],))
Inc.php')) "exit";
Remove characters from exhaust AFTER table
If (via PHP_VERSION < 6 & & get_magic_quotes_gpc()) {}
function stripslashes_deep ($value) {}
$value = is_array ($value)? array_map ('stripslashes_deep', $value): stripslashes ($value);
return $value;
}
$_POST = array_map ('stripslashes_deep', $_POST);
}
Suppose that there is nothing suspicious
$suspect = false;
create a model to identify suspicious phrases
$pattern = ' / content-Type. Bcc. Cc: / I ';
function to check suspicious phrases
function isSuspect ($val, $pattern and $suspect) {}
If the variable is an array, loop through each element
and pass it to the same function recursively
If (is_array ($val)) {}
{foreach ($val as $item)
isSuspect ($item, $pattern, $suspect);
}
}
else {}
If one of the suspicious phrases is found, the Boolean true value
If (preg_match ($pattern, $val)) {}
$suspect = true;
}
}
}
Check the array $_POST and suspicious content subdashboards
isSuspect ($_POST, $pattern, $suspect);
If (! empty($_POST['url'])) {}
$suspect = true;
}
If {($suspect)
$mailSent = false;
unset ($missing);
} else {}
treat the variables of $_POST
foreach ($_POST as $key = > $value) {}
assign a temporary variable and strip space if this isn't a table
$temp = is_array ($value)? $value: trim ($value);
so empty and if necessary, add to the $missing table
If (empty ($temp) & & in_array ($key, $required)) {}
return ($manquant, $key);
} else if (in_array ($key, $expected)) {}
Otherwise, assign to a variable of the same name as $key
${$key} = $temp;
}
}
}
validate email address
If (! empty ($email)) {}
Regex to identify illegal characters in the e-mail address
$checkEmail = ' / ^ [^ @] + @[^ \s\r\n\'";,@%]+$/';]
reject the e-mail address, if it does not
If (! preg_match ($checkEmail, $email)) {}
$suspect = true;
$mailSent = false;
unset ($missing);
}
}
go forward only if all OK required fields
If (! $suspect & & empty ($missing)) {}
Initialize the variable $message
$message = ";
loop in the $expected table
{foreach ($expected as $item)
assign the value of the current item to $val
If (isset(${$item}) & &! empty(${$item})) {}
$val = ${$item};
} else {}
If she has no value, set "not chosen".
$val = "not sΘlectionnΘe";
}
If a table, expand under chain comma-gap
If (is_array ($val)) {}
$val = implode (', ', $val);
}
Add the label and value to the message body
$message. = ucfirst ($item). ' ': $val\r\n\r\n ";
}
the length of the line is limited to 70 characters
$message = wordwrap ($message, 70);
Create the Reply-To header
If (! empty ($email)) {}
$headers. = "\r\nReply-To: $email";
}
Send it
$mailSent = mail ($ $subject, $message, $headers);
If {($mailSent)
$missing is more necessary if the email is sent, so unplugged it
unset ($missing); ECHO ('please contact Solutions Web common wealth');
}
}
? >
< ! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
" < html xmlns =" http://www.w3.org/1999/xhtml ">
< head >
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
< title > Untitled Document < /title >
< / head >
< body >
< / body >
< / html >
Code of the feedback form page (with the code include line, note the path of the file that I used. I do indeed follow the include file; process_mail. Inc.php in a folder include in the main public_html directory. It should work. "Maybe there is somethiing wrong with my code?) :
<? PHP
If (array_key_exists ('Send', $_POST)) {}
mail processing script
$to = ' [email protected] '; / / use your own e-mail address
$subject = "contact form investigation."
list fields should
$expected is array ('name', 'email', 'phone', 'Comments');.
Set required fields
$required = array ('name', 'email', 'Comments');
create an empty array for all the missing fields
$missing = array();
create additional headers
$headers = "from: Caleb Wright < . " [email protected] > \r\n";
$headers. = "content-Type: text/plain;" charset = utf-8\r\n ";
$headers. = "cc: " [email protected] ';
If (! empty ($email)) {}
$headers. = "\r\nReply-To: $email";
}
$process = '.. / includes/process_mail. Inc.php';
If (file_exists ($process) & & is_readable ($process)) {}
include ($process);
} else {}
$mailSent = false;
mail ("$ ' server problem","$process cannot be read", $headers);
}
}
? >
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional / / IN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > ""
" < html xmlns =" http://www.w3.org/1999/xhtml ">
< head >
< name meta = "description" content = "" Common Wealth Web Solutions: Web development, Graphic Design, Media Consultant, Community Engagement "/ >"
< name meta = "keywords" content = "' Common, wealth, Web, Design, graphic design, development, interactivity, services, fla sh, php, javascript, ajax, professional Solution, Caleb Wright, Peter Wallis, artist, video, multimedia, production, search engine optimization, SEO, video production design" / > "
< meta http-equiv = "Content-Type" content = text/html"; Charset = UTF-8 "/ >"
< title > Common Wealth Web Solutions: < /title > Contact form
< link href = "stylesMain.css" rel = "stylesheet" type = "text/css" / > "
<!-[if lt IE 7] >
< link rel = "stylesheet" type = "text/css" href = "PNGfix.css" / > "
<! [endif]-->
<!-[if lte IE 7] >
< style type = "text/css" >
#hornav ul li {padding: 0 0 0 10px ;}}
< / style >
<! [endif]-->
<!-[if lte IE 6] >
< style type = "text/css" >
#wrapper - body, #wrapper - 1, #wrapper-2, #wrapper - 3 {height: 1% ;}}
< / style >
<! [endif]-->
< script type = "text/javascript" src = "scripts.js" > < / script >
< script src = "Scripts/swfobject_modified.js" type = "text/javascript" > < / script > "
< script src = "SpryAssets/SpryAccordion.js" type = "text/javascript" > < / script > "
< style type = "text/css" >
{#apDiv1}
position: absolute;
Width: 1844px;
height: 43px;
z-index: 1;
left: 64px;
top: 253px;
}
{body
background-color: #FFF;
}
< / style >
< link href = "SpryAssets/SpryAccordion_flexible.css" rel = "stylesheet" type = "text/css" / > "
< style type = "text/css" >
a: link {}
Color: #00F;
}
< / style >
< link href = "contact.css" rel = "stylesheet" type = "text/css" / > "
< script type = "text/javascript" >
var _gaq = _gaq. [];
_gaq.push (['_setAccount ', 'UA-3119473-5']);
_gaq.push (['_setDomainName ', 'none']);
_gaq.push (["_setAllowLinker", true]);
_gaq.push (['_trackPageview ']);
(function() {}
GA var = document.createElement ('script'); GA.type = ' text/javascript '; GA. Async = true;
ga.src = ("https:" == document.location.protocol? ) https://SSL ' : ' http://www ( ') + «.google-analytics.com/ga.js ";
var s = document.getElementsByTagName ('script') [0]; ParentNode.InsertBefore (ga, s);
})();
< /script >
< script type = "text/javascript" >
var _gaq = _gaq. [];
_gaq.push (['_setAccount ', 'UA-3119473-6']);
_gaq.push (['_setDomainName ', 'none']);
_gaq.push (["_setAllowLinker", true]);
_gaq.push (['_trackPageview ']);
(function() {}
GA var = document.createElement ('script'); GA.type = ' text/javascript '; GA. Async = true;
ga.src = ("https:" == document.location.protocol? ) https://SSL ' : ' http://www ( ') + «.google-analytics.com/ga.js ";
var s = document.getElementsByTagName ('script') [0]; ParentNode.InsertBefore (ga, s);
})();
< /script >
< / head >
< body >
< div id = "wrapper" body >
< div id = "wrapper-1" >
< div id = "branding" >
< h1 >
< object classid = "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width = "700" height = "250" id = 'FlashID' title = "Common Wealth banniΦre" > "
< param name = "movie" value = "commonwealthbanner.swf" / > "
< param name = "quality" value = "high" / >
< param name = "wmode" value = "opaque" / >
< param name = "swfversion' value ="6.0.65.0"/ >
<!-this param tag prompts users with Flash Player 6.0 r65 or later to download the latest version of Flash Player. Delete it if you do not want users to display the prompt. ->
< param name = "expressinstall" value = "Scripts/expressInstall.swf" / > "
<!-next object tag is for non - IE browsers. Then he hide from IE using IECC. ->
<!-[if! IE] >->
< object type = "application/x-shockwave-flash" data = "commonwealthbanner.swf" width = "700" height = "250" > "
<!-<! [endif]-->
< param name = "quality" value = "high" / >
< param name = "wmode" value = "opaque" / >
< param name = "swfversion' value ="6.0.65.0"/ >
< param name = "expressinstall" value = "Scripts/expressInstall.swf" / > "
<!-the browser displays the following alternative content for users of Flash Player 6.0 and higher. ->
< div >
< h4 > the content of this page requires a newer version of Adobe Flash Player. < / h4 >
" < p > < a href =" http://www.Adobe.com/go/getflashplayer_fr "> < img src = ' http://www.Adobe.com/images/shared/download_buttons/get_flash_player.gif "alt = 'Get Adobe Flash player' width = '112' height ="33"/ > < /a > < /p > "
< / div >
<!-[if! IE] >->
< / object >
<!-<! [endif]-->
< / object >
< / h1 >
< div > < / div >
< / div >
< div id = "wrapper-2" >
< div id = "top content" class = "png" > < / div >
< div id = "wrapper-3" >
< div id = "content-1" >
< div class = "content wrap" >
< div id = "Accordion1" class = "Accordion" tabindex = "0" >
< div class = "AccordionPanel" >
< div class = "AccordionPanelTab" > Site Navigation < / div >
< div class = "AccordionPanelContent" > < a href = "index.php" > Mission < /a > < / div > ""
< / div >
< div class = "AccordionPanel" >
< div class = "AccordionPanelTab" > Services < / div >
< div class = "AccordionPanelContent" >
< p > < a href = "Services_Web Design.php" title = "Home" > Web Design < /a > < /p >
< p > < a href = 'Design.php of Production' video > video Production Design < /a > < /p >
< p > < a href = "SEO.php ' > Search Engine Optimization < /a > < /p >" "
< / div >
< / div >
< div class = "AccordionPanel" >
< div class = "AccordionPanelTab" > about us < / div >
< div class = "AccordionPanelContent" >
< p > < a href = "AboutCaleb.php" > Caleb Wright < /a > < /p > ""
< p > Coming Soon... < /p >
< /P > < p > Peter Wallis
< / div >
< / div >
< div class = "AccordionPanel" >
< div class = "AccordionPanelTab" > Contact < / div >
< div class = "AccordionPanelContent" >
< p > < a href = "Contact Form.php" > form < /a > < /p >
< / div >
< / div >
< / div >
< p > < / p >
< / div >
< / div >
< div id = "content-2" >
< div class = "content wrap" >
Contact us < h1 > < / h1 >
<? PHP
If ($_POST & & isset ($missing) & &! empty ($missing)) {}
? >
< class p = 'WARNING' > please fill in the missing elements indicated. < /p >
<? PHP
} else if ($_POST & &! $mailSent) {}
? >
< p > < strong > your message has been sent. Thanks for choosing Web Solutions common wealth.
< facilities > < / p >
<? PHP}? >
< p > < / p >
< form action = "<?" PHP echo $_SERVER ['PHP_SELF'];? ">" method = "post" name = 'Contact us' class = "content-wrap" id = "contact us" >
< fieldset > < class legend = "AccordionPanelContent" > contact information < / legend > < p >
< label for = "name" > < span class = "fieldname" > name: </span >
<? PHP
If (isset ($missing) & & in_array ('name', $missing)) {? >}
< span class = "WARNING" > please enter your name < span > <? PHP}? >
< / label >
< label for = "name" > < / label >
< span id = "sprytextfield1" >
< input name = "name" type = "text" class = "textInput" id = 'name '.
<? PHP if (isset ($missing)) {}
"' echo ' value =" ".htmlentities ($_POST ['name'], ENT_COMPAT, ' UTF - 8' UTF - 8') .e. '" ';
} ? >
/ >
</span > < / p >
< class p 'fieldname' = >
< label for = "email" > Email:? PHP
If (isset ($missing) & & in_array ('email', $missing)) {? >}
< span class = "WARNING" > enter your e-mail < span > <? PHP}? >
< / label >
< input name = "email" type = "text" class = "textInput" id = "email".
<? PHP if (isset ($missing)) {}
"' echo ' value =" ".htmlentities ($_POST ['email'], ENT_COMPAT, ' UTF - 8' UTF - 8') .e. '" ';
} ? >
/ >
< /p >
< p >
< label class "phone" = "fieldname" = > phone: < br / >
< / label >
< input name = "phone" type = "text" class = "textInput" id = "phone".
<? PHP if (isset ($missing)) {}
"' echo ' value =" ".htmlentities ($_POST ['Telephone'], ENT_COMPAT, ' UTF - 8' UTF - 8') .e. '" ';
} ? >
/ >
< /p >
< / fieldset >
< p > < / p >
< fieldset >
< class = "AccordionPanelContent" legend > how can we help you? < / legend >
< label for 'Comments' = > < br / >
<? PHP
If (isset ($missing) & & in_array ('Comments', $missing)) {? >}
Please enter your feedback < span > <? PHP}? >
< / label >
< = 'comments' id = cols 'comments' textarea name = "100" rows = "5" > <? PHP
If (isset ($missing)) {}
echo htmlentities ($_POST ['comment'] ", ENT_COMPAT, ' UTF-8 ');
} ? > < / textarea >
< /p >
< p >
< input type = "submit" name = "send" id = "send" value = "Send comments" / >
< /p >
< id p = "website" >
website < label = 'url' >: < / label >
< /p >
< / make >
< / div >
< / div >
< div id = "content-bottom" > < / div >
< / div >
< div id = "footer" >
< p > < strong > common wealth Web Solutions < facilities >
< script type = "text/javascript" >
<!--
applesearch.init ();
->
< /script > < strong > © 2011 < facilities > < / p >
< / div >
< / div >
< / div >
< / div >
< script type = "text/javascript" >
var Accordion1 = new Spry.Widget.Accordion ("Accordion1", {useFixedPanelHeights: false, defaultPanel:-1});
< /script >
< / body >
< / html >
The code immediately preceding is the code with php feedback form page.
Since your email is a failure I will assume the rest of your script works. I'm looking specifically at these lines:
$process = '../includes/process_mail.inc.php'; if (file_exists($process) && is_readable($process)) { include($process);
Things that must be confirmed here are that the path is right and it has the appropriate permissions. Have you tried to delete this statement 'and' in your 'if' and see if those who operate independently. I have a feeling that if the path is right that the file does not have the appropriate permissions on your server for access global read which would, "is_readable" fail and thus put an end to your script.
Can you test those and after return?
Postgres driver missing in the sierra (phpinfo.php) PDP?
My Mac El Capitan phpinfo.php lists three PDO drivers:
PDO drivers mysql, sqlite, pgsql
I updated another mac Sierra and the phpinfo.php reported only two: mysql and sqlite.
That's why I always get a message when you try to use the same software that runs on El Capitan.
Error is: "failed connection: driver is not found.
Why this driver was eliminated from the Sierra? Is there a solution?
Note: Sierra had PHP Version 5.6.24, whereas I used 5.5.3.4 with El Capitan.
Kind regards
Tom S.
based on a similar proposal posted to correct the problem by adding these lines in /etc/php.ini solved this problem:
extension=/applications/server.app/Contents/ServerRoot/usr/lib/php/extensions/no-debug-non-ZTS-20131226/PDO_PGSQL.so
extension=/applications/server.app/Contents/ServerRoot/usr/lib/php/extensions/no-debug-non-ZTS-20131226/pgsql.so
session.entropy_length = 20
is = / dev/random
session.hash_function = sha512
Date.TimeZone = "America/New_York".
Server 5.2 php pgsql.so module does not
After installation of macOS Sierra and Server 5.2, I find that Roundcube is no longer able to connect to a PostgreSQL database. I back down to the file php.ini configuration does not load the pdo_pgsql.so/pgsql.so modules. All the world has noticed this change?
I see that the server still has its own php.ini file with extension to pgsql inside settings. However, the configuration of php is more load the server php.ini file, because it seems before. How could I do php load in the server's PHP.ini?
I have this problem as well!
It is very bad, I have a few site that using pgsql and they are now down until I'm looking for the solution!
Just try to find how to upgrade PHP on El Capitan
You will need to do this in terminal:
How to open files in pdf format .php. Can do in Safari, and not in FF
I tried to open a file from a web page that downloads as a .php. When I open it, it happens like jibberish (for me), not in pdf format. If I use Safari, it happens in pdf format in the appropriate format.
Thanks in advance.
You can rename the file in the Finder and add a .pdf file extension if the vehicle currently has a .php file extension.
Better still is to check the file name when you download and save a file to make sure that the file has the correct file extension to avoid these problems.
I recently moved an OS X server at Yosemite 10.11.5. All right, until I needed graphics in LimeSurvey. In the past, I had installed the lip.ch PHP package, adjusted Apache and operated. This week, I tried all the packages that I can; most HomeBrew; and despite all the theninstallations have completed without error, I can't get Apache to use anything other than the Apple of PHP installation. It's extremely frustrating. Given that this isn't strictly a fault of Apple, I've posted on other forums and there are other users El Capitan having the same problem. What complicates things, is that my web root folder is on another partition. Years ago, I moved the library server Web folder / and have since just migrated there. I be quite clueless as to what this means in terms where some of its parameters becomes server. However, it is all the work - with the exception of graphics in LimeSurvey. All advice, directions of good explanations of Apache in OS X, etc etc would be much appreciated.
I use successfully the 5.6.x PHP version
with OS X 10.11.5 and Server 5.1.5
After each update of the.app you do check and change the settings of the web server again to ensure that the web service uses the version of PHP Liip.
Configuration file:
/Library/Server/Web/config/apache2/httpd_server_app.conf
It's the line that loads the PHP version that is provided by Apple:
LoadModule php5_module libexec/apache2/libphp5.so
If you want to just put this comment out line, then do this way:
#LoadModule add_some_comment_here_for_example_the_date_when_you_made_the_change php5_module libexec/apache2/libphp5.so
Otherwise, the.app might try to re-activate this line when you check the box 'Enable PHP' Web Server Control Panel.
Then replace it with this line, or add this line:
LoadModule php5_module /usr/local/php5/libphp5.so
Here, it works without any problem.
Firefox asked out of the blue if I want to download afr.php - what is it?
I forgot to take dumps of the document screen. AFR.php has been described as a text file and I thought I'd have a glance. However, firefox has warned it was a script, so I gave up the download. A hacker attack?
> A hacker attack?
No doubt. I can't say how or why it happened, but that's what I think:
A malware has attempted to open a PHP script on your local system, and it seems you didn't have not a Web + PHP server install on your system, so that the script was not run, instead, Firefox is a file download and asked if you want to download it.
Your server has not installed PHP, or PHP is disabled by mistake.
I am trying to install WordPress from a download and get on this error error: PHP is not running. What I can do.
Sound your server error, not firefox question.
If you try to install wordpress locally, use WAMP server
If your installation on your server or hosted server, contact the admin
If I use Safari as my browser, the hotkey opens on another Web page, as it should, without going through a php file download process when the Firefox browser is used. What gives?
Oops, I need to sign up for anything on the site...
Here are a few things you can do additional tests:
(1) when you download the newsletter, it is in PDF format?
(A) on your Mac, you may need to name the file downloaded with a .pdf at the end of the file name extension so that it can open in Adobe Reader (or an extract or other PDF reader that you use).
(B) on your PC, can you say display the newsletter if it's displaying in the plugin Adobe Acrobat, PDF Viewer integrated Firefox or another plugin?
(2) more suggestions if necessary.
How to enable php on Mountain Lion 10.8.3
I used this method without problems up to 10.6
Just pulled up a new MacBook Pro with installed 10.8.3
I created a folder Sites lacking, and recreates it as "blessed".
I put a sample file to test later.
I need to access the list of files from localhost / ~ mycomputername so I can test it before downloading.
However, when I used the 'Go to Folder' to access the location of the file that I need to change which is: /etc/apache2/httpd.conf
and tried to remove the # in front of the PHP5 file, it won't let me save it even if I don't myself add READ/WRITE permissions for the file in the READ the INFORMATION box.
What a disaster!
How to activate it if I see my PHP files in my own browser before I download them?
This part works http://myname-computer.local/
But this is not localhost / ~ ComputerName
Apparently, the Apache server is enabled
I used the terminal to find the string to remove the #.
But it will not erase.
What I am doing wrong?
Supposedly, I would be able to access my files by navigating to the Sites folder I added after that I get PHP running.
I followed the instructions here:
http://osxdaily.com/2012/09/10/enable-PHP-Apache-Mac-OS-x/
The problem IS NOT RESOLVED, so I don't know why it is marked as such.
Firefox (yet) open several tabs when I open any PHP file
I tried all of the fixes suggested in your article, including removing mimeTypes.rdf, change the default browser for files PHP and my PC for malware analysis. The problem is still ongoing. Any ideas? Thank you.
Thanks much for the reply, cor - el. I've been teaching myself PHP for the last month or two, so I downloaded on my PC at home of Apache and PHP files are mine. In fact, the problem of multiple tabs started right after I updated Firefox to version earlier this week. The strange thing is that the same PHP files open perfectly fine before the update.
In any case, I found a workaround on www.bleepingcomputer.com. Instead of double-clicking the PHP file, which causes the problem of multiple tabs, I type the path of the PHP (for example, localhost/index.php) file in the URL in Firefox toolbar. The file works as before without having to open the tabs. It is not an ideal solution, but it will do for now.
We run a programme of internal timesheet open source called Timesheet Next Gen available on Sourceforge. We have it worked for a few years without any problems. We moved all of our Firefox users because the developer has indicated that there are questions of the sort associated with PHP and MYSQL via Internet Explorer. Dropdown lists using surveyed data did not follow the order of sorting and list have been blurred without order with duplicate entries. We had experienced this on our Windows 7 workstations in Internet Explorer (any version) and everything worked fine in Firefox. For some of us with the MacBook, the sort worked well in Firefox and Safari.
Departure last week (perhaps Tuesday or Wednesday) all our users to Workstation Windows 7 has started to have the same sorting problems in Firefox with our internal website of timesheet. There is no change for timesheet Web site or the server that is running as much as php and server extensions web apache. I've since updated the server (Ubuntu) and apache, mysql and php are underway. Now sort in Firefox has stop working on our mac workstations. Safari is the only browser that works. We have installed Chrome on mac and Windows 7 and it does not sort either.
To wrap to the top of this thread, the solution is available here: http://sourceforge.net/p/tsheetx/discussion/779084/thread/02841540/
The general idea behind that the solution can be applied to other projects where a JavaScript object is created in PHP and you need access to its members in order of addition.
Maybe you are looking for
-
card not recognized on Vertiron M4620G running windows 8.1 64 bit
Hi people, have tried to install the new card "soundblaster" and Device Manager doesn't recognize pci - e. Have disabled audio controller integrated into the bios, still nothing any suggestions?
-
I get the following error message when you install Windows XP Professional: a fatal error has occurred. Setup cannot continue. Please contact your support representative or a seller/provider untorised. Press to stop the system. I have real service pa
-
Error when you try to run iTunes: error 7, Windows Error 998
iTunes iTunes. Error 7 error windows 998 I tried to turn off DEP for this program, but it won't let me. I can't use my ipod for music. Ideas: You have problems with programs Error messages Recent changes to your computer What you have already tried t
-
I'm configuring my settings of connectivity on my E6500. I type 192.168.1.1 and the logon screen comes up. I tried signing in with my username and password and also disconnect from the internet and the connection the router password. After that I con
-
I have an epson r800 printer, do not print with this computer
Just bought Hp h8-1010 with Windows7. I am trying to set up printer Epson R800 (already used on Windows XP) Downloaded the software, but do not print. I've updated Epson driver, still nothing.