We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Error when using require_once

Hey guys,

I'm setting up an Email Component for sending a Confirmation Email. Found this Tutorial http://www.sitepoint.com/sending-confirmation-emails-phalcon-swift/

But I'm getting an Error when I use this Code:

require_once (__DIR__ . '/../../vendor/Swift/swift_required.php');

in Mail.php

The Error is:

PHP Warning:  require_once(/var/www/dev/app/library/../../vendor/Swift/swift_required.php): failed to open stream: No such file or directory in /var/www/dev/app/library/Mail.php on line 8
PHP Fatal error:  require_once(): Failed opening required '/var/www/dev/app/library/../../vendor/Swift/swift_required.php' (include_path='.:/usr/share/php:/usr/share/pear') in /var/www/dev/app/library/Mail.php on line 8

Even if I give it the absolute Path, it won't find the file.

Paths to Files are:

/var/www/dev/app/library/Mail.php // The Mail.php
/var/www/dev/vendor/Swift/swift_required.php // File I want to include

Don't know what to try anymore.

Thanks for help.

Ensure that this file is available (=you placed this part of the author's git tree in /var/www/dev/vendor) and check your directory and file permissions. If you are using selinux ensure that all required files have the httpd_sys_content_t context.

chmod -R 775 /var/www/dev/vendor/Swift/
chown -R apache:apache /var/www/dev/vendor/Swift/
chcon -R -t httpd_sys_content_t /var/www/dev/vendor/Swift/
edited May '14

Yes this file is available, has right permissions etc. I'm not using selinux.

Still not working :(

Edit: Does the Vendor Dir has to be registered in my loader?

edited May '14

Check upper and lower case letters, on linux they are not the same: you might have named the folder swift with a lowercase letter, or a file with upper case