TAG | certificate
When connecting to Subversion repositories using SSL connections the SVN client checks the server certificate if it is not expired, if it’s host description matches the host of the repository and if the authority which signed the certificate is trusted.
If the certificate fails to comply with any of the above rules the SVN client will respond with a message such as this one:
Error validating server certificate for ‘https://hostname:443′:
– The certificate is not issued by a trusted authority. Use the
fingerprint to validate the certificate manually!
– Hostname: hostname
– Valid: from Tue, 16 Feb 2010 16:58:39 GMT until Fri, 14 Feb 2020 16:58:39 GMT
– Issuer: company.com, London, Berkshire, GB
– Fingerprint: d5:4e:d8:12:33:12:a5:f1:18:91:77:40:c4:77:3b:0b:f8:51:71:cd
(R)eject, accept (t)emporarily or accept (p)ermanently?
The certificate can still be accepted permanently manually. It may not be a solution if SVN commands are issued by non interactive processes. For example a PHP script run by apache trying to export a branch from the repository.
Certificates signed by trusted authorities such as Verisign should not have any problems. But self signed certificates will not be recognized by the SVN client which in turn will respond with the response above. Self signed certificates can be be made trusted by the SVN client by using the ssl-authority-files configuration option:
ssl-authority-files = /home/void/.subversion/company.crt
The configuration file named servers which holds this configuration option can be stored in multiple locations on the filesystem. First the Subversion client will try to look for it in the home folder of the user that is executing the SVN command. Users such as apache will most likely not have a home folder. In such cases SVN tries to look for the servers file in the /etc/subversion directory. It may or may not exist depending on the OS distribution flavour. For example it exits on Ubuntu but does not exist on CentOS a flavour of RedHat.
Finally! After months of battles with myself delaying the day out of pure laziness I took the PHP 5 Zend Certificate exam and passed it! Should be visible in the yellow pages in the following 7 days. I’m really happy I have done this and I hope this will help me in the future to prove my worth to current and future employers.
I’d love to share some details about my experiences with my readers who might one day take the exam themselves.
First of all.. It’s sad that companies such as Zend or PearsonVUE can’t store my firstname and lastname with a proper encoding. Surprising that such world famous international companies don’t use UTF8 encoding. The paper I got after taking the exam had my name written as “?ilvinas ?altys”. When I forgot my password and had to fill in my first name and last name to get a new one I had to use question marks to make it work.
Before taking the exam I’ve done about 13 mock exam tests. I also had problems to order them and had to contact Zend and wait for weeks to complete my order, the tests them selves aren’t very good. You get 70 questions and 90 minutes to answer them. Tests had lots of mistakes and sometimes rather dumb questions. For example .. Which methods are required to implement when implementing the Iterator interface. Tests give 5 choices and ask to select 5 choices. Then there are questions which you cannot answer correctly because either they are out of date or they are wrong from the start. Then there are questions that ask you questions about the PHP virtual machine implementation or PDO extension options or Sqlite performance configuration settings. Good luck knowing all that. After 10 tests you start shooting answers like darts because questions start to repeat a lot. The most frustrating thing is that it’s really hard to learn from these mock tests. They don’t tell you which questions you have answered correctly and why were you wrong. When you start doing a test you look for answers on the internet to find out what is the correct answer and it may some time to do it for any single question. Funny enough I have never got a completely excellent score from the mock exams. I always failed in at least one category and couldn’t figure out why.
About the exam itself. A heard a lot of poeple saying. “Oh it’s easy!”, “Oh it’s easier than the mock exams!”, “It’s basic level!” If you can complete that exam and you are confident that you have answered atleast 90% of the questions correctly you are a walking bible of PHP that knows the manual really well, all the possible configuration options, all the nonsense tricks in PHP and have some profesional experience. It’s not that easy. A lot of questions are hard to answer. Most of the time you can be only 80% sure. Unless of course you have a very good memory and can remember all the details. Not many developers know what PHP does with floating point array keys or how exactly PHP handles type juggling. When I was about to end the exam I was not sure I will pass it. I knew for sure that there were a lot of questions that I wasn’t 100% sure of. There are tons of questions where the exam tries to TRICK you. For example .. You have a lot of code with classes, abstractions and it asks you what does it output? And you can get confused and not notice that there is no echo statement anywhere and there’s no output. Somewhere I’ve found that noone completed the exam with perfect score and I think it was a statement by Zend itself but I’m not completely sure. You have to answer about 50 – 60% of the questions correctly to pass the test.
A few things were disappointing and could have been better but in the end I’ve achieved my goal and would like to thank Zend for making it possible. Certificates can’t tell if someone is a great developer or a nice person but they can definitely tell how much someone knows about the details of a programming language.
I’m getting very close to taking the Zend Certificate Exam just need a few more things to take care of. I’ve made a list of things one should do to be in my opinion really prepared to take the exam. So here goes:
- Read the Zend PHP5 Certification Study Guide. It will get you going through all the basics ant not so basic tipsies and tricksies. It’s quite an easy read and if you are confident you can skip or eye-scan a lot of stuff.
- Read the Essential PHP Security to get a grasp of most of the web security problems.
- Read the PHP 5 Objects, Patterns, and Practice by Matt Zandstra. It teaches most of the Gang Of Four patterns and a few of the so called enterprise ones. It’s one of the best books on design patterns.
- Book reading is over. The HOLY manual is your best friend now. Start with PHP array functions. Study each one of them carefuly, memorize parameters and return values.
- Next go to the PHP string functions.
- You also need to know the basics of XML, Streams, PDO, SQLite if you are going to take the exam. You don’t have to study each extension closely. I would recommend to give more attention to DOM XML, SimpleXML, XML Parser, Streams functions and PDO.
- Go and learn some regular expressions. Should take you one evening or so.
- There are also some misc extensions like SPL or functions like __halt_compiler(), error_reporting() you should know of. Though they cover a little part of the exam.
- Next you buy 5 – 10 Zend Certification Online Practicing Tests and it costs you arround $20 – $25 greengos.
And that’s basically it. Do that and not only you can take the exam but you will have deeper knowledge of the language you are using and how to use it more properly.
I have found a bug in PHP 5.2.6 related to SoapClient. If you pass a relative path of local_cert option to the SoapClient on Windows machines the client does not work and refuses to connect to the service. Actually this is my first bug to report and it got fixed. (I was worried I might be one of those annoying pests who report not bogus stuff) I’m happy I did a tiny itsy bitsy amount of good to PHP.
Previously I wrote that I would like to take the Zend Certification Exam and I thought I could review every chapter of the Zend Certification Exam study guide. Well I think i have lost my inspiration somwhere along the way. Though I recently found a blog that already did what I wanted to do. Check it out and see if it helps. I also found out about Paul Reinheimer’s Zend Certification Exam course which is available as a free PDF on the internet and could be really useful to prepare.
I’m currently preparing to take the Zend PHP certificate exam and have just finished reading the Zend PHP 5 Certification Study Guide. To help myself and other PHP developers to prepare for the exam I thought I could review every Zend PHP5 certification study guide chapter to provide some highlights on things that may not be known to everyone.
Chapter I – PHP basics
- Anatomy of a PHP script
- Data types
You must know that PHP syntax is derived from the C language. PHP syntax has been influenced by Perl and JAVA (latest OOP additions).
PHP supports these opening tags: <?php ?>, <?= ?>, <? ?>, <script language=”php”></script>, <% %>. Interestingly no one knows why <% %> were introduced at all :). Short tags, script tags and ASP tags are all considered deprecated and their use is trongly discouraged.
PHP parser strips new lines after ?> closing tag. An easy way to prevent spurious output from an include file is to omit the closing tag at the end, which the parser considers this perfectly legal.
1.2 Anatomy of a PHP script
It is possible to skip the last semicolon in a PHP script though that is considered a parser quirk and should be avoided.
There are three types of comments in PHP: /* */, //, #. A comment can be ended with a newline or the php closing tag ?>
Interesting to know echo is not a function and, as such, it does not have return value. If you need to output data through a function, you can use print() instead.
An important function is die(); which itself is an alias of exit(); You can echo output with these functions by passing a string or return a numeric status to the process that called PHP by passing an integer.
1.3 Data types
PHP is loosely typed, meaning that it will implicitly change the type of a variable as needed, depending on the operation being performed on its value.
All data types in PHP are divided into two categories scalars and composites. Scalars are: ints, strings, floats, booleans. Numbers can be declared using several different notations: decimal, octal, hexadecimal. Octal numbers can be easily confused with decimal numbers and can lead to some… interesting consequences!
PHP supports two different notations for expressing floats: decimal and exponential. For example 1e2 equals 100. Floats can be as wide as your processor supports. It will be longer on 64 bits systems compared to 32 bits. Be aware that PHP does not track overflows so any operation with big scary numbers can have catastrophic consequences on the reliability of your application. Also be aware that basic operations with floats are not always precise. For example: echo (int) ((0.1 + 0.7) * 10); would output 7 instead of 8. Because internally in PHP the float value is 7.99999 and when casted to an integer becomes 7. To avoid this use extensions such as BCMath.
Strings are ordered collections of binary data. They can store anything from text to music recordings.
Boolean when converted from an integer becomes false if the integer is zero and becomes true otherwise. A string is converted to false only if it is empty or if it contains the single character. If it contains any other data—even multiple zeros—it is converted to true. When converted to a number or a string, a Boolean becomes 1 if it is true, and
Arrays are containers of ordered data elements; an array can be used to store nd retrieve any other data type, including numbers, Boolean values, strings, bjects and even other arrays.
Objects are containers of both data and code. They form the basis of Object oriented programming also known as OOP.
NULL indicates that a variable has no value. A variable is considered to be NULL if it has been assigned the special value NULL, or if it has not yet been assigned value at all.
The resource data type is used to indicate external resources that are not used atively by PHP, but that have meaning in the context of a special operation— such as, for example, handling files or manipulating images.
You can force PHP to convert some types to others. For example: echo (int) $x; Though you cannot convert any data types to resources though vice versa is available to get hold of a resource ID.
Variables can only be named letters, numbers, underscores. A variable can only start with an alpha character or an underscore. Variables and constants are the only two identifier types that are case sensitive.
PHP supports variables variables:
$name = '123';
/* 123 is your variable name, this would normally be invalid. */
$$name = '456';
Variables can also hold function names and functions can be called through variables like this:
$f = ’myFunc’;
$f(); // will call myFunc();
To determine whether a variable exists use isset(). It will return true when a variable is defined and is not NULL.
Constants can only contain scalar values and follow the same naming conventions as variables. They are also case sensitive.
I’ve been working with SoapClient and certificates for some time. I recently switched my old workstation to a new one and while working with a piece of code that seemed to work fine I got an error like this:
Unable to set local cert chain file `filename.pem’; Check that your cafile/capath settings include details of your certificate and its issuer in somescript.php on line ##
I tried to google what the problem might be and found a comment that you can get this error if you have curl extension disabled. But in my case it was enabled and working fine. I tried to remember what extensions I had enabled on my previous box and after a few thoughts I decided to enable mcrypt extension which seems related to crypted certificates and after restarting my webserver everything started working fine.
The php soapclient documentation does not mention anything that soapclient is dependency related to curl or mcrypt.