2

I am attempting to integrate the PHPJS (http://phpjs.org/) library with some code and am having trouble calling any of the functions and the library's websites does not have a step-by-step for getting started.

I am using the base download php.default.min.js and have created a bare bones page:

<html>
<head>
<script type="text/javascript" src="php.default.min.js"></script>
<script type="text/javascript">
alert(phpversion());
</script>
</head>
<body></body>
</html>

I would expect that to produce a JavaScript alert but I only get a JS error of:

Uncaught ReferenceError: phpversion is not defined.

How do I go about utilizing the functions in the PHP.js library?

3
  • Most likely, php.default.min.js is not getting loaded. Are you sure it's there on that path? ... That said, I'm not sure I get the point of using phpjs in the first place, but that's a different discussion and I'm sure it's been had before :) Commented Jun 6, 2012 at 0:45
  • I thought this might be the case, which is the reason I tried phpversion() first. The source seems to be linked (I can click on it when viewing the page's source in Chrome) but I cannot execute any functions contained within the library. Is there some other way of determining if the library loaded properly? Commented Jun 6, 2012 at 0:49
  • Try setting a breakpoint in the php js file in your Chrome Developer Tools. That should tell you whether it's loading correctly. Commented Jun 6, 2012 at 1:14

1 Answer 1

4

you're using the default package, which doesn't come with the phpversion function. Try using the full package. Both releases have a list of supported functions in the links I've attached.

Hope it helps!

Sign up to request clarification or add additional context in comments.

2 Comments

both links are dead :-(
please provide info how to use it and how to download php.default.min.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.